* Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2006 Andre Cianfarani * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/comm/multiprix.php * \ingroup societe * \brief Tab to set the price level of a thirdparty */ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Load translation files required by the page $langs->loadLangs(array('orders', 'companies')); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $id = GETPOSTINT('id'); $_socid = GETPOSTINT("id"); // Security check if ($user->socid > 0) { $_socid = $user->socid; } // Security check $socid = GETPOSTINT("socid"); if ($user->socid > 0) { $action = ''; $id = $user->socid; } $hookmanager->initHooks(array('thirdpartyprice', 'globalcard')); $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); /* * Actions */ if ($action == 'setpricelevel' && $user->hasRight('societe', 'creer')) { $soc = new Societe($db); $soc->fetch($id); $soc->setPriceLevel(GETPOST("price_level"), $user); header("Location: multiprix.php?id=".$id); exit; } /* * View */ llxHeader(); $userstatic = new User($db); if ($_socid > 0) { // We load data of thirdparty $objsoc = new Societe($db); $objsoc->id = $_socid; $objsoc->fetch($_socid); $head = societe_prepare_head($objsoc); $tabchoice = ''; if ($objsoc->client == 1) { $tabchoice = 'customer'; } if ($objsoc->client == 2) { $tabchoice = 'prospect'; } print '
'; print ''; print ''; print dol_get_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company'); print ''; print '"; print ''; print "
'; print $langs->trans("PriceLevel").''.$objsoc->price_level."
'; print $langs->trans("NewValue").''; print ''; print '
"; print dol_get_fiche_end(); print $form->buttonsSaveCancel("Save", ''); print "
"; print '

'; /* * List historic of multiprices */ $sql = "SELECT rc.rowid,rc.price_level, rc.datec as dc, u.rowid as uid, u.login"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_prices as rc, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE rc.fk_soc = ".((int) $objsoc->id); $sql .= " AND u.rowid = rc.fk_user_author"; $sql .= " ORDER BY rc.datec DESC"; $resql = $db->query($sql); if ($resql) { print ''; print ''; print ''; print ''; print ''; print ''; $i = 0; $num = $db->num_rows($resql); while ($i < $num) { $obj = $db->fetch_object($resql); print ''; print ''; print ''; $userstatic->id = $obj->uid; $userstatic->lastname = $obj->login; print ''; print ''; $i++; } $db->free($resql); print "
'.$langs->trans("Date").''.$langs->trans("PriceLevel").''.$langs->trans("User").'
'.dol_print_date($db->jdate($obj->dc), "dayhour").''.$obj->price_level.' '.$userstatic->getNomUrl(1).'
"; } else { dol_print_error($db); } } // End of page llxFooter(); $db->close();