Skip to content
Snippets Groups Projects
Commit 74be7bf3 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

FIX Filter in customer price per product of a thirdparty returned error

parent ea0bf446
No related branches found
No related tags found
No related merge requests found
...@@ -44,16 +44,16 @@ $langs->load("bills"); ...@@ -44,16 +44,16 @@ $langs->load("bills");
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
// Security check // Security check
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int');
if ($user->societe_id) if ($user->societe_id)
$socid = $user->societe_id; $socid = $user->societe_id;
$result = restrictedArea($user, 'societe', $socid, '&societe'); $result = restrictedArea($user, 'societe', $socid, '&societe');
/**
* *************************************************** /*
* Price by customer * Actions
* ****************************************************
*/ */
if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
$update_child_soc = GETPOST('updatechildprice'); $update_child_soc = GETPOST('updatechildprice');
...@@ -114,91 +114,92 @@ if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user- ...@@ -114,91 +114,92 @@ if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user-
$action = ''; $action = '';
} }
/* /*
* View * View
*/ */
$form = new Form($db); $form = new Form($db);
$soc = new Societe($db); $object = new Societe($db);
$result = $soc->fetch($socid); $result = $object->fetch($socid);
llxHeader("", $langs->trans("ThirdParty") . '-' . $langs->trans('PriceByCustomer')); llxHeader("", $langs->trans("ThirdParty") . '-' . $langs->trans('PriceByCustomer'));
if (! empty($conf->notification->enabled)) if (! empty($conf->notification->enabled))
$langs->load("mails"); $langs->load("mails");
$head = societe_prepare_head($soc); $head = societe_prepare_head($object);
dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company'); dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%">' . $langs->trans("ThirdPartyName") . '</td><td colspan="3">'; print '<tr><td width="25%">' . $langs->trans("ThirdPartyName") . '</td><td colspan="3">';
print $form->showrefnav($soc, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
print '</td></tr>'; print '</td></tr>';
// Alias names (commercial, trademark or alias names) // Alias names (commercial, trademark or alias names)
print '<tr><td>'.$langs->trans('AliasNames').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('AliasNames').'</td><td colspan="3">';
print $soc->name_alias; print $object->name_alias;
print "</td></tr>"; print "</td></tr>";
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{ {
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $soc->prefix_comm . '</td></tr>'; print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
} }
if ($soc->client) { if ($object->client) {
print '<tr><td>'; print '<tr><td>';
print $langs->trans('CustomerCode') . '</td><td colspan="3">'; print $langs->trans('CustomerCode') . '</td><td colspan="3">';
print $soc->code_client; print $object->code_client;
if ($soc->check_codeclient() != 0) if ($object->check_codeclient() != 0)
print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
print '</td></tr>'; print '</td></tr>';
} }
if ($soc->fournisseur) { if ($object->fournisseur) {
print '<tr><td>'; print '<tr><td>';
print $langs->trans('SupplierCode') . '</td><td colspan="3">'; print $langs->trans('SupplierCode') . '</td><td colspan="3">';
print $soc->code_fournisseur; print $object->code_fournisseur;
if ($soc->check_codefournisseur() != 0) if ($object->check_codefournisseur() != 0)
print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
print '</td></tr>'; print '</td></tr>';
} }
if (! empty($conf->barcode->enabled)) { if (! empty($conf->barcode->enabled)) {
print '<tr><td>' . $langs->trans('Gencod') . '</td><td colspan="3">' . $soc->barcode . '</td></tr>'; print '<tr><td>' . $langs->trans('Gencod') . '</td><td colspan="3">' . $object->barcode . '</td></tr>';
} }
print "<tr><td>" . $langs->trans('Address') . "</td><td colspan=\"3\">"; print "<tr><td>" . $langs->trans('Address') . "</td><td colspan=\"3\">";
dol_print_address($soc->address, 'gmap', 'thirdparty', $soc->id); dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
print "</td></tr>"; print "</td></tr>";
// Zip / Town // Zip / Town
print '<tr><td width="25%">' . $langs->trans('Zip') . '</td><td width="25%">' . $soc->zip . "</td>"; print '<tr><td width="25%">' . $langs->trans('Zip') . '</td><td width="25%">' . $object->zip . "</td>";
print '<td width="25%">' . $langs->trans('Town') . '</td><td width="25%">' . $soc->town . "</td></tr>"; print '<td width="25%">' . $langs->trans('Town') . '</td><td width="25%">' . $object->town . "</td></tr>";
// Country // Country
if ($soc->country) { if ($object->country) {
print '<tr><td>' . $langs->trans('Country') . '</td><td colspan="3">'; print '<tr><td>' . $langs->trans('Country') . '</td><td colspan="3">';
$img = picto_from_langcode($soc->country_code); $img = picto_from_langcode($object->country_code);
print($img ? $img . ' ' : ''); print($img ? $img . ' ' : '');
print $soc->country; print $object->country;
print '</td></tr>'; print '</td></tr>';
} }
// EMail // EMail
print '<tr><td>' . $langs->trans('EMail') . '</td><td colspan="3">'; print '<tr><td>' . $langs->trans('EMail') . '</td><td colspan="3">';
print dol_print_email($soc->email, 0, $soc->id, 'AC_EMAIL'); print dol_print_email($object->email, 0, $object->id, 'AC_EMAIL');
print '</td></tr>'; print '</td></tr>';
// Web // Web
print '<tr><td>' . $langs->trans('Web') . '</td><td colspan="3">'; print '<tr><td>' . $langs->trans('Web') . '</td><td colspan="3">';
print dol_print_url($soc->url); print dol_print_url($object->url);
print '</td></tr>'; print '</td></tr>';
// Phone / Fax // Phone / Fax
print '<tr><td>' . $langs->trans('Phone') . '</td><td>' . dol_print_phone($soc->tel, $soc->country_code, 0, $soc->id, 'AC_TEL') . '</td>'; print '<tr><td>' . $langs->trans('Phone') . '</td><td>' . dol_print_phone($object->tel, $object->country_code, 0, $object->id, 'AC_TEL') . '</td>';
print '<td>' . $langs->trans('Fax') . '</td><td>' . dol_print_phone($soc->fax, $soc->country_code, 0, $soc->id, 'AC_FAX') . '</td></tr>'; print '<td>' . $langs->trans('Fax') . '</td><td>' . dol_print_phone($object->fax, $object->country_code, 0, $object->id, 'AC_FAX') . '</td></tr>';
print '</table>'; print '</table>';
...@@ -224,7 +225,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { ...@@ -224,7 +225,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
// Build filter to diplay only concerned lines // Build filter to diplay only concerned lines
$filter = array ( $filter = array (
't.fk_soc' => $soc->id 't.fk_soc' => $object->id
); );
$search_soc = GETPOST('search_soc'); $search_soc = GETPOST('search_soc');
...@@ -238,10 +239,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { ...@@ -238,10 +239,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print_fiche_titre($langs->trans('PriceByCustomer')); print_fiche_titre($langs->trans('PriceByCustomer'));
print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '" method="POST">'; print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $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="add_customer_price_confirm">'; print '<input type="hidden" name="action" value="add_customer_price_confirm">';
print '<input type="hidden" name="socid" value="' . $soc->id . '">'; print '<input type="hidden" name="socid" value="' . $object->id . '">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans('Product') . '</td>'; print '<td>' . $langs->trans('Product') . '</td>';
...@@ -316,7 +317,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { ...@@ -316,7 +317,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
setEventMessage($prodcustprice->error, 'errors'); setEventMessage($prodcustprice->error, 'errors');
} }
print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '" method="POST">'; print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $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_customer_price_confirm">'; print '<input type="hidden" name="action" value="update_customer_price_confirm">';
print '<input type="hidden" name="lineid" value="' . $prodcustprice->id . '">'; print '<input type="hidden" name="lineid" value="' . $prodcustprice->id . '">';
...@@ -456,7 +457,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { ...@@ -456,7 +457,7 @@ 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"] . '?socid=' . $soc->id . '">' . $langs->trans("Ok") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '">' . $langs->trans("Ok") . '</a></div>';
print "\n</div><br>\n"; print "\n</div><br>\n";
} else { } else {
...@@ -536,15 +537,15 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { ...@@ -536,15 +537,15 @@ 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 align="right">'; print '<td align="right">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=showlog_customer_price&amp;socid=' . $soc->id . '&amp;prodid=' . $line->fk_product . '">'; print '<a 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=' . $soc->id . '&amp;lineid=' . $line->id . '">'; print '<a 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=' . $soc->id . '&amp;lineid=' . $line->id . '">'; print '<a 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>';
...@@ -568,7 +569,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { ...@@ -568,7 +569,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
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) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&amp;socid=' . $soc->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&amp;socid=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
} }
print "\n</div><br>\n"; print "\n</div><br>\n";
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment