diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 5bdb99330f6..350713ca17e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1286,7 +1286,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // EMail - print ''.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').''; + print ''.(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? '' : '').$langs->trans("EMail").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? '' : '').''; print ''.img_picto('', 'object_email', 'class="pictofixedwidth"').'email).'">'; // Website diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index ee1d10181ca..cd664f5970e 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -856,7 +856,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!empty($value['icon'])) { print ''; } - print ''; + print ''; print ''; print ''; } elseif (!empty($object->socialnetworks[$key])) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b91fb4a243c..f600f1a5fcb 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7734,7 +7734,7 @@ class Form $val = preg_replace('/t\./', '', $val); $label .= (($label && $obj->$val) ? ($oldvalueforshowoncombobox != $objecttmp->fields[$val]['showoncombobox'] ? ' - ' : ' ') : ''); $label .= $obj->$val; - $oldvalueforshowoncombobox = $objecttmp->fields[$val]['showoncombobox']; + $oldvalueforshowoncombobox = !empty($objecttmp->fields[$val]['showoncombobox']) ? $objecttmp->fields[$val]['showoncombobox'] : 0; } if (empty($outputmode)) { if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 40d451653e7..ec8a6dd4951 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -192,7 +192,7 @@ if ($id > 0 || $ref) { if (get_class($objproduct) == 'Product') { $out .= '&prodid='.$objproduct->id.'&origin=product&originid='.$id; } - $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage=1&percentage=-1'; + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage='.$_SERVER["PHP_SELF"].'?id='.$object->id.'&percentage=-1'; //$out.=$langs->trans("AddAnAction").' '; //$out.=img_picto($langs->trans("AddAnAction"),'filenew'); //$out.=""; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index eb292e8c7f0..6040e116fa5 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1650,9 +1650,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ProductAccountancySellCode").''; print ''; if ($type == 0) { - $accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT); + $accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_SOLD_ACCOUNT")); } else { - $accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT); + $accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_ACCOUNT")); } print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); print ''; @@ -1662,9 +1662,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ProductAccountancySellIntraCode").''; print ''; if ($type == 0) { - $accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT); + $accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT")); } else { - $accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT); + $accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT")); } print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); print ''; @@ -1674,9 +1674,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ProductAccountancySellExportCode").''; print ''; if ($type == 0) { - $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT); + $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT")); } else { - $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT); + $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT")); } print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); print ''; @@ -1685,9 +1685,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ProductAccountancyBuyCode").''; print ''; if ($type == 0) { - $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT); + $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : getDolGlobalString("ACCOUNTING_PRODUCT_BUY_ACCOUNT")); } else { - $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT); + $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : getDolGlobalString("ACCOUNTING_SERVICE_BUY_ACCOUNT")); } print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); print ''; @@ -1697,9 +1697,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ProductAccountancyBuyIntraCode").''; print ''; if ($type == 0) { - $accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT); + $accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT")); } else { - $accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT); + $accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT")); } print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); print ''; @@ -1709,9 +1709,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ProductAccountancyBuyExportCode").''; print ''; if ($type == 0) { - $accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT); + $accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT")); } else { - $accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT); + $accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT")); } print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); print ''; diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index a6bb38adfe2..ec96bba20d6 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -74,6 +74,9 @@ if ($object->id > 0) { } else { restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); } +$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire)); +$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)); +$usercandelete = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer)); /* diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 8a8f3793b8f..41a4705bdd6 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -764,7 +764,7 @@ END; // Reputation print ''.$langs->trans("ReferenceReputation").''; - echo $form->selectarray('supplier_reputation', $object->reputations, $supplier_reputation ? $supplier_reputation : $object->supplier_reputation); + echo $form->selectarray('supplier_reputation', $object->reputations, !empty($supplier_reputation) ? $supplier_reputation : $object->supplier_reputation); print ''; // Barcode @@ -775,7 +775,7 @@ END; print ''; print ''.$langs->trans('BarcodeType').''; print ''; - print $formbarcode->selectBarcodeType(($rowid ? $object->supplier_fk_barcode_type : $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE), 'fk_barcode_type', 1); + print $formbarcode->selectBarcodeType(($rowid ? $object->supplier_fk_barcode_type : getDolGlobalint("PRODUIT_DEFAULT_BARCODE_TYPE")), 'fk_barcode_type', 1); print ''; print ''; @@ -787,7 +787,7 @@ END; } // Option to define a transport cost on supplier price - if ($conf->global->PRODUCT_CHARGES) { + if (!empty($conf->global->PRODUCT_CHARGES)) { if (!empty($conf->margin->enabled)) { print ''; print ''.$langs->trans("Charges").''; @@ -815,7 +815,7 @@ END; // Extrafields $extrafields->fetch_name_optionals_label("product_fournisseur_price"); - $extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; + $extralabels = !empty($extrafields->attributes["product_fournisseur_price"]['label']) ? $extrafields->attributes["product_fournisseur_price"]['label'] : ''; $extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price"); if (!empty($extralabels)) { if (empty($rowid)) { @@ -868,7 +868,7 @@ END; } if (is_object($hookmanager)) { - $parameters = array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id); + $parameters = array('id_fourn'=>!empty($id_fourn) ? $id_fourn : 0, 'prod_id'=>$object->id); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); print $hookmanager->resPrint; } diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 471418b2bd9..b8118ba4884 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -143,6 +143,9 @@ if ($type !== '') { } $sql .= " GROUP BY p.rowid, p.label, p.ref, p.fk_product_type"; +$num = 0; +$totalnboflines = 0; + if (!empty($mode) && $mode != '-1') { $result = $db->query($sql); if ($result) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index ab3086bfd0b..3abc01e9346 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1753,7 +1753,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul if (empty($positiverates)) { $positiverates = '0'; } - echo vatrate($positiverates.($objp->default_vat_code ? ' ('.$objp->default_vat_code.')' : ''), '%', $objp->tva_npr); + echo vatrate($positiverates.($objp->default_vat_code ? ' ('.$objp->default_vat_code.')' : ''), '%', !empty($objp->tva_npr) ? $objp->tva_npr : 0); /* if ($objp->default_vat_code) { diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 21a23fce277..8d9188f1965 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -46,6 +46,7 @@ $mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'byunit'); $search_year = GETPOST('search_year', 'int'); $search_categ = GETPOST('search_categ', 'int'); $notab = GETPOST('notab', 'int'); +$type = GETPOST('type', 'alpha'); $error = 0; $mesg = ''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 3d16b6bac7c..88d5b0f0c3b 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -986,6 +986,7 @@ if (!$variants) { $num = 0; $total = 0; $totalvalue = $totalvaluesell = 0; + $totalwithpmp = 0; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a620bd02d39..154a376cca7 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -909,7 +909,7 @@ if (empty($reshook)) { // Actions to build doc $id = $socid; - $upload_dir = $conf->societe->multidir_output[$object->entity]; + $upload_dir = !empty($conf->societe->multidir_output[$object->entity])?$conf->societe->multidir_output[$object->entity]:$conf->societe->dir_output; $permissiontoadd = $user->rights->societe->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 2284a496c0f..9e1d791a626 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -52,6 +52,9 @@ $toselect = GETPOST('toselect', 'array'); $cancel = GETPOST('cancel', 'alpha'); $delete_product = GETPOST('delete_product', 'alpha'); $subaction = GETPOST('subaction', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); // Security check $fieldvalue = (!empty($id) ? $id : $ref); @@ -66,7 +69,7 @@ if ($id > 0 || $ref) { $object->fetch($id, $ref); } -$selectedvariant = $_SESSION['addvariant_'.$object->id]; +$selectedvariant = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : 0; // Security check if (empty($conf->variants->enabled)) { @@ -86,6 +89,9 @@ if ($object->id > 0) { } else { restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); } +$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire)); +$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)); +$usercandelete = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer)); /*