diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 59d74783d04..6bd39f4e227 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -297,11 +297,11 @@ class BookKeeping extends CommonObject
$sql .= " AND fk_doc = ".((int) $this->fk_doc);
if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) {
// DO NOT USE THIS IN PRODUCTION. This will generate a lot of trouble into reports and will corrupt database (by generating duplicate entries.
- $sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines
+ $sql .= " AND fk_docdet = ".$this->fk_docdet; // This field can be 0 if record is for several lines
}
$sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'";
$sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'";
- $sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
+ $sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
$resql = $this->db->query($sql);
@@ -318,7 +318,7 @@ class BookKeeping extends CommonObject
$sqlnum .= " AND fk_docdet = ".((int) $this->fk_docdet);
}
$sqlnum .= " AND doc_ref = '".$this->db->escape($this->doc_ref)."'"; // ref of source object
- $sqlnum .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
+ $sqlnum .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
dol_syslog(get_class($this).":: create sqlnum=".$sqlnum, LOG_DEBUG);
$resqlnum = $this->db->query($sqlnum);
@@ -331,7 +331,7 @@ class BookKeeping extends CommonObject
if (empty($this->piece_num)) {
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
- $sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features
+ $sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features
$resqlnum = $this->db->query($sqlnum);
if ($resqlnum) {
@@ -1067,7 +1067,7 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
- $line->montant = $obj->amount; // deprecated
+ $line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php
index de597a608dc..6a23beab86b 100644
--- a/htdocs/compta/cashcontrol/report.php
+++ b/htdocs/compta/cashcontrol/report.php
@@ -126,7 +126,7 @@ $sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id =
$sql .= " AND f.module_source = '".$db->escape($posmodule)."'";
$sql .= " AND f.pos_source = '".$db->escape($terminalid)."'";
$sql .= " AND f.paye = 1";
-$sql .= " AND p.entity = ".$conf->entity; // Never share entities for features related to accountancy
+$sql .= " AND p.entity = ".$conf->entity; // Never share entities for features related to accountancy
/*if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'";
elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'";
elseif ($key == 'card') $sql.=" AND cp.code = 'CB'";
@@ -222,7 +222,7 @@ if ($resql) {
$invoicetmp->fetch($objp->facid);
if (empty($cacheinvoiceid[$objp->facid])) {
- $cacheinvoiceid[$objp->facid] = $objp->facid; // First time this invoice is found into list of invoice x payments
+ $cacheinvoiceid[$objp->facid] = $objp->facid; // First time this invoice is found into list of invoice x payments
foreach ($invoicetmp->lines as $line) {
$totalqty += $line->qty;
$totalvat += $line->total_tva;
@@ -348,21 +348,21 @@ if ($resql) {
print '
';
print '
';
- print $langs->trans("Cash").' '.($transactionspertype['CASH']?'('.$transactionspertype['CASH'].')':'').': '.price($cash).'';
+ print $langs->trans("Cash").' '.($transactionspertype['CASH'] ? '('.$transactionspertype['CASH'].')' : '').': '.price($cash).'';
if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) {
print ' <> '.$langs->trans("Declared").': '.price($object->cash).'';
}
print " ";
//print ' ';
- print $langs->trans("PaymentTypeCHQ").' '.($transactionspertype['CHQ']?'('.$transactionspertype['CHQ'].')':'').': '.price($cheque).'';
+ print $langs->trans("PaymentTypeCHQ").' '.($transactionspertype['CHQ'] ? '('.$transactionspertype['CHQ'].')' : '').': '.price($cheque).'';
if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) {
print ' <> '.$langs->trans("Declared").': '.price($object->cheque).'';
}
print " ";
//print ' ';
- print $langs->trans("PaymentTypeCB").' '.($transactionspertype['CB']?'('.$transactionspertype['CB'].')':'').': '.price($bank).'';
+ print $langs->trans("PaymentTypeCB").' '.($transactionspertype['CB'] ? '('.$transactionspertype['CB'].')' : '').': '.price($bank).'';
if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) {
print ' <> '.$langs->trans("Declared").': '.price($object->card).'';
}
@@ -370,7 +370,7 @@ if ($resql) {
// print ' ';
if ($other) {
- print ''.$langs->trans("Other").' '.($transactionspertype['OTHER']?'('.$transactionspertype['OTHER'].')':'').': '.price($other)."";
+ print ''.$langs->trans("Other").' '.($transactionspertype['OTHER'] ? '('.$transactionspertype['OTHER'].')' : '').': '.price($other)."";
print ' ';
}
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 1ee946e8a00..940cd146f7b 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -522,7 +522,7 @@ class Facture extends CommonInvoice
$this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_project;
$this->note_public = GETPOST('note_public', 'none') ? GETPOST('note_public', 'restricthtml') : $_facrec->note_public;
$this->note_private = GETPOST('note_private', 'none') ? GETPOST('note_private', 'restricthtml') : $_facrec->note_private;
- $this->model_pdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->model_pdf;
+ $this->model_pdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->model_pdf;
$this->cond_reglement_id = GETPOST('cond_reglement_id', 'int') > 0 ? ((int) GETPOST('cond_reglement_id', 'int')) : $_facrec->cond_reglement_id;
$this->mode_reglement_id = GETPOST('mode_reglement_id', 'int') > 0 ? ((int) GETPOST('mode_reglement_id', 'int')) : $_facrec->mode_reglement_id;
$this->fk_account = GETPOST('fk_account') > 0 ? ((int) GETPOST('fk_account')) : $_facrec->fk_account;
@@ -1180,8 +1180,8 @@ class Facture extends CommonInvoice
// Clear fields
$object->date = (empty($this->date) ? dol_now() : $this->date);
- $object->user_author = $user->id; // deprecated
- $object->user_valid = null; // deprecated
+ $object->user_author = $user->id; // deprecated
+ $object->user_valid = null; // deprecated
$object->fk_user_author = $user->id;
$object->fk_user_valid = null;
$object->fk_facture_source = 0;
@@ -1227,7 +1227,7 @@ class Facture extends CommonInvoice
}
}
- $object->lines[$i]->ref_ext = ''; // Do not clone ref_ext
+ $object->lines[$i]->ref_ext = ''; // Do not clone ref_ext
}
// Create clone
@@ -1672,9 +1672,9 @@ class Facture extends CommonInvoice
$this->note = $obj->note_private; // deprecated
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
- $this->user_author = $obj->fk_user_author; // deprecated
- $this->user_valid = $obj->fk_user_valid; // deprecated
- $this->fk_user_author = $obj->fk_user_author;
+ $this->user_author = $obj->fk_user_author; // deprecated
+ $this->user_valid = $obj->fk_user_valid; // deprecated
+ $this->fk_user_author = $obj->fk_user_author;
$this->fk_user_valid = $obj->fk_user_valid;
$this->model_pdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf; // deprecated
@@ -3430,7 +3430,7 @@ class Facture extends CommonInvoice
$qty = price2num($qty);
$pu = price2num($pu);
$pu_ht_devise = price2num($pu_ht_devise);
- $pa_ht = price2num($pa_ht);
+ $pa_ht = price2num($pa_ht);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
@@ -4158,7 +4158,7 @@ class Facture extends CommonInvoice
if (!empty($conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE)) {
// Keep invoices that are not situation invoices or that are the last in serie if it is a situation invoice
$sql .= " AND (f.type <> ".self::TYPE_SITUATION." OR f.rowid IN ";
- $sql .= '(SELECT MAX(fs.rowid)'; // This select returns several ID becasue of the group by later
+ $sql .= '(SELECT MAX(fs.rowid)'; // This select returns several ID becasue of the group by later
$sql .= " FROM ".MAIN_DB_PREFIX."facture as fs";
$sql .= " WHERE fs.entity IN (".getEntity('invoice').")";
$sql .= " AND fs.type = ".self::TYPE_SITUATION;
@@ -4166,7 +4166,7 @@ class Facture extends CommonInvoice
if ($socid > 0) {
$sql .= " AND fs.fk_soc = ".((int) $socid);
}
- $sql .= " GROUP BY fs.situation_cycle_ref)"; // For each situation_cycle_ref, we take the higher rowid
+ $sql .= " GROUP BY fs.situation_cycle_ref)"; // For each situation_cycle_ref, we take the higher rowid
$sql .= ")";
} else {
$sql .= " AND f.type <> ".self::TYPE_SITUATION; // Keep invoices that are not situation invoices
@@ -5594,7 +5594,7 @@ class FactureLigne extends CommonInvoiceLine
$sql .= ", total_localtax2=".price2num($this->total_localtax2);
}
$sql .= ", fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null");
- $sql .= ", buy_price_ht=".(($this->pa_ht || $this->pa_ht === 0 || $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option)
+ $sql .= ", buy_price_ht=".(($this->pa_ht || $this->pa_ht === 0 || $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option)
$sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
if (!empty($this->rang)) {
$sql .= ", rang=".((int) $this->rang);
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index d185815b51a..dea4f9d185d 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -225,7 +225,7 @@ if (empty($reshook)) {
$action = 'create';
}
- if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && $object->no_email==-1 && !empty($object->email)) {
+ if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1 && $object->no_email == -1 && !empty($object->email)) {
$error++;
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
$action = 'create';
@@ -256,7 +256,7 @@ if (empty($reshook)) {
if (empty($error)) {
// Categories association
$contcats = GETPOST('contcats', 'array');
- if (count($contcats)>0) {
+ if (count($contcats) > 0) {
$result = $object->setCategories($contcats);
if ($result <= 0) {
$error++;
@@ -268,8 +268,8 @@ if (empty($reshook)) {
if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) {
// Add mass emailing flag into table mailing_unsubscribe
- $result=$object->setNoEmail($object->no_email);
- if ($result<0) {
+ $result = $object->setNoEmail($object->no_email);
+ if ($result < 0) {
$error++;
$errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors));
$action = 'create';
@@ -297,7 +297,7 @@ if (empty($reshook)) {
$object->old_lastname = (string) GETPOST("old_lastname", 'alpha');
$object->old_firstname = (string) GETPOST("old_firstname", 'alpha');
- $result = $object->delete(); // TODO Add $user as first param
+ $result = $object->delete(); // TODO Add $user as first param
if ($result > 0) {
if ($backtopage) {
header("Location: ".$backtopage);
@@ -317,7 +317,7 @@ if (empty($reshook)) {
$action = 'edit';
}
- if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && GETPOST("no_email", "int")==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
+ if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
$error++;
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
$action = 'edit';
@@ -417,7 +417,7 @@ if (empty($reshook)) {
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
- $object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
+ $object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
@@ -436,8 +436,8 @@ if (empty($reshook)) {
// Update mass emailing flag into table mailing_unsubscribe
if (GETPOSTISSET('no_email') && $object->email) {
$no_email = GETPOST('no_email', 'int');
- $result=$object->setNoEmail($no_email);
- if ($result<0) {
+ $result = $object->setNoEmail($no_email);
+ if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
}
@@ -779,7 +779,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Unsubscribe
if (!empty($conf->mailing->enabled)) {
- if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1) {
+ if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1) {
print "\n".''."\n";
}
if (!GETPOSTISSET("no_email") && !empty($object->email)) {
- $result=$object->getNoEmail();
- if ($result<0) {
+ $result = $object->getNoEmail();
+ if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
print '
'."\n";
$needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
- if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
+ if (preg_match('/\$object/', $val)) {
+ $needToFetchEachLine++;
+ }
+ // There is at least one compute field that use $object
}
}
@@ -424,7 +505,10 @@ $total = 0;
$totalarray = array();
while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql);
- if (empty($obj)) break; // Should not happen
+ if (empty($obj)) {
+ break;
+ }
+ // Should not happen
// Store properties in $object
$object->setVarsFromFetchObj($obj);
@@ -449,22 +533,32 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Ref
print "
".$paymentsalstatic->getNomUrl(1)."
\n";
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
print "
".$salstatic->getNomUrl(1)."
\n";
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
// Label payment
print "
".dol_trunc($obj->label, 40)."
\n";
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
// Date end period
print '
';
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
// Amount
print '
'.price($obj->amount).'
';
- if (!$i) $totalarray['nbfield']++;
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
+ }
$totalarray['val']['totalttcfield'] += $obj->amount;
// Extra fields
@@ -535,11 +645,15 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print '
';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
- if (in_array($object->id, $arrayofselected)) $selected = 1;
+ if (in_array($object->id, $arrayofselected)) {
+ $selected = 1;
+ }
print '';
}
print '
';
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
print ''."\n";
@@ -553,7 +667,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
- foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
+ foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) {
+ $colspan++;
+ }
+ }
print '
'.$langs->trans("NoRecordFound").'
';
}
diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php
index 912307a5675..9cb065d2c3b 100644
--- a/htdocs/societe/partnership.php
+++ b/htdocs/societe/partnership.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","partnership", "other"));
+$langs->loadLangs(array("companies", "partnership", "other"));
// Get parameters
$id = GETPOST('id', 'int');
@@ -82,19 +82,27 @@ foreach ($object->fields as $key => $val) {
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
-$permissiontoread = $user->rights->partnership->read;
-$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+$permissiontoread = $user->rights->partnership->read;
+$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
-$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php
+$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php
-$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
-$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
+$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
-if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') accessforbidden();
-if (empty($conf->partnership->enabled)) accessforbidden();
-if (empty($permissiontoread)) accessforbidden();
-if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
+if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') {
+ accessforbidden();
+}
+if (empty($conf->partnership->enabled)) {
+ accessforbidden();
+}
+if (empty($permissiontoread)) {
+ accessforbidden();
+}
+if ($action == 'edit' && empty($permissiontoadd)) {
+ accessforbidden();
+}
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) {
accessforbidden();
@@ -128,7 +136,9 @@ if (empty($reshook)) {
}
$object->fields['fk_soc']['visible'] = 0;
-if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1;
+if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) {
+ $object->fields['reason_decline_or_cancel']['visible'] = 1;
+}
$object->fields['note_public']['visible'] = 1;