php codesniffer
This commit is contained in:
parent
720746b1b2
commit
d242f4930d
File diff suppressed because it is too large
Load Diff
@ -24,7 +24,6 @@
|
|||||||
* \ingroup product
|
* \ingroup product
|
||||||
* \brief Page to show product prices by customer
|
* \brief Page to show product prices by customer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
@ -45,15 +44,16 @@ $action = GETPOST('action', 'alpha');
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id)
|
||||||
|
$socid = $user->societe_id;
|
||||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||||
|
|
||||||
|
/**
|
||||||
/*****************************************************
|
* ***************************************************
|
||||||
* Price by customer
|
* Price by customer
|
||||||
*****************************************************/
|
* ****************************************************
|
||||||
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');
|
||||||
|
|
||||||
@ -68,8 +68,7 @@ if ($action == 'add_customer_price_confirm' && ! $_POST["cancel"] && ($user->rig
|
|||||||
|
|
||||||
$result = $prodcustprice->create($user, 0, $update_child_soc);
|
$result = $prodcustprice->create($user, 0, $update_child_soc);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
setEventMessage($prodcustprice->error, 'errors');
|
setEventMessage($prodcustprice->error, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('Save'), 'mesgs');
|
setEventMessage($langs->trans('Save'), 'mesgs');
|
||||||
@ -78,14 +77,12 @@ if ($action == 'add_customer_price_confirm' && ! $_POST["cancel"] && ($user->rig
|
|||||||
$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
|
||||||
$prodcustprice->id = GETPOST('lineid');
|
$prodcustprice->id = GETPOST('lineid');
|
||||||
$result = $prodcustprice->delete($user);
|
$result = $prodcustprice->delete($user);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
setEventMessage($prodcustprice->error, 'mesgs');
|
setEventMessage($prodcustprice->error, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('Delete'), 'errors');
|
setEventMessage($langs->trans('Delete'), 'errors');
|
||||||
@ -93,8 +90,7 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $use
|
|||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update_customer_price_confirm' && ! $_POST["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||||
{
|
|
||||||
|
|
||||||
$prodcustprice->fetch(GETPOST('lineid', 'int'));
|
$prodcustprice->fetch(GETPOST('lineid', 'int'));
|
||||||
|
|
||||||
@ -108,19 +104,15 @@ if ($action == 'update_customer_price_confirm' && ! $_POST["cancel"] && ($user->
|
|||||||
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
|
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
|
||||||
|
|
||||||
$result = $prodcustprice->update($user, 0, $update_child_soc);
|
$result = $prodcustprice->update($user, 0, $update_child_soc);
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
setEventMessage($prodcustprice->error, 'errors');
|
setEventMessage($prodcustprice->error, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('Save'), 'mesgs');
|
setEventMessage($langs->trans('Save'), 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -129,11 +121,11 @@ $form = new Form($db);
|
|||||||
|
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
|
|
||||||
|
|
||||||
$result = $soc->fetch($socid);
|
$result = $soc->fetch($socid);
|
||||||
llxHeader("", $langs->trans("ThirdParty") . '-' . $langs->trans('PriceByCustomer'));
|
llxHeader("", $langs->trans("ThirdParty") . '-' . $langs->trans('PriceByCustomer'));
|
||||||
|
|
||||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
if (! empty($conf->notification->enabled))
|
||||||
|
$langs->load("mails");
|
||||||
$head = societe_prepare_head($soc);
|
$head = societe_prepare_head($soc);
|
||||||
|
|
||||||
dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company');
|
dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company');
|
||||||
@ -149,26 +141,25 @@ 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">' . $soc->prefix_comm . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($soc->client)
|
if ($soc->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 $soc->code_client;
|
||||||
if ($soc->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
if ($soc->check_codeclient() != 0)
|
||||||
|
print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($soc->fournisseur)
|
if ($soc->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 $soc->code_fournisseur;
|
||||||
if ($soc->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
if ($soc->check_codefournisseur() != 0)
|
||||||
|
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">' . $soc->barcode . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,9 +198,6 @@ print '</table>';
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||||
|
|
||||||
$prodcustprice = new Productcustomerprice($db);
|
$prodcustprice = new Productcustomerprice($db);
|
||||||
@ -385,10 +373,8 @@ if (! empty ( $conf->global->PRODUIT_CUSTOMER_PRICES )) {
|
|||||||
print '<br></form>';
|
print '<br></form>';
|
||||||
} elseif ($action == 'showlog_customer_price') {
|
} elseif ($action == 'showlog_customer_price') {
|
||||||
|
|
||||||
|
|
||||||
$filter = array (
|
$filter = array (
|
||||||
't.fk_product' => GETPOST('prodid','int'),
|
't.fk_product' => GETPOST('prodid', 'int'),'t.fk_soc' => $socid
|
||||||
't.fk_soc'=> $socid
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
@ -450,21 +436,15 @@ if (! empty ( $conf->global->PRODUIT_CUSTOMER_PRICES )) {
|
|||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print $userstatic->getLoginUrl(1);
|
print $userstatic->getLoginUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
} else {
|
} else {
|
||||||
print $langs->trans('None');
|
print $langs->trans('None');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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=' . $soc->id . '">' . $langs->trans("Ok") . '</a></div>';
|
||||||
print "\n</div><br>\n";
|
print "\n</div><br>\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// View mode
|
// View mode
|
||||||
@ -539,7 +519,6 @@ if (! empty ( $conf->global->PRODUIT_CUSTOMER_PRICES )) {
|
|||||||
print $userstatic->getLoginUrl(1);
|
print $userstatic->getLoginUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|
||||||
// Todo Edit or delete button
|
// Todo Edit or delete button
|
||||||
// Action
|
// Action
|
||||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||||
@ -580,7 +559,6 @@ if (! empty ( $conf->global->PRODUIT_CUSTOMER_PRICES )) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user