diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php
index 24ca9732ed3..05be2893076 100644
--- a/htdocs/partnership/class/partnership.class.php
+++ b/htdocs/partnership/class/partnership.class.php
@@ -632,13 +632,15 @@ class Partnership extends CommonObject
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->error = $this->db->lasterror();
+ $error++;
+ $this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'partnership/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->error = $this->db->lasterror();
+ $error++;
+ $this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
@@ -762,13 +764,15 @@ class Partnership extends CommonObject
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->error = $this->db->lasterror();
+ $error++;
+ $this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'partnership/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->error = $this->db->lasterror();
+ $error++;
+ $this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
@@ -987,7 +991,7 @@ class Partnership extends CommonObject
$label = $langs->trans("ShowPartnership");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
+ $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php
index 8ebc4555362..14608039100 100644
--- a/htdocs/partnership/class/partnershiputils.class.php
+++ b/htdocs/partnership/class/partnershiputils.class.php
@@ -117,7 +117,9 @@ class PartnershipUtils
$obj = $this->db->fetch_object($resql);
if ($obj) {
- if (!empty($partnershipsprocessed[$obj->rowid])) continue;
+ if (!empty($partnershipsprocessed[$obj->rowid])) {
+ continue;
+ }
if ($somethingdoneonpartnership >= $MAXPERCALL) {
dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doCancelStatusOfMemberPartnership to avoid to reach email quota.", LOG_WARNING);
@@ -139,8 +141,11 @@ class PartnershipUtils
$error++;
$this->error = $object->error;
if (is_array($object->errors) && count($object->errors)) {
- if (is_array($this->errors)) $this->errors = array_merge($this->errors, $object->errors);
- else $this->errors = $object->errors;
+ if (is_array($this->errors)) {
+ $this->errors = array_merge($this->errors, $object->errors);
+ } else {
+ $this->errors = $object->errors;
+ }
}
} else {
$partnershipsprocessed[$object->id] = $object->ref;
@@ -158,7 +163,9 @@ class PartnershipUtils
// Define output language
$outputlangs = $langs;
$newlang = '';
- if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
+ if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
+ $newlang = GETPOST('lang_id', 'aZ09');
+ }
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
@@ -191,7 +198,9 @@ class PartnershipUtils
if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
$this->errors[] = $cmail->error;
- if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
+ if (is_array($cmail->errors) && count($cmail->errors) > 0) {
+ $this->errors += $cmail->errors;
+ }
} else {
// Initialisation of datas of object to call trigger
if (is_object($object)) {
@@ -200,7 +209,8 @@ class PartnershipUtils
$object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
- $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...);
+ $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);
+ ; // Short text ($langs->transnoentities('MailSentBy')...);
if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) {
$object->actionmsg2 = $subject; // Short text
}
@@ -240,12 +250,16 @@ class PartnershipUtils
if (!$error) {
$this->db->commit();
$this->output = $numofexpiredmembers.' expired partnership members found'."\n";
- if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail;
+ if ($erroremail) {
+ $this->output .= '. Got errors when sending some email : '.$erroremail;
+ }
} else {
$this->db->rollback();
$this->output = "Rollback after error\n";
$this->output .= $numofexpiredmembers.' expired partnership members found'."\n";
- if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail;
+ if ($erroremail) {
+ $this->output .= '. Got errors when sending some email : '.$erroremail;
+ }
}
return ($error ? 1 : 0);
@@ -374,7 +388,9 @@ class PartnershipUtils
// Define output language
$outputlangs = $langs;
$newlang = '';
- if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
+ if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
+ $newlang = GETPOST('lang_id', 'aZ09');
+ }
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
@@ -402,7 +418,9 @@ class PartnershipUtils
if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
$this->errors[] = $cmail->error;
- if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
+ if (is_array($cmail->errors) && count($cmail->errors) > 0) {
+ $this->errors += $cmail->errors;
+ }
} else {
// Initialisation of datas of object to call trigger
if (is_object($object)) {
@@ -414,7 +432,8 @@ class PartnershipUtils
}
$object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
- $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...);
+ $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);
+ ; // Short text ($langs->transnoentities('MailSentBy')...);
if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) {
$object->actionmsg2 = $subject; // Short text
}
@@ -475,9 +494,15 @@ class PartnershipUtils
$this->output = "Rollback after error\n";
}
$this->output .= $numofexpiredmembers.' partnership checked'."\n";
- if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail."\n";
- if ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
- if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
+ if ($erroremail) {
+ $this->output .= '. Got errors when sending some email : '.$erroremail."\n";
+ }
+ if ($emailnotfound) {
+ $this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
+ }
+ if ($websitenotfound) {
+ $this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
+ }
$this->output .= "\nSQL used to find partnerships to scan: ".$sql;
return ($error ? 1 : 0);
diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php
index c7409aba85e..895f28ab753 100644
--- a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php
+++ b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php
@@ -83,7 +83,8 @@ class mod_partnership_standard extends ModeleNumRefPartnership
{
global $conf, $langs, $db;
- $coyymm = ''; $max = '';
+ $coyymm = '';
+ $max = '';
$posindice = strlen($this->prefix) + 6;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
@@ -99,7 +100,8 @@ class mod_partnership_standard extends ModeleNumRefPartnership
if ($resql) {
$row = $db->fetch_row($resql);
if ($row) {
- $coyymm = substr($row[0], 0, 6); $max = $row[0];
+ $coyymm = substr($row[0], 0, 6);
+ $max = $row[0];
}
}
if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
diff --git a/htdocs/partnership/core/modules/partnership/modules_partnership.php b/htdocs/partnership/core/modules/partnership/modules_partnership.php
index dafab0cc8ed..0f8fde60cfa 100644
--- a/htdocs/partnership/core/modules/partnership/modules_partnership.php
+++ b/htdocs/partnership/core/modules/partnership/modules_partnership.php
@@ -38,7 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
*/
abstract class ModelePDFPartnership extends CommonDocGenerator
{
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php
index 3a2af03c5e1..a48b03f8c46 100644
--- a/htdocs/partnership/partnership_agenda.php
+++ b/htdocs/partnership/partnership_agenda.php
@@ -54,7 +54,7 @@ if (GETPOST('actioncode', 'array')) {
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -93,10 +93,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
-if (empty($conf->partnership->enabled)) accessforbidden();
-if (empty($permissiontoread)) accessforbidden();
-if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
-if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
+if (empty($conf->partnership->enabled)) {
+ accessforbidden();
+}
+if (empty($permissiontoread)) {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
+ accessforbidden();
+}
diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php
index 7bc83306115..2072c9182c9 100644
--- a/htdocs/partnership/partnership_card.php
+++ b/htdocs/partnership/partnership_card.php
@@ -93,8 +93,12 @@ if (!isModEnabled('partnership')) {
if (!$permissiontoread) {
accessforbidden();
}
-if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
-if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
+if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
+ accessforbidden();
+}
/*
@@ -252,7 +256,9 @@ if (empty($reshook)) {
}
}
-if ($object->id > 0 && $object->status == $object::STATUS_REFUSED) $object->fields['reason_decline_or_cancel']['visible'] = 3;
+if ($object->id > 0 && $object->status == $object::STATUS_REFUSED) {
+ $object->fields['reason_decline_or_cancel']['visible'] = 3;
+}
@@ -539,9 +545,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- if (empty($reshook))
+ if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ }
+ if (empty($reshook)) {
$object->formAddObjectLine(1, $mysoc, $soc);
+ }
}
}
diff --git a/htdocs/partnership/partnership_contact.php b/htdocs/partnership/partnership_contact.php
index 415b24c3fdf..410a39dcb0a 100644
--- a/htdocs/partnership/partnership_contact.php
+++ b/htdocs/partnership/partnership_contact.php
@@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("partnership", "companies", "other", "mails"));
-$id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
+$id = (GETPOST('id') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');
$lineid = GETPOST('lineid', 'int');
$socid = GETPOST('socid', 'int');
@@ -59,10 +59,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
-if (empty($conf->partnership->enabled)) accessforbidden();
-if (empty($permissiontoread)) accessforbidden();
-if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
-if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
+if (empty($conf->partnership->enabled)) {
+ accessforbidden();
+}
+if (empty($permissiontoread)) {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
+ accessforbidden();
+}
diff --git a/htdocs/partnership/partnership_document.php b/htdocs/partnership/partnership_document.php
index 481bf2793de..83e226a780b 100644
--- a/htdocs/partnership/partnership_document.php
+++ b/htdocs/partnership/partnership_document.php
@@ -83,10 +83,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
-if (empty($conf->partnership->enabled)) accessforbidden();
-if (empty($permissiontoread)) accessforbidden();
-if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
-if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
+if (empty($conf->partnership->enabled)) {
+ accessforbidden();
+}
+if (empty($permissiontoread)) {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
+ accessforbidden();
+}
@@ -118,7 +126,7 @@ if ($object->id) {
// Build file list
- $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file) {
$totalsize += $file['size'];
diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php
index 250d5adca31..13f6ddc438e 100644
--- a/htdocs/partnership/partnership_list.php
+++ b/htdocs/partnership/partnership_list.php
@@ -90,7 +90,9 @@ $error = 0;
$managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
-if ($managedfor != 'member' && $sortfield == 'd.datefin') $sortfield = '';
+if ($managedfor != 'member' && $sortfield == 'd.datefin') {
+ $sortfield = '';
+}
// Default sort order (if not yet defined by previous GETPOST)
if (!$sortfield) {
@@ -156,10 +158,18 @@ $permissiontodelete = $user->rights->partnership->delete;
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
-if (empty($conf->partnership->enabled)) accessforbidden();
-if (empty($permissiontoread)) accessforbidden();
-if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
-if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
+if (empty($conf->partnership->enabled)) {
+ accessforbidden();
+}
+if (empty($permissiontoread)) {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
+ accessforbidden();
+}
/*
diff --git a/htdocs/partnership/partnership_note.php b/htdocs/partnership/partnership_note.php
index e75e28e273e..dec2b76ccb1 100644
--- a/htdocs/partnership/partnership_note.php
+++ b/htdocs/partnership/partnership_note.php
@@ -66,10 +66,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
-if (empty($conf->partnership->enabled)) accessforbidden();
-if (empty($permissiontoread)) accessforbidden();
-if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
-if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
+if (empty($conf->partnership->enabled)) {
+ accessforbidden();
+}
+if (empty($permissiontoread)) {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
+ accessforbidden();
+}
+if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
+ accessforbidden();
+}
/*
@@ -145,7 +153,7 @@ if ($id > 0 || !empty($ref)) {
}
}
}*/
- $morehtmlref .= '';
+ $morehtmlref .= '';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php
index d07ef173071..d8a5422c6a1 100644
--- a/htdocs/paybox/admin/paybox.php
+++ b/htdocs/paybox/admin/paybox.php
@@ -100,7 +100,7 @@ if ($action == 'setvalue' && $user->admin) {
if (!($result > 0)) {
$error++;
}
- $result = dolibarr_set_const($db, "PAYBOX_HMAC_KEY", dol_encode(GETPOST('PAYBOX_HMAC_KEY', 'alpha')), 'chaine', 0, '', $conf->entity);
+ $result = dolibarr_set_const($db, "PAYBOX_HMAC_KEY", dol_encode(GETPOST('PAYBOX_HMAC_KEY', 'alpha')), 'chaine', 0, '', $conf->entity);
if (!($result > 0)) {
$error++;
}
diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php
index 767a4864981..16d574d71eb 100644
--- a/htdocs/paybox/lib/paybox.lib.php
+++ b/htdocs/paybox/lib/paybox.lib.php
@@ -146,8 +146,8 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG)
"&PBX_OUTPUT=".$IBS_OUTPUT.
"&PBX_SOURCE=".$PBX_SOURCE.
"&PBX_TYPEPAIEMENT=".$PBX_TYPEPAIEMENT;
- "&PBX_HASH=".$PBX_HASH;
- "&PBX_TIME=".$PBX_TIME;
+ "&PBX_HASH=".$PBX_HASH;
+ "&PBX_TIME=".$PBX_TIME;
$binKey = pack("H*", dol_decode($conf->global->PAYBOX_HMAC_KEY));
diff --git a/htdocs/paypal/lib/paypalfunctions.lib.php b/htdocs/paypal/lib/paypalfunctions.lib.php
index dce0b0908b5..0403f2c2735 100644
--- a/htdocs/paypal/lib/paypalfunctions.lib.php
+++ b/htdocs/paypal/lib/paypalfunctions.lib.php
@@ -78,4 +78,4 @@ $PROXY_HOST = $conf->global->MAIN_PROXY_HOST;
$PROXY_PORT = $conf->global->MAIN_PROXY_PORT;
$PROXY_USER = $conf->global->MAIN_PROXY_USER;
$PROXY_PASS = $conf->global->MAIN_PROXY_PASS;
-$USE_PROXY = !getDolGlobalString('MAIN_PROXY_USE') ?false:true;
+$USE_PROXY = !getDolGlobalString('MAIN_PROXY_USE') ? false : true;
diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php
index 7cab3da0d11..de81a0b0aab 100644
--- a/htdocs/product/admin/dynamic_prices.php
+++ b/htdocs/product/admin/dynamic_prices.php
@@ -67,9 +67,9 @@ if ($action == 'edit_updater') {
if (!empty($action) && empty($cancel)) {
//Global variable actions
if ($action == 'create_variable' || $action == 'edit_variable') {
- $price_globals->code = GETPOSTISSET('code') ?GETPOST('code', 'alpha') : $price_globals->code;
- $price_globals->description = GETPOSTISSET('description') ?GETPOST('description', 'restricthtml') : $price_globals->description;
- $price_globals->value = GETPOSTISSET('value') ?GETPOST('value', 'int') : $price_globals->value;
+ $price_globals->code = GETPOSTISSET('code') ? GETPOST('code', 'alpha') : $price_globals->code;
+ $price_globals->description = GETPOSTISSET('description') ? GETPOST('description', 'restricthtml') : $price_globals->description;
+ $price_globals->value = GETPOSTISSET('value') ? GETPOST('value', 'int') : $price_globals->value;
//Check if record already exists only when saving
if (!empty($save)) {
foreach ($price_globals->listGlobalVariables() as $entry) {
diff --git a/htdocs/product/admin/inventory_extrafields.php b/htdocs/product/admin/inventory_extrafields.php
index 74267ee1c8e..45c17e805d0 100644
--- a/htdocs/product/admin/inventory_extrafields.php
+++ b/htdocs/product/admin/inventory_extrafields.php
@@ -29,16 +29,31 @@
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+ $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+ $i--;
+ $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+ $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+ $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
// Try main.inc.php using relative path
-if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
-if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
-if (!$res) die("Include of main fails");
+if (!$res && file_exists("../../main.inc.php")) {
+ $res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+ $res = @include "../../../main.inc.php";
+}
+if (!$res) {
+ die("Include of main fails");
+}
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
@@ -52,13 +67,17 @@ $form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
-foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
+foreach ($tmptype2label as $key => $val) {
+ $type2label[$key] = $langs->transnoentitiesnoconv($val);
+}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'inventory'; //Must be the $table_element of the class that manage extrafield
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
/*
diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php
index ace7a095e95..87fd2ce60ae 100644
--- a/htdocs/product/admin/product.php
+++ b/htdocs/product/admin/product.php
@@ -166,7 +166,9 @@ if ($action == 'specimen') { // For products
$product->initAsSpecimen();
// Search template files
- $file = ''; $classname = ''; $filefound = 0;
+ $file = '';
+ $classname = '';
+ $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/product/doc/pdf_".$modele.".modules.php", 0);
@@ -321,7 +323,7 @@ foreach ($dirproduct as $dirroot) {
dol_syslog($e->getMessage(), LOG_ERR);
}
- $modCodeProduct = new $file;
+ $modCodeProduct = new $file();
// Show modules according to features level
if ($modCodeProduct->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@@ -436,7 +438,7 @@ foreach ($dirmodels as $reldir) {
if ($modulequalified) {
print '
';
- print (empty($module->name) ? $name : $module->name);
+ print(empty($module->name) ? $name : $module->name);
print " \n";
if (method_exists($module, 'info')) {
print $module->info($langs);
diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php
index 8520f471196..4526636d8b1 100644
--- a/htdocs/product/admin/product_lot.php
+++ b/htdocs/product/admin/product_lot.php
@@ -31,8 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
$langs->loadLangs(array("admin", "products", "productbatch"));
// Security check
-if (!$user->admin || (empty($conf->productbatch->enabled)))
+if (!$user->admin || (empty($conf->productbatch->enabled))) {
accessforbidden();
+}
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
@@ -55,7 +56,9 @@ if ($action == 'updateMaskLot') {
if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) {
$res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity);
- if ($res <= 0) $error++;
+ if ($res <= 0) {
+ $error++;
+ }
}
if (!$error) {
@@ -69,7 +72,9 @@ if ($action == 'updateMaskLot') {
if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) {
$res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity);
- if ($res <= 0) $error++;
+ if ($res <= 0) {
+ $error++;
+ }
}
if (!$error) {
@@ -209,8 +214,12 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$module = new $file($db);
// Show modules according to features level
- if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) continue;
- if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) continue;
+ if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
+ continue;
+ }
+ if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
+ continue;
+ }
if ($module->isEnabled()) {
print ' '.$module->name." \n";
@@ -220,9 +229,13 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
// Show example of numbering model
print ' ';
$tmp = $module->getExample();
- if (preg_match('/^Error/', $tmp)) print ''.$langs->trans($tmp).'
';
- elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
- else print $tmp;
+ if (preg_match('/^Error/', $tmp)) {
+ print ''.$langs->trans($tmp).'
';
+ } elseif ($tmp == 'NotConfigured') {
+ print $langs->trans($tmp);
+ } else {
+ print $tmp;
+ }
print ' '."\n";
print '';
@@ -245,8 +258,9 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
- if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
+ if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
$nextval = $langs->trans($nextval);
+ }
$htmltooltip .= $nextval.' ';
} else {
$htmltooltip .= $langs->trans($module->error).' ';
@@ -301,8 +315,12 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$module = new $file($db);
// Show modules according to features level
- if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) continue;
- if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) continue;
+ if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
+ continue;
+ }
+ if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
+ continue;
+ }
if ($module->isEnabled()) {
print ' '.$module->name." \n";
@@ -312,9 +330,13 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
// Show example of numbering model
print ' ';
$tmp = $module->getExample();
- if (preg_match('/^Error/', $tmp)) print ''.$langs->trans($tmp).'
';
- elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
- else print $tmp;
+ if (preg_match('/^Error/', $tmp)) {
+ print ''.$langs->trans($tmp).'
';
+ } elseif ($tmp == 'NotConfigured') {
+ print $langs->trans($tmp);
+ } else {
+ print $tmp;
+ }
print ' '."\n";
print '';
@@ -337,8 +359,9 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
- if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
+ if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
$nextval = $langs->trans($nextval);
+ }
$htmltooltip .= $nextval.' ';
} else {
$htmltooltip .= $langs->trans($module->error).' ';
@@ -428,7 +451,7 @@ foreach ($dirmodels as $reldir) {
if ($modulequalified) {
print ' ';
- print (empty($module->name) ? $name : $module->name);
+ print(empty($module->name) ? $name : $module->name);
print " \n";
if (method_exists($module, 'info')) {
print $module->info($langs);
diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php
index 02e0f52e0fc..3faa9d44643 100644
--- a/htdocs/product/admin/product_tools.php
+++ b/htdocs/product/admin/product_tools.php
@@ -108,7 +108,9 @@ if ($action == 'convert') {
$objectstatic = new Product($db); // Object init must be into loop to avoid to get value of previous step
$ret = $objectstatic->fetch($obj->rowid);
if ($ret > 0) {
- $ret = 0; $retm = 0; $updatelevel1 = false;
+ $ret = 0;
+ $retm = 0;
+ $updatelevel1 = false;
// Update multiprice
$listofmulti = array_reverse($objectstatic->multiprices, true); // To finish with level 1
@@ -209,7 +211,9 @@ if ($action == 'convert') {
$objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step
$ret = $objectstatic2->fetch_product_fournisseur_price($obj->rowid);
if ($ret > 0) {
- $ret = 0; $retm = 0; $updatelevel1 = false;
+ $ret = 0;
+ $retm = 0;
+ $updatelevel1 = false;
$price_base_type = 'HT';
//$price_base_type = $objectstatic2->price_base_type; // Get price_base_type of product/service to keep the same for update
diff --git a/htdocs/product/admin/stock_mouvement_extrafields.php b/htdocs/product/admin/stock_mouvement_extrafields.php
index 33aee41072e..b4c3542331d 100644
--- a/htdocs/product/admin/stock_mouvement_extrafields.php
+++ b/htdocs/product/admin/stock_mouvement_extrafields.php
@@ -29,16 +29,31 @@
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+ $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+ $i--;
+ $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+ $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+ $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
// Try main.inc.php using relative path
-if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
-if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
-if (!$res) die("Include of main fails");
+if (!$res && file_exists("../../main.inc.php")) {
+ $res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+ $res = @include "../../../main.inc.php";
+}
+if (!$res) {
+ die("Include of main fails");
+}
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
@@ -52,13 +67,17 @@ $form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
-foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
+foreach ($tmptype2label as $key => $val) {
+ $type2label[$key] = $langs->transnoentitiesnoconv($val);
+}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'stock_mouvement'; //Must be the $table_element of the class that manage extrafield
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
/*
diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php
index b7b5470a35c..3f1a225b0b1 100644
--- a/htdocs/product/agenda.php
+++ b/htdocs/product/agenda.php
@@ -44,7 +44,7 @@ if (GETPOST('actioncode', 'array')) {
$actioncode = '0';
}
} else {
- $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
+ $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
@@ -56,7 +56,7 @@ if ($user->socid) {
$id = $user->socid;
}
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index dd3bd624543..3a5cf31cc85 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -493,9 +493,9 @@ if (empty($reshook)) {
}
if (empty($ref)) {
if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) {
- setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('ProductRef')), null, 'errors');
- $action = "create";
- $error++;
+ setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('ProductRef')), null, 'errors');
+ $action = "create";
+ $error++;
}
}
if (!empty($duration_value) && empty($duration_unit)) {
@@ -529,7 +529,10 @@ if (empty($reshook)) {
$vatratecode = '';
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
- $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
+ $localtax1 = 0;
+ $localtax2 = 0;
+ $localtax1_type = '0';
+ $localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
$reg = array();
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
@@ -596,8 +599,8 @@ if (empty($reshook)) {
$object->duration_unit = $duration_unit;
$object->fk_default_warehouse = GETPOST('fk_default_warehouse', 'int');
$object->fk_default_workstation = GETPOST('fk_default_workstation', 'int');
- $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte') ?GETPOST('seuil_stock_alerte') : 0;
- $object->desiredstock = GETPOST('desiredstock') ?GETPOST('desiredstock') : 0;
+ $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte') ? GETPOST('seuil_stock_alerte') : 0;
+ $object->desiredstock = GETPOST('desiredstock') ? GETPOST('desiredstock') : 0;
$object->canvas = GETPOST('canvas');
$object->net_measure = GETPOST('net_measure');
$object->net_measure_units = GETPOST('net_measure_units'); // This is not the fk_unit but the power of unit
@@ -1283,7 +1286,7 @@ if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM'))
}
}
if ($res > 0) {
- $modBarCodeProduct = new $module();
+ $modBarCodeProduct = new $module();
}
}
@@ -1460,7 +1463,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
if ($showbarcode) {
print ' '.$langs->trans('BarcodeType').' ';
if (GETPOSTISSET('fk_barcode_type')) {
- $fk_barcode_type = GETPOST('fk_barcode_type')?GETPOST('fk_barcode_type'):0;
+ $fk_barcode_type = GETPOST('fk_barcode_type') ? GETPOST('fk_barcode_type') : 0;
} else {
if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) {
$fk_barcode_type = getDolGlobalInt("PRODUIT_DEFAULT_BARCODE_TYPE");
@@ -1528,11 +1531,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
}
if ($type == $object::TYPE_SERVICE && isModEnabled("workstation")) {
- // Default workstation
- print ' '.$langs->trans("DefaultWorkstation").' ';
- print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"');
- print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1);
- print ' ';
+ // Default workstation
+ print ''.$langs->trans("DefaultWorkstation").' ';
+ print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"');
+ print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1);
+ print ' ';
}
// Duration
@@ -1568,7 +1571,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print ''.$langs->trans("Weight").' ';
print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"');
print ' ';
- print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
+ print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
print ' ';
}
@@ -1579,21 +1582,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print ' x ';
print ' x ';
print ' ';
- print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ?GETPOST('size_units', 'alpha') : '0', 0, 2);
+ print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units', 'alpha') : '0', 0, 2);
print '';
}
if (!getDolGlobalString('PRODUCT_DISABLE_SURFACE')) {
// Brut Surface
print ''.$langs->trans("Surface").' ';
print ' ';
- print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ?GETPOST('surface_units', 'alpha') : '0', 0, 2);
+ print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units', 'alpha') : '0', 0, 2);
print ' ';
}
if (!getDolGlobalString('PRODUCT_DISABLE_VOLUME')) {
// Brut Volume
print ''.$langs->trans("Volume").' ';
print ' ';
- print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ?GETPOST('volume_units', 'alpha') : '0', 0, 2);
+ print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units', 'alpha') : '0', 0, 2);
print ' ';
}
@@ -1601,7 +1604,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
// Net Measure
print ''.$langs->trans("NetMeasure").' ';
print ' ';
- print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ?GETPOST('net_measure_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0);
+ print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0);
print ' ';
}
}
@@ -1660,13 +1663,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
// Note (private, no output on invoices, propales...)
//if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) available in create mode
//{
- print ''.$langs->trans("NoteNotVisibleOnBill").' ';
+ print ' '.$langs->trans("NoteNotVisibleOnBill").' ';
- // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
- $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%');
- $doleditor->Create();
+ // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
+ $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%');
+ $doleditor->Create();
- print " ";
+ print "";
//}
if (isModEnabled('categorie')) {
@@ -2622,7 +2625,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
$warehouse->fetch($object->fk_default_warehouse);
print ''.$langs->trans("DefaultWarehouse").' ';
- print (!empty($warehouse->id) ? $warehouse->getNomUrl(1) : '');
+ print(!empty($warehouse->id) ? $warehouse->getNomUrl(1) : '');
print ' ';
}
@@ -2631,7 +2634,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
$res = $workstation->fetch($object->fk_default_workstation);
print ''.$langs->trans("DefaultWorkstation").' ';
- print (!empty($workstation->id) ? $workstation->getNomUrl(1) : '');
+ print(!empty($workstation->id) ? $workstation->getNomUrl(1) : '');
print ' ';
}
@@ -2666,7 +2669,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
} elseif ($object->duration_value > 0) {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
}
- print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : '');
+ print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : '');
// Mandatory period
if ($object->duration_value > 0) {
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index 79f54094138..b6ec2cb629f 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -319,7 +319,7 @@ class FormProduct
}
$out .= 'code_auto)) {
$this->ref = $modCodeProduct->getNextValue($this, $this->type);
}
@@ -1289,7 +1289,7 @@ class Product extends CommonObject
$sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1);
$sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL');
$sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL');
- $sql .= ", mandatory_period = ".($this->mandatory_period );
+ $sql .= ", mandatory_period = ".($this->mandatory_period);
// stock field is not here because it is a denormalized value from product_stock.
$sql .= " WHERE rowid = ".((int) $id);
@@ -1860,7 +1860,6 @@ class Product extends CommonObject
*/
private function getArrayForPriceCompare($level = 0)
{
-
$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
foreach ($testExit as $field) {
@@ -4392,7 +4391,7 @@ class Product extends CommonObject
return -1;
}
}
- // End call triggers
+ // End call triggers
return 1;
}
@@ -5090,7 +5089,7 @@ class Product extends CommonObject
$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
$sql.= " ORDER BY pa.rang";
- dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG);
+ dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
if ($level == 1) {
$alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly
@@ -5323,7 +5322,7 @@ class Product extends CommonObject
$label = $langs->trans("ShowProduct");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"';
}
- $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1, 1).'"' : ' title="tocomplete"');
+ $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="nowraponall '.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"';
@@ -5500,7 +5499,7 @@ class Product extends CommonObject
$labelStatus = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatch') : $langs->transnoentitiesnoconv('ProductStatusOnSerial'));
$labelStatusShort = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatchShort') : $langs->transnoentitiesnoconv('ProductStatusOnSerialShort'));
}
- } elseif ( $type == 2 && $status == 2 ) {
+ } elseif ($type == 2 && $status == 2) {
$labelStatus = $langs->transnoentitiesnoconv('ProductStatusOnSerial');
$labelStatusShort = $langs->transnoentitiesnoconv('ProductStatusOnSerialShort');
}
@@ -5711,7 +5710,7 @@ class Product extends CommonObject
$sql .= " AND w.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")";
}
- $sql .= " ORDER BY ps.reel ".(getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE')?'DESC':'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation;
+ $sql .= " ORDER BY ps.reel ".(getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE') ? 'DESC' : 'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation;
dol_syslog(get_class($this)."::load_stock", LOG_DEBUG);
$result = $this->db->query($sql);
@@ -6194,7 +6193,7 @@ class Product extends CommonObject
}
}
$var = $conf->global->BARCODE_PRODUCT_ADDON_NUM;
- $mod = new $var;
+ $mod = new $var();
$result = $mod->getNextValue($object, $type);
@@ -6515,7 +6514,7 @@ class Product extends CommonObject
}
- /**
+ /**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
@@ -6533,8 +6532,8 @@ class Product extends CommonObject
$return .= '';
$label = '';
if ($this->is_photo_available($conf->product->multidir_output[$this->entity])) {
- $label .= $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 120, 160, 0, 0, 0, '', 'photoref photokanban');
- $return .= $label;
+ $label .= $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 120, 160, 0, 0, 0, '', 'photoref photokanban');
+ $return .= $label;
} else {
if ($this->type == Product::TYPE_PRODUCT) {
$label .= img_picto('', 'product');
diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php
index 6fa4076bf73..7374673fa02 100644
--- a/htdocs/product/class/productbatch.class.php
+++ b/htdocs/product/class/productbatch.class.php
@@ -120,7 +120,8 @@ class Productbatch extends CommonObject
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
$this->id = $this->db->last_insert_id($this->db->prefix().self::$_table_element);
@@ -222,7 +223,8 @@ class Productbatch extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback
@@ -259,7 +261,8 @@ class Productbatch extends CommonObject
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
}
@@ -459,7 +462,9 @@ class Productbatch extends CommonObject
$sql .= " t.eatby as oldeatby,"; // deprecated but may not be migrated into new table
$sql .= " t.batch,";
$sql .= " t.qty,";
- if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) $sql .= " MAX(sm.datem) as date_entree,";
+ if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) {
+ $sql .= " MAX(sm.datem) as date_entree,";
+ }
$sql .= " t.import_key";
if ($fk_product > 0) {
$sql .= ", pl.rowid as lotid, pl.eatby as eatby, pl.sellby as sellby";
@@ -490,9 +495,11 @@ class Productbatch extends CommonObject
if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) {
$sql .= 'date_entree ASC,t.batch ASC,';
}
- if ($fk_product > 0) { $sql .= "pl.eatby ASC, pl.sellby ASC, "; }
+ if ($fk_product > 0) {
+ $sql .= "pl.eatby ASC, pl.sellby ASC, ";
+ }
$sql .= "t.eatby ASC, t.sellby ASC ";
- $sql .= ", t.qty ".(!getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE')?'ASC':'DESC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation
+ $sql .= ", t.qty ".(!getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE') ? 'ASC' : 'DESC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation
$sql .= ", t.batch ASC";
dol_syslog("productbatch::findAll", LOG_DEBUG);
diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php
index 456b7cc03b6..392ba0b3aa6 100644
--- a/htdocs/product/class/productcustomerprice.class.php
+++ b/htdocs/product/class/productcustomerprice.class.php
@@ -122,7 +122,6 @@ class ProductCustomerPrice extends CommonObject
*/
public function create($user, $notrigger = 0, $forceupdateaffiliate = 0)
{
-
global $conf, $langs;
$error = 0;
@@ -174,8 +173,8 @@ class ProductCustomerPrice extends CommonObject
$this->import_key = trim($this->import_key);
}
- // Check parameters
- // Put here code to add control on parameters values
+ // Check parameters
+ // Put here code to add control on parameters values
if ($this->price != '' || $this->price == 0) {
if ($this->price_base_type == 'TTC') {
@@ -601,7 +600,6 @@ class ProductCustomerPrice extends CommonObject
*/
public function update($user = 0, $notrigger = 0, $forceupdateaffiliate = 0)
{
-
global $conf, $langs;
$error = 0;
@@ -653,8 +651,8 @@ class ProductCustomerPrice extends CommonObject
$this->import_key = trim($this->import_key);
}
- // Check parameters
- // Put here code to add a control on parameters values
+ // Check parameters
+ // Put here code to add a control on parameters values
if ($this->price != '' || $this->price == 0) {
if ($this->price_base_type == 'TTC') {
@@ -1007,7 +1005,6 @@ class ProductCustomerPrice extends CommonObject
*/
public function initAsSpecimen()
{
-
$this->id = 0;
$this->entity = '';
diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php
index 903e6b25a89..29a242b0238 100644
--- a/htdocs/product/class/productfournisseurprice.class.php
+++ b/htdocs/product/class/productfournisseurprice.class.php
@@ -177,8 +177,12 @@ class ProductFournisseurPrice extends CommonObject
$this->db = $db;
- if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
- if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
+ if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
+ $this->fields['rowid']['visible'] = 0;
+ }
+ if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
+ $this->fields['entity']['enabled'] = 0;
+ }
// Unset fields that are disabled
foreach ($this->fields as $key => $val) {
@@ -220,7 +224,9 @@ class ProductFournisseurPrice extends CommonObject
// Load source object
$result = $object->fetchCommon($fromid);
- if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
+ if ($result > 0 && !empty($object->table_element_line)) {
+ $object->fetchLines();
+ }
// get lines so they will be clone
//foreach($this->lines as $line)
@@ -232,11 +238,21 @@ class ProductFournisseurPrice extends CommonObject
unset($object->import_key);
// Clear fields
- if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
- if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
- if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; }
- if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); }
- if (property_exists($object, 'date_modification')) { $object->date_modification = null; }
+ if (property_exists($object, 'ref')) {
+ $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
+ }
+ if (property_exists($object, 'label')) {
+ $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
+ }
+ if (property_exists($object, 'status')) {
+ $object->status = self::STATUS_DRAFT;
+ }
+ if (property_exists($object, 'date_creation')) {
+ $object->date_creation = dol_now();
+ }
+ if (property_exists($object, 'date_modification')) {
+ $object->date_modification = null;
+ }
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0) {
@@ -270,8 +286,9 @@ class ProductFournisseurPrice extends CommonObject
if (!$error) {
// copy external contacts if same company
if (property_exists($this, 'socid') && $this->socid == $object->socid) {
- if ($this->copy_linked_contact($object, 'external') < 0)
+ if ($this->copy_linked_contact($object, 'external') < 0) {
$error++;
+ }
}
}
@@ -320,8 +337,11 @@ class ProductFournisseurPrice extends CommonObject
$sql = "SELECT ";
$sql .= $this->getFieldList();
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
- if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($this->element).")";
- else $sql .= " WHERE 1 = 1";
+ if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
+ $sql .= " WHERE t.entity IN (".getEntity($this->element).")";
+ } else {
+ $sql .= " WHERE 1 = 1";
+ }
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@@ -437,8 +457,12 @@ class ProductFournisseurPrice extends CommonObject
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
$sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " status = ".self::STATUS_VALIDATED;
- if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."'";
- if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".$user->id;
+ if (!empty($this->fields['date_validation'])) {
+ $sql .= ", date_validation = '".$this->db->idate($now)."'";
+ }
+ if (!empty($this->fields['fk_user_valid'])) {
+ $sql .= ", fk_user_valid = ".$user->id;
+ }
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
@@ -452,7 +476,9 @@ class ProductFournisseurPrice extends CommonObject
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('PRODUCTFOURNISSEURPRICE_VALIDATE', $user);
- if ($result < 0) $error++;
+ if ($result < 0) {
+ $error++;
+ }
// End call triggers
}
}
@@ -467,13 +493,15 @@ class ProductFournisseurPrice extends CommonObject
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'productfournisseurprice/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->error = $this->db->lasterror();
+ $error++;
+ $this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'productfournisseurprice/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'productfournisseurprice/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->error = $this->db->lasterror();
+ $error++;
+ $this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
@@ -581,7 +609,9 @@ class ProductFournisseurPrice extends CommonObject
{
global $conf, $langs, $hookmanager;
- if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
+ if (!empty($conf->dol_no_mouse_hover)) {
+ $notooltip = 1;
+ } // Force disable tooltips
$result = '';
@@ -613,7 +643,9 @@ class ProductFournisseurPrice extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
- } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
+ } else {
+ $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
+ }
$linkstart = '
';
@@ -622,7 +654,9 @@ class ProductFournisseurPrice extends CommonObject
$result .= $linkstart;
if (empty($this->showphoto_on_popup)) {
- if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ if ($withpicto) {
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ }
} else {
if ($withpicto) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -648,7 +682,9 @@ class ProductFournisseurPrice extends CommonObject
}
}
- if ($withpicto != 2) $result .= $this->ref;
+ if ($withpicto != 2) {
+ $result .= $this->ref;
+ }
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
@@ -657,8 +693,11 @@ class ProductFournisseurPrice extends CommonObject
$hookmanager->initHooks(array('productfournisseurpricedao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $result = $hookmanager->resPrint;
- else $result .= $hookmanager->resPrint;
+ if ($reshook > 0) {
+ $result = $hookmanager->resPrint;
+ } else {
+ $result .= $hookmanager->resPrint;
+ }
return $result;
}
@@ -698,7 +737,9 @@ class ProductFournisseurPrice extends CommonObject
$statusType = 'status'.$status;
//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
- if ($status == self::STATUS_CANCELED) $statusType = 'status6';
+ if ($status == self::STATUS_CANCELED) {
+ $statusType = 'status6';
+ }
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php
index bdec6261e84..00774a4f54e 100644
--- a/htdocs/product/class/propalmergepdfproduct.class.php
+++ b/htdocs/product/class/propalmergepdfproduct.class.php
@@ -128,7 +128,8 @@ class Propalmergepdfproduct extends CommonObject
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
@@ -324,7 +325,8 @@ class Propalmergepdfproduct extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback
@@ -363,7 +365,8 @@ class Propalmergepdfproduct extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
}
@@ -410,7 +413,8 @@ class Propalmergepdfproduct extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
}
@@ -450,7 +454,8 @@ class Propalmergepdfproduct extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
}
diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php
index f01cf8678d6..f2878b035ab 100644
--- a/htdocs/product/composition/card.php
+++ b/htdocs/product/composition/card.php
@@ -399,8 +399,8 @@ if ($id > 0 || !empty($ref)) {
$totalsell = 0;
$total = 0;
- if (count($prods_arbo)) {
- foreach ($prods_arbo as $value) {
+ if (count($prods_arbo)) {
+ foreach ($prods_arbo as $value) {
$productstatic->fetch($value['id']);
if ($value['level'] <= 1) {
@@ -425,7 +425,9 @@ if ($id > 0 || !empty($ref)) {
if ($product_fourn->product_fourn_price_id > 0) {
print $product_fourn->display_price_product_fournisseur(0, 0);
} else {
- print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++;
+ print $langs->trans("NotDefined");
+ $notdefined++;
+ $atleastonenotdefined++;
}
}
print '';
@@ -440,7 +442,7 @@ if ($id > 0 || !empty($ref)) {
$total += $totalline;
print ' ';
- print ($notdefined ? '' : ($value['nb'] > 1 ? $value['nb'].'x ' : '').''.price($unitline, '', '', 0, 0, -1, $conf->currency)).' ';
+ print($notdefined ? '' : ($value['nb'] > 1 ? $value['nb'].'x ' : '').''.price($unitline, '', '', 0, 0, -1, $conf->currency)).' ';
print ' ';
// Best selling price
@@ -452,7 +454,7 @@ if ($id > 0 || !empty($ref)) {
$totalsell += $totallinesell;
}
print '
';
- print ($notdefined ? '' : ($value['nb'] > 1 ? $value['nb'].'x ' : ''));
+ print($notdefined ? '' : ($value['nb'] > 1 ? $value['nb'].'x ' : ''));
if (is_numeric($pricesell)) {
print ''.price($pricesell, '', '', 0, 0, -1, $conf->currency).' ';
} else {
@@ -551,7 +553,7 @@ if ($id > 0 || !empty($ref)) {
if ($atleastonenotdefined) {
print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
}
- print ($atleastonenotdefined ? '' : price($total, '', '', 0, 0, -1, $conf->currency));
+ print($atleastonenotdefined ? '' : price($total, '', '', 0, 0, -1, $conf->currency));
print ' ';
// Minimum selling price
@@ -563,7 +565,7 @@ if ($id > 0 || !empty($ref)) {
if ($atleastonenotdefined) {
print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
}
- print ($atleastonenotdefined ? '' : price($totalsell, '', '', 0, 0, -1, $conf->currency));
+ print($atleastonenotdefined ? '' : price($totalsell, '', '', 0, 0, -1, $conf->currency));
print '';
// Stock
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index 9e46a04d0d0..cfdc91efad4 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -226,10 +226,10 @@ if ($object->id) {
}
// Build file list
- $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { // For backward compatiblity, we scan also old dirs
- $filearrayold = dol_dir_list($upload_dirold, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $filearrayold = dol_dir_list($upload_dirold, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
$filearray = array_merge($filearray, $filearrayold);
}
diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php
index 6ad38e4f217..8c237b0d1bd 100644
--- a/htdocs/product/dynamic_price/class/price_expression.class.php
+++ b/htdocs/product/dynamic_price/class/price_expression.class.php
@@ -100,7 +100,8 @@ class PriceExpression
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
@@ -153,7 +154,7 @@ class PriceExpression
return 0;
}
} else {
- $this->error = "Error ".$this->db->lasterror();
+ $this->error = "Error ".$this->db->lasterror();
return -1;
}
}
@@ -217,7 +218,7 @@ class PriceExpression
return 0;
}
} else {
- $this->error = "Error ".$this->db->lasterror();
+ $this->error = "Error ".$this->db->lasterror();
return -1;
}
}
@@ -253,7 +254,8 @@ class PriceExpression
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback
@@ -271,13 +273,13 @@ class PriceExpression
}
- /**
- * Delete object in database
- *
- * @param User $user User that deletes
- * @param int $notrigger 0=launch triggers after, 1=disable triggers
- * @return int Return integer <0 if KO, >0 if OK
- */
+ /**
+ * Delete object in database
+ *
+ * @param User $user User that deletes
+ * @param int $notrigger 0=launch triggers after, 1=disable triggers
+ * @return int Return integer <0 if KO, >0 if OK
+ */
public function delete(User $user, $notrigger = 0)
{
$error = 0;
@@ -293,7 +295,8 @@ class PriceExpression
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
}
diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php
index 30c59d063ff..d6575223866 100644
--- a/htdocs/product/dynamic_price/class/price_global_variable.class.php
+++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php
@@ -101,7 +101,8 @@ class PriceGlobalVariable
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
@@ -190,7 +191,8 @@ class PriceGlobalVariable
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
// if (! $error)
@@ -255,7 +257,8 @@ class PriceGlobalVariable
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
}
diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php
index 458a202614a..d3fc23e7357 100644
--- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php
+++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php
@@ -117,7 +117,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
@@ -214,7 +215,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
// if (! $error)
@@ -263,13 +265,13 @@ class PriceGlobalVariableUpdater
//{
// if (! $notrigger)
// {
- // Uncomment this and change MYOBJECT to your own tag if you
- // want this action calls a trigger.
+ // Uncomment this and change MYOBJECT to your own tag if you
+ // want this action calls a trigger.
- //// Call triggers
- //$result=$this->call_trigger('MYOBJECT_DELETE',$user);
- //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
- //// End call triggers
+ //// Call triggers
+ //$result=$this->call_trigger('MYOBJECT_DELETE',$user);
+ //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
+ //// End call triggers
// }
//}
@@ -280,7 +282,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
}
@@ -577,7 +580,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback
@@ -621,7 +625,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
- $error++; $this->errors[] = "Error ".$this->db->lasterror();
+ $error++;
+ $this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback
diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php
index b76c1f084ec..e53193481f2 100644
--- a/htdocs/product/dynamic_price/class/price_parser.class.php
+++ b/htdocs/product/dynamic_price/class/price_parser.class.php
@@ -108,8 +108,7 @@ class PriceParser
return $langs->trans("ErrorPriceExpression".$code, $info[0], $info[1]);
} elseif (in_array($code, array(7, 12, 13, 15, 16, 18))) { //Internal errors
return $langs->trans("ErrorPriceExpressionInternal", $code);
- } else //Unknown errors
- {
+ } else { //Unknown errors
return $langs->trans("ErrorPriceExpressionUnknown", $code);
}
}
@@ -270,8 +269,8 @@ class PriceParser
$supplier_min_price = 0;
$supplier_min_price_with_discount = 0;
} else {
- $supplier_min_price = $productFournisseur->fourn_unitprice;
- $supplier_min_price_with_discount = $productFournisseur->fourn_unitprice_with_discount;
+ $supplier_min_price = $productFournisseur->fourn_unitprice;
+ $supplier_min_price_with_discount = $productFournisseur->fourn_unitprice_with_discount;
}
//Accessible values by expressions
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index b1a0ba2aeee..6d33f7bf6d9 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -53,7 +53,7 @@ $ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'pricesuppliercard';
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'pricesuppliercard';
$socid = GETPOST('socid', 'int');
$cost_price = price2num(GETPOST('cost_price', 'alpha'), '', 2);
@@ -81,10 +81,10 @@ if (!$user->hasRight('fournisseur', 'lire') && (!isModEnabled('margin') && !$use
accessforbidden();
}
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
-$page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0);
+$page = (GETPOST("page", 'int') ? GETPOST("page", 'int') : 0);
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
@@ -640,7 +640,7 @@ if ($id > 0 || $ref) {
$default_vat = $object->tva_tx;
}
}
- $vattosuggest = (GETPOSTISSET("tva_tx") ? vatrate(GETPOST("tva_tx")) : ($default_vat != '' ?vatrate($default_vat) : ''));
+ $vattosuggest = (GETPOSTISSET("tva_tx") ? vatrate(GETPOST("tva_tx")) : ($default_vat != '' ? vatrate($default_vat) : ''));
$vattosuggest = preg_replace('/\s*\(.*\)$/', '', $vattosuggest);
print '
';
print '
';
@@ -697,7 +697,7 @@ if ($id > 0 || $ref) {
$pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ? GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : ''));
print ' ';
print ' ';
- print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ?GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices
+ print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ? GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices
print ' ';
// Price qty min
@@ -786,7 +786,7 @@ END;
// Discount qty min
print ''.$langs->trans("DiscountQtyMin").' ';
- print ' %';
+ print ' %';
print ' ';
print ' ';
@@ -1103,7 +1103,7 @@ END;
}
if (is_object($hookmanager)) {
- $parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id, 'nbfields'=>$nbfields);
+ $parameters = array('id_fourn'=>(!empty($id_fourn) ? $id_fourn : ''), 'prod_id'=>$object->id, 'nbfields'=>$nbfields);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
@@ -1286,7 +1286,7 @@ END;
}
if (is_object($hookmanager)) {
- $parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
+ $parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn) ? $id_fourn : ''), 'prod_id'=>$object->id);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action);
}
diff --git a/htdocs/product/index.php b/htdocs/product/index.php
index 2d1553c198e..5de07fc509c 100644
--- a/htdocs/product/index.php
+++ b/htdocs/product/index.php
@@ -341,9 +341,9 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
$product_static->status_buy = $objp->tobuy;
$product_static->status_batch = $objp->tobatch;
- $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'read');
+ $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'read');
if ($product_static->isService()) {
- $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'read');
+ $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'read');
}
// Multilangs
diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index 63c1f537df5..6760d4c2841 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/card.php
@@ -38,7 +38,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$include_sub_warehouse = !empty(GETPOST('include_sub_warehouse')) ? GETPOST('include_sub_warehouse') : 0;
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 9a85b3f3dc4..99e01a02e48 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -40,10 +40,10 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$listoffset = GETPOST('listoffset', 'alpha');
-$limit = GETPOST('limit', 'int') > 0 ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') > 0 ? GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
@@ -197,7 +197,9 @@ if (empty($reshook)) {
//$inventorycode = 'INV'.$object->id;
$inventorycode = 'INV-'.$object->ref;
$price = 0;
- if (!empty($line->pmp_real) && getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) $price = $line->pmp_real;
+ if (!empty($line->pmp_real) && getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) {
+ $price = $line->pmp_real;
+ }
$idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch);
if ($idstockmove < 0) {
@@ -825,7 +827,7 @@ if ($action == 'updatebyscaning') {
result=false;
tabproduct.forEach(product => {
$.ajax({ url: \''.DOL_URL_ROOT.'/product/inventory/ajax/searchfrombarcode.php\',
- data: { "token":"'.newToken().'", "action":"existbarcode", '.(!empty($object->fk_warehouse)?'"fk_entrepot":'.$object->fk_warehouse.', ':'').(!empty($object->fk_product)?'"fk_product":'.$object->fk_product.', ':'').'"barcode":element, "product":product, "mode":mode},
+ data: { "token":"'.newToken().'", "action":"existbarcode", '.(!empty($object->fk_warehouse) ? '"fk_entrepot":'.$object->fk_warehouse.', ' : '').(!empty($object->fk_product) ? '"fk_product":'.$object->fk_product.', ' : '').'"barcode":element, "product":product, "mode":mode},
type: \'POST\',
async: false,
success: function(response) {
@@ -1083,8 +1085,11 @@ if ($resql) {
if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) {
//PMP Expected
- if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
- else $pmp_expected = $product_static->pmp;
+ if (!empty($obj->pmp_expected)) {
+ $pmp_expected = $obj->pmp_expected;
+ } else {
+ $pmp_expected = $product_static->pmp;
+ }
$pmp_valuation = $pmp_expected * $valuetoshow;
print '';
print price($pmp_expected);
@@ -1105,8 +1110,11 @@ if ($resql) {
print ' ';
- if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
- else $pmp_real = $product_static->pmp;
+ if (!empty($obj->pmp_real)) {
+ $pmp_real = $obj->pmp_real;
+ } else {
+ $pmp_real = $product_static->pmp;
+ }
$pmp_valuation_real = $pmp_real * $qty_view;
print ' ';
print ' ';
@@ -1134,8 +1142,11 @@ if ($resql) {
} else {
if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) {
//PMP Expected
- if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
- else $pmp_expected = $product_static->pmp;
+ if (!empty($obj->pmp_expected)) {
+ $pmp_expected = $obj->pmp_expected;
+ } else {
+ $pmp_expected = $product_static->pmp;
+ }
$pmp_valuation = $pmp_expected * $valuetoshow;
print '';
print price($pmp_expected);
@@ -1150,8 +1161,11 @@ if ($resql) {
//PMP Real
print ' ';
- if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
- else $pmp_real = $product_static->pmp;
+ if (!empty($obj->pmp_real)) {
+ $pmp_real = $obj->pmp_real;
+ } else {
+ $pmp_real = $product_static->pmp;
+ }
$pmp_valuation_real = $pmp_real * $obj->qty_view;
print price($pmp_real);
print ' ';
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index aae765cfeb0..6ee9885c76e 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -34,7 +34,7 @@ if (isModEnabled('categorie')) {
// Load translation files required by the page
$langs->loadLangs(array("stocks", "other"));
-$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
+$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
@@ -48,7 +48,7 @@ $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hier
$id = GETPOST('id', 'int');
// Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index f2d90aff492..d31602a2552 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -70,7 +70,7 @@ $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
// Search Criterias
-$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
+$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_id = GETPOST("search_id", 'alpha');
$search_ref = GETPOST("search_ref", 'alpha');
$search_ref_supplier = GETPOST("search_ref_supplier", 'alpha');
@@ -117,7 +117,7 @@ if (isModEnabled('variants')) {
$diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id;
// Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -136,14 +136,16 @@ if (!$sortorder) {
}
// Initialize context for list
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'productservicelist';
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'productservicelist';
if ((string) $type == '1') {
- $contextpage = 'servicelist'; if ($search_type == '') {
+ $contextpage = 'servicelist';
+ if ($search_type == '') {
$search_type = '1';
}
}
if ((string) $type == '0') {
- $contextpage = 'productlist'; if ($search_type == '') {
+ $contextpage = 'productlist';
+ if ($search_type == '') {
$search_type = '0';
}
}
@@ -1557,9 +1559,9 @@ while ($i < $imaxinloop) {
$object = $product_static;
- $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire');
+ $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'lire');
if ($product_static->isService()) {
- $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire');
+ $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'lire');
}
if ($mode == 'kanban') {
@@ -1705,7 +1707,7 @@ while ($i < $imaxinloop) {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
}
print $duration_value;
- print ((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : '');
+ print((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : '');
} elseif (!preg_match('/^[a-z]$/i', $obj->duration)) { // If duration is a simple char (like 's' of 'm'), we do not show value
print $obj->duration;
}
@@ -2053,9 +2055,13 @@ while ($i < $imaxinloop) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
if ($usercancreadprice) {
- if ($product_static->stock_reel < 0) { print ''; }
+ if ($product_static->stock_reel < 0) {
+ print '';
+ }
print price(price2num($product_static->stock_reel, 'MS'), 0, $langs, 1, 0);
- if ($product_static->stock_reel < 0) { print ' '; }
+ if ($product_static->stock_reel < 0) {
+ print ' ';
+ }
}
}
print '';
@@ -2071,9 +2077,13 @@ while ($i < $imaxinloop) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
if ($usercancreadprice) {
- if ($product_static->stock_theorique < 0) { print ''; }
+ if ($product_static->stock_theorique < 0) {
+ print '';
+ }
print price(price2num($product_static->stock_theorique, 'MS'), 0, $langs, 1, 0);
- if ($product_static->stock_theorique < 0) { print ' '; }
+ if ($product_static->stock_theorique < 0) {
+ print ' ';
+ }
}
}
print '';
diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php
index 8c8271738ba..0c54b88c7d0 100644
--- a/htdocs/product/popuprop.php
+++ b/htdocs/product/popuprop.php
@@ -44,7 +44,7 @@ if (!empty($user->socid)) {
$socid = $user->socid;
}
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index f1d3e7efefb..030fe94a3c0 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -134,7 +134,10 @@ if (empty($reshook)) {
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
- $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
+ $localtax1 = 0;
+ $localtax2 = 0;
+ $localtax1_type = '0';
+ $localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
@@ -389,7 +392,10 @@ if (empty($reshook)) {
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
- $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
+ $localtax1 = 0;
+ $localtax2 = 0;
+ $localtax1_type = '0';
+ $localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
// We look into database using code
@@ -643,7 +649,10 @@ if (empty($reshook)) {
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
- $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
+ $localtax1 = 0;
+ $localtax2 = 0;
+ $localtax1_type = '0';
+ $localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
// We look into database using code
@@ -763,7 +772,10 @@ if (empty($reshook)) {
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
- $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
+ $localtax1 = 0;
+ $localtax2 = 0;
+ $localtax1_type = '0';
+ $localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
// We look into database using code
@@ -1520,8 +1532,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) {
print '';
} else {
- print ''."\n";
- ?>
+ print ''."\n"; ?>