Little clean of feature several price per customers
This commit is contained in:
parent
cae82104ca
commit
e55d3489aa
@ -250,3 +250,4 @@ PriceExpressionEditorHelp3=In both product/service and supplier prices there are
|
|||||||
PriceExpressionEditorHelp4=In product/service price only: <b>#supplier_min_price#</b><br>In supplier prices only: <b>#supplier_quantity# and #supplier_tva_tx#</b>
|
PriceExpressionEditorHelp4=In product/service price only: <b>#supplier_min_price#</b><br>In supplier prices only: <b>#supplier_quantity# and #supplier_tva_tx#</b>
|
||||||
PriceMode=Price mode
|
PriceMode=Price mode
|
||||||
PriceNumeric=Number
|
PriceNumeric=Number
|
||||||
|
DefaultPrice=Default price
|
||||||
@ -64,11 +64,7 @@ $error=0;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'update_price' && GETPOST("cancel"))
|
if (GETPOST("cancel")) $action='';
|
||||||
{
|
|
||||||
|
|
||||||
$action='';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'update_price' && ! GETPOST("cancel") && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'update_price' && ! GETPOST("cancel") && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
@ -640,13 +636,15 @@ print "</table>\n";
|
|||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Barre d'action */
|
/* Barre d'action */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
if (! $action || $action == 'delete') {
|
if (! $action || $action == 'delete')
|
||||||
|
{
|
||||||
print "\n" . '<div class="tabsAction">' . "\n";
|
print "\n" . '<div class="tabsAction">' . "\n";
|
||||||
|
|
||||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||||
@ -659,10 +657,12 @@ if (! $action || $action == 'delete') {
|
|||||||
/*
|
/*
|
||||||
* Edition du prix
|
* Edition du prix
|
||||||
*/
|
*/
|
||||||
if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
|
{
|
||||||
print_fiche_titre($langs->trans("NewPrice"), '', '');
|
print_fiche_titre($langs->trans("NewPrice"), '', '');
|
||||||
|
|
||||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
|
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||||
|
{
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update_price">';
|
print '<input type="hidden" name="action" value="update_price">';
|
||||||
@ -755,8 +755,11 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<br></form>';
|
print '<br></form>';
|
||||||
} else {
|
}
|
||||||
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) {
|
else
|
||||||
|
{
|
||||||
|
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||||
|
{
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update_price">';
|
print '<input type="hidden" name="action" value="update_price">';
|
||||||
@ -823,10 +826,12 @@ $sql .= " ORDER BY p.date_price DESC, p.price_level ASC";
|
|||||||
// $sql .= $db->plimit();
|
// $sql .= $db->plimit();
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result)
|
||||||
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
if (! $num) {
|
if (! $num)
|
||||||
|
{
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
|
|
||||||
// Il doit au moins y avoir la ligne de prix initial.
|
// Il doit au moins y avoir la ligne de prix initial.
|
||||||
@ -837,9 +842,12 @@ if ($result) {
|
|||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num > 0) {
|
if ($num > 0)
|
||||||
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_fiche_titre($langs->trans("DefaultPrice"),'','');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -868,7 +876,8 @@ if ($result) {
|
|||||||
|
|
||||||
$var = True;
|
$var = True;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num) {
|
while ($i < $num)
|
||||||
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
@ -936,7 +945,9 @@ if ($result) {
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|
||||||
|
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||||
|
{
|
||||||
|
|
||||||
$prodcustprice = new Productcustomerprice($db);
|
$prodcustprice = new Productcustomerprice($db);
|
||||||
|
|
||||||
@ -962,8 +973,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
$filter ['soc.nom'] = $search_soc;
|
$filter ['soc.nom'] = $search_soc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'add_customer_price') {
|
if ($action == 'add_customer_price')
|
||||||
|
{
|
||||||
// Create mode
|
// Create mode
|
||||||
$maxpricesupplier = $object->min_recommended_price();
|
$maxpricesupplier = $object->min_recommended_price();
|
||||||
|
|
||||||
@ -1040,8 +1051,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<br></form>';
|
print '<br></form>';
|
||||||
} elseif ($action == 'edit_customer_price') {
|
}
|
||||||
|
elseif ($action == 'edit_customer_price')
|
||||||
|
{
|
||||||
// Edit mode
|
// Edit mode
|
||||||
$maxpricesupplier = $object->min_recommended_price();
|
$maxpricesupplier = $object->min_recommended_price();
|
||||||
|
|
||||||
@ -1125,7 +1137,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<br></form>';
|
print '<br></form>';
|
||||||
} elseif ($action == 'showlog_customer_price') {
|
}
|
||||||
|
elseif ($action == 'showlog_customer_price')
|
||||||
|
{
|
||||||
|
|
||||||
$filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int'));
|
$filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int'));
|
||||||
|
|
||||||
@ -1198,8 +1212,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print "\n" . '<div class="tabsAction">' . "\n";
|
print "\n" . '<div class="tabsAction">' . "\n";
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">' . $langs->trans("Ok") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">' . $langs->trans("Ok") . '</a></div>';
|
||||||
print "\n</div><br>\n";
|
print "\n</div><br>\n";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// View mode
|
// View mode
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
@ -1215,9 +1230,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
|
|
||||||
$option = '&search_soc=' . $search_soc . '&id=' . $object->id;
|
$option = '&search_soc=' . $search_soc . '&id=' . $object->id;
|
||||||
|
|
||||||
print_barre_liste($langs->trans('PriceByCustomer'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords);
|
print_barre_liste($langs->trans('PriceByCustomer'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
|
||||||
|
|
||||||
if (count($prodcustprice->lines) > 0) {
|
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||||
@ -1246,11 +1259,13 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
if (count($prodcustprice->lines) > 0) {
|
||||||
|
|
||||||
$var = True;
|
$var = True;
|
||||||
|
|
||||||
foreach ($prodcustprice->lines as $line) {
|
foreach ($prodcustprice->lines as $line) {
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr ".$bc[$var].">";
|
||||||
// Date
|
// Date
|
||||||
$staticsoc = new Societe($db);
|
$staticsoc = new Societe($db);
|
||||||
$staticsoc->fetch($line->fk_soc);
|
$staticsoc->fetch($line->fk_soc);
|
||||||
@ -1290,12 +1305,15 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$colspan=9;
|
||||||
|
if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan+=1;
|
||||||
|
print '<td colspan="'.$colspan.'">'.$langs->trans('None').'</td>';
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
} else {
|
|
||||||
print $langs->trans('None');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user