diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 0765a6adb31..7ab39a10ddc 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - + $prodcustprice = new Productcustomerprice($db); } @@ -54,9 +54,9 @@ $result = restrictedArea($user, 'societe', $socid, '&societe'); * **************************************************** */ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { - + $update_child_soc = GETPOST('updatechildprice'); - + // add price by customer $prodcustprice->fk_soc = $socid; $prodcustprice->fk_product = GETPOST('prodid', 'int'); @@ -65,15 +65,15 @@ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->ri $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - + $result = $prodcustprice->create($user, 0, $update_child_soc); - + if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } else { setEventMessage($langs->trans('Save'), 'mesgs'); } - + $action = ''; } @@ -81,7 +81,7 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $use // Delete price by customer $prodcustprice->id = GETPOST('lineid'); $result = $prodcustprice->delete($user); - + if ($result < 0) { setEventMessage($prodcustprice->error, 'mesgs'); } else { @@ -91,25 +91,25 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $use } if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { - + $prodcustprice->fetch(GETPOST('lineid', 'int')); - + $update_child_soc = GETPOST('updatechildprice'); - + // update price by customer $prodcustprice->price = price2num(GETPOST("price"), 'MU'); $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - + $result = $prodcustprice->update($user, 0, $update_child_soc); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } else { setEventMessage($langs->trans('Save'), 'mesgs'); } - + $action = ''; } @@ -199,9 +199,9 @@ print ''; print ''; if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - + $prodcustprice = new Productcustomerprice($db); - + $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); @@ -215,23 +215,23 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $sortorder = "ASC"; if (! $sortfield) $sortfield = "soc.nom"; - + // Build filter to diplay only concerned lines $filter = array ( - 't.fk_soc' => $soc->id + 't.fk_soc' => $soc->id ); - + $search_soc = GETPOST('search_soc'); if (! empty($search_soc)) { $filter ['soc.nom'] = $search_soc; } - + if ($action == 'add_customer_price') { - + // Create mode - + print_fiche_titre($langs->trans('PriceByCustomer')); - + print '
'; } elseif ($action == 'edit_customer_price') { - + // Edit mode - + print_fiche_titre($langs->trans('PriceByCustomer')); - + $result = $prodcustprice->fetch(GETPOST('lineid', 'int')); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } - + print ''; } elseif ($action == 'showlog_customer_price') { - + $filter = array ( - 't.fk_product' => GETPOST('prodid', 'int'),'t.fk_soc' => $socid + 't.fk_product' => GETPOST('prodid', 'int'),'t.fk_soc' => $socid ); - + // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); } - + $result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } - + $option = '&socid=' . GETPOST('socid', 'int') . '&prodid=' . GETPOST('prodid', 'int'); - + print_barre_liste($langs->trans('PriceByCustomerLog'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords); - + if (count($prodcustprice->lines) > 0) { - + print '