Debug v12

This commit is contained in:
Laurent Destailleur 2020-06-18 19:21:21 +02:00
parent 4cfe1fcd6b
commit b9218a1c4c

View File

@ -55,6 +55,7 @@ $object = new Societe($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('thirdpartycustomerprice', 'globalcard')); $hookmanager->initHooks(array('thirdpartycustomerprice', 'globalcard'));
$error = 0;
/* /*
@ -73,6 +74,13 @@ if (empty($reshook))
} }
if ($action == 'add_customer_price_confirm' && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer)) { if ($action == 'add_customer_price_confirm' && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer)) {
if (! (GETPOST('prodid', 'int') > 0)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Product")), null, 'errors');
$action = 'add_customer_price';
}
if (! $error) {
$update_child_soc = GETPOST('updatechildprice'); $update_child_soc = GETPOST('updatechildprice');
// add price by customer // add price by customer
@ -130,6 +138,7 @@ if (empty($reshook))
$action = ''; $action = '';
} }
}
if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) { if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) {
// Delete price by customer // Delete price by customer
@ -253,6 +262,9 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
if ($action == 'add_customer_price') { if ($action == 'add_customer_price') {
// Create mode // Create mode
print '<br>';
print '<!-- Price by customer -->'."\n";
print load_fiche_titre($langs->trans('PriceByCustomer')); print load_fiche_titre($langs->trans('PriceByCustomer'));
print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
@ -402,6 +414,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<br></form>'; print '<br></form>';
} elseif ($action == 'showlog_customer_price') { } elseif ($action == 'showlog_customer_price') {
print '<br>';
print '<!-- showlog_customer_price -->'."\n"; print '<!-- showlog_customer_price -->'."\n";
$filter = array( $filter = array(
@ -426,6 +439,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
if (count($prodcustprice->lines) > 0) { 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="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -514,6 +528,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVER['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, ''); print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVER['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
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="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -573,16 +588,16 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
// Action // Action
if ($user->rights->produit->creer || $user->rights->service->creer) if ($user->rights->produit->creer || $user->rights->service->creer)
{ {
print '<td class="right">'; print '<td class="right nowraponall">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=showlog_customer_price&amp;socid='.$object->id.'&amp;prodid='.$line->fk_product.'">'; print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER["PHP_SELF"].'?action=showlog_customer_price&amp;socid='.$object->id.'&amp;prodid='.$line->fk_product.'">';
print img_info(); print img_info();
print '</a>'; print '</a>';
print ' '; print ' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=edit_customer_price&amp;socid='.$object->id.'&amp;lineid='.$line->id.'">'; print '<a class="editfielda paddingleftonly paddingrightonly" href="'.$_SERVER["PHP_SELF"].'?action=edit_customer_price&amp;socid='.$object->id.'&amp;lineid='.$line->id.'">';
print img_edit('default', 0, 'style="vertical-align: middle;"'); print img_edit('default', 0, 'style="vertical-align: middle;"');
print '</a>'; print '</a>';
print ' '; print ' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete_customer_price&amp;socid='.$object->id.'&amp;lineid='.$line->id.'">'; print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER["PHP_SELF"].'?action=delete_customer_price&amp;socid='.$object->id.'&amp;lineid='.$line->id.'">';
print img_delete('default', 'style="vertical-align: middle;"'); print img_delete('default', 'style="vertical-align: middle;"');
print '</a>'; print '</a>';
print '</td>'; print '</td>';