Fix warnings

This commit is contained in:
Laurent Destailleur 2022-12-28 13:27:13 +01:00
parent 3f4b0549cb
commit 6824f82cc8
40 changed files with 228 additions and 220 deletions

View File

@ -254,18 +254,18 @@ class Bookmark extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'bookmark' 'bookmark'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -1962,18 +1962,18 @@ class Categorie extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'categorie_societe' 'categorie_societe'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables, 1);
} }
/** /**

View File

@ -2261,18 +2261,18 @@ class ActionComm extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'actioncomm' 'actioncomm'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -3860,18 +3860,18 @@ class Propal extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'propal' 'propal'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -4043,18 +4043,18 @@ class Commande extends CommonOrder
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'commande' 'commande'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -1771,35 +1771,35 @@ class FactureRec extends CommonInvoice
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'facture_rec' 'facture_rec'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**
* Function used to replace a product id with another one. * Function used to replace a product id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old product id * @param int $origin_id Old product id
* @param int $dest_id New product id * @param int $dest_id New product id
* @return bool * @return bool
*/ */
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'facturedet_rec' 'facturedet_rec'
); );
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceProduct($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -5190,18 +5190,18 @@ class Facture extends CommonInvoice
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old third-party id * @param int $origin_id Old thirdparty id
* @param int $dest_id New third-party id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'facture' 'facture'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -167,17 +167,17 @@ class LignePrelevement
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'prelevement_lignes' 'prelevement_lignes'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
} }

View File

@ -1712,18 +1712,18 @@ class Contact extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'socpeople', 'societe_contacts' 'socpeople', 'societe_contacts'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -2474,18 +2474,18 @@ class Contrat extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'contrat' 'contrat'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -8431,19 +8431,19 @@ abstract class CommonObject
* This function is meant to be called from replaceThirdparty with the appropriate tables * This function is meant to be called from replaceThirdparty with the appropriate tables
* Column name fk_soc MUST be used to identify thirdparties * Column name fk_soc MUST be used to identify thirdparties
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param int $origin_id Old thirdparty id (the thirdparty to delete) * @param int $origin_id Old thirdparty id (the thirdparty to delete)
* @param int $dest_id New thirdparty id (the thirdparty that will received element of the other) * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other)
* @param string[] $tables Tables that need to be changed * @param string[] $tables Tables that need to be changed
* @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one)
* @return bool True if success, False if error * @return bool True if success, False if error
*/ */
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors = 0) public static function commonReplaceThirdparty(DoliDB $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors = 0)
{ {
foreach ($tables as $table) { foreach ($tables as $table) {
$sql = 'UPDATE '.$db->prefix().$table.' SET fk_soc = '.((int) $dest_id).' WHERE fk_soc = '.((int) $origin_id); $sql = 'UPDATE '.$dbs->prefix().$table.' SET fk_soc = '.((int) $dest_id).' WHERE fk_soc = '.((int) $origin_id);
if (!$db->query($sql)) { if (!$dbs->query($sql)) {
if ($ignoreerrors) { if ($ignoreerrors) {
return true; // TODO Not enough. If there is A-B on kept thirdparty and B-C on old one, we must get A-B-C after merge. Not A-B. return true; // TODO Not enough. If there is A-B on kept thirdparty and B-C on old one, we must get A-B-C after merge. Not A-B.
} }
@ -8460,19 +8460,19 @@ abstract class CommonObject
* This function is meant to be called from replaceProduct with the appropriate tables * This function is meant to be called from replaceProduct with the appropriate tables
* Column name fk_product MUST be used to identify products * Column name fk_product MUST be used to identify products
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param int $origin_id Old product id (the product to delete) * @param int $origin_id Old product id (the product to delete)
* @param int $dest_id New product id (the product that will received element of the other) * @param int $dest_id New product id (the product that will received element of the other)
* @param string[] $tables Tables that need to be changed * @param string[] $tables Tables that need to be changed
* @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old product may already exists on new one) * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old product may already exists on new one)
* @return bool True if success, False if error * @return bool True if success, False if error
*/ */
public static function commonReplaceProduct(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors = 0) public static function commonReplaceProduct(DoliDB $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors = 0)
{ {
foreach ($tables as $table) { foreach ($tables as $table) {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_product = '.((int) $dest_id).' WHERE fk_product = '.((int) $origin_id); $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_product = '.((int) $dest_id).' WHERE fk_product = '.((int) $origin_id);
if (!$db->query($sql)) { if (!$dbs->query($sql)) {
if ($ignoreerrors) { if ($ignoreerrors) {
return true; // TODO Not enough. If there is A-B on kept product and B-C on old one, we must get A-B-C after merge. Not A-B. return true; // TODO Not enough. If there is A-B on kept product and B-C on old one, we must get A-B-C after merge. Not A-B.
} }

View File

@ -41,7 +41,7 @@ class DolGraph
{ {
public $type = array(); // Array with type of each series. Example: array('bars', 'horizontalbars', 'lines', 'pies', 'piesemicircle', 'polar'...) public $type = array(); // Array with type of each series. Example: array('bars', 'horizontalbars', 'lines', 'pies', 'piesemicircle', 'polar'...)
public $mode = 'side'; // Mode bars graph: side, depth public $mode = 'side'; // Mode bars graph: side, depth
private $_library = 'chart'; // Graphic library to use (jflot, chart, artichow) private $_library; // Graphic library to use (jflot, chart, artichow)
//! Array of data //! Array of data
public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...)

View File

@ -1483,7 +1483,7 @@ class Form
} }
if (!empty($conf->global->SOCIETE_SHOW_VAT_IN_LIST) && !empty($obj->tva_intra)) { if (!empty($conf->global->SOCIETE_SHOW_VAT_IN_LIST) && !empty($obj->tva_intra)) {
$label .= ' - '.$obj->tva_intra.''; $label .= ' - '.$obj->tva_intra;
} }
$labelhtml = $label; $labelhtml = $label;

View File

@ -347,7 +347,7 @@ class FormTicket
print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title; print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title;
} else { } else {
if (isset($this->withreadid) && $this->withreadid > 0) { if (isset($this->withreadid) && $this->withreadid > 0) {
$subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.''; $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title;
} else { } else {
$subject = GETPOST('subject', 'alpha'); $subject = GETPOST('subject', 'alpha');
} }

View File

@ -99,8 +99,6 @@ class mailing_contacts1 extends MailingTargets
*/ */
public function getNbOfRecipients($sql = '') public function getNbOfRecipients($sql = '')
{ {
global $conf;
$sql = "SELECT count(distinct(c.email)) as nb"; $sql = "SELECT count(distinct(c.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";

View File

@ -130,7 +130,7 @@ class pdf_beluga extends ModelePDFProjects
* Page orientation * Page orientation
* @var string 'P' or 'Portait' (default), 'L' or 'Landscape' * @var string 'P' or 'Portait' (default), 'L' or 'Landscape'
*/ */
private $orientation = ''; private $orientation;
/** /**
* Issuer * Issuer

View File

@ -1085,18 +1085,18 @@ class Delivery extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'delivery' 'delivery'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -1101,18 +1101,18 @@ class Don extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old third-party id * @param int $origin_id Old thirdparty id
* @param int $dest_id New third-party id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'don' 'don'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -1102,18 +1102,18 @@ class ConferenceOrBoothAttendee extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'eventorganization_conferenceorboothattendee' 'eventorganization_conferenceorboothattendee'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
} }

View File

@ -2450,18 +2450,18 @@ class Expedition extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'expedition' 'expedition'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
} }

View File

@ -761,7 +761,7 @@ if ($action == 'create') {
if ($user->rights->ficheinter->creer) { if ($user->rights->ficheinter->creer) {
print '<div class="inline-block divButAction">'; print '<div class="inline-block divButAction">';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=createfrommodel&token='.newToken().''; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=createfrommodel&token='.newToken();
print '&socid='.$object->thirdparty->id.'&id='.$object->id.'">'; print '&socid='.$object->thirdparty->id.'&id='.$object->id.'">';
print $langs->trans("AddIntervention").'</a></div>'; print $langs->trans("AddIntervention").'</a></div>';
} }

View File

@ -1383,18 +1383,18 @@ class Fichinter extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'fichinter' 'fichinter'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -683,16 +683,16 @@ class FichinterRec extends Fichinter
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array('fichinter_rec'); $tables = array('fichinter_rec');
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -209,17 +209,17 @@ class Fournisseur extends Societe
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old third-party id * @param int $origin_id Old thirdparty id
* @param int $dest_id New third-party id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'facture_fourn' 'facture_fourn'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
} }

View File

@ -3265,18 +3265,18 @@ class CommandeFournisseur extends CommonOrder
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'commande_fournisseur' 'commande_fournisseur'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -1737,18 +1737,18 @@ class FactureFournisseurRec extends CommonInvoice
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'facture_rec' 'facture_rec'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -3154,18 +3154,18 @@ class FactureFournisseur extends CommonInvoice
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'facture_fourn' 'facture_fourn'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -1003,35 +1003,35 @@ class ProductFournisseur extends Product
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'product_fournisseur_price' 'product_fournisseur_price'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**
* Function used to replace a product id with another one. * Function used to replace a product id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old product id * @param int $origin_id Old thirdparty id
* @param int $dest_id New product id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'product_fournisseur_price' 'product_fournisseur_price'
); );
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceProduct($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -683,12 +683,12 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
if ($board->nbtodolate > 0) { if ($board->nbtodolate > 0) {
$boxwork .= '<div class="dashboardlinelatecoin nowrap">'; $boxwork .= '<div class="dashboardlinelatecoin nowrap">';
$boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">'; $boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">';
//$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').''; //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"');
$boxwork .= img_picto( $boxwork .= img_picto(
$textlate, $textlate,
"warning_white", "warning_white",
'class="inline-block hideonsmartphone valigntextbottom"' 'class="inline-block hideonsmartphone valigntextbottom"'
).''; );
$boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">'; $boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">';
$boxwork .= $board->nbtodolate; $boxwork .= $board->nbtodolate;
$boxwork .= '</span>'; $boxwork .= '</span>';

View File

@ -15,59 +15,59 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/** @var bool Hide PHP informations */ /** @var boolean $force_install_nophpinfo Hide PHP informations */
$force_install_nophpinfo = true; $force_install_nophpinfo = true;
/** @var int 1 = Lock and hide environment variables, 2 = Lock all set variables */ /** @var int $force_install_noedit 1 = Lock and hide environment variables, 2 = Lock all set variables */
$force_install_noedit = 2; $force_install_noedit = 2;
/** @var string Information message */ /** @var string $force_install_message Information message */
$force_install_message = 'Welcome to your Dolibarr install'; $force_install_message = 'Welcome to your Dolibarr install';
/** @var string Data root absolute path (documents folder) */ /** @var string $force_install_main_data_root Data root absolute path (documents folder) */
$force_install_main_data_root = null; $force_install_main_data_root = null;
/** @var bool Force HTTPS */ /** @var boolean $force_install_mainforcehttps Force HTTPS */
$force_install_mainforcehttps = true; $force_install_mainforcehttps = true;
/** @var string Database name */ /** @var string $force_install_database Database name */
$force_install_database = 'dolibarr'; $force_install_database = 'dolibarr';
/** @var string Database driver (mysql|mysqli|pgsql|mssql|sqlite|sqlite3) */ /** @var string $force_install_type Database driver (mysql|mysqli|pgsql|mssql|sqlite|sqlite3) */
$force_install_type = 'mysqli'; $force_install_type = 'mysqli';
/** @var string Database server host */ /** @var string $force_install_dbserver Database server host */
$force_install_dbserver = 'localhost'; $force_install_dbserver = 'localhost';
/** @var int Database server port */ /** @var int $force_install_port Database server port */
$force_install_port = 3306; $force_install_port = 3306;
/** @var string Database tables prefix */ /** @var string $force_install_prefix Database tables prefix */
$force_install_prefix = 'llx_'; $force_install_prefix = 'llx_';
/** @var bool Force database creation */ /** @var bool $force_install_createdatabase Force database creation */
$force_install_createdatabase = true; $force_install_createdatabase = true;
/** @var string Database username */ /** @var string $force_install_databaselogin Database username */
$force_install_databaselogin = 'root'; $force_install_databaselogin = 'root';
/** @var string Database password */ /** @var string $force_install_databasepass Database password */
$force_install_databasepass = ''; $force_install_databasepass = '';
/** @var bool Force database user creation */ /** @var bool $force_install_createuser Force database user creation */
$force_install_createuser = false; $force_install_createuser = false;
/** @var string Database root username */ /** @var string $force_install_databaserootlogin Database root username */
$force_install_databaserootlogin = 'root'; $force_install_databaserootlogin = 'root';
/** @var string Database root password */ /** @var string $force_install_databaserootpass Database root password */
$force_install_databaserootpass = ''; $force_install_databaserootpass = '';
/** @var string Dolibarr super-administrator username */ /** @var string $force_install_dolibarrlogin Dolibarr super-administrator username */
$force_install_dolibarrlogin = 'admin'; $force_install_dolibarrlogin = 'admin';
/** @var bool Force install locking */ /** @var bool $force_install_lockinstall Force install locking */
$force_install_lockinstall = true; $force_install_lockinstall = true;
/** @var string Enable module(s) (Comma separated class names list) */ /** @var string $force_install_module Enable module(s) (Comma separated class names list) */
$force_install_module = 'modSociete,modFournisseur,modFacture'; $force_install_module = 'modSociete,modFournisseur,modFacture';

View File

@ -183,13 +183,14 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
* For example if this selector is used to extract 500 different * For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500. * emails from a text file, this function must return 500.
* *
* @param string $filter Filter * @param string $sql Not use here
* @param string $option Options * @return int Nb of recipients or -1 if KO
* @return int Nb of recipients or -1 if KO
*/ */
public function getNbOfRecipients($filter = 1, $option = '') public function getNbOfRecipients($sql = '')
{ {
$a = parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''"); $sql = "select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''";
$a = parent::getNbOfRecipients($sql);
if ($a < 0) { if ($a < 0) {
return -1; return -1;

View File

@ -444,7 +444,7 @@ if (empty($reshook)) {
} }
$error++; $error++;
setEventMessages($errors, null, 'errors'); setEventMessages('', $errors, 'errors');
} }
} }

View File

@ -6103,19 +6103,19 @@ class Product extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'product_customer_price', 'product_customer_price',
'product_customer_price_log' 'product_customer_price_log'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -2167,18 +2167,18 @@ class Project extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'projet' 'projet'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }

View File

@ -2006,32 +2006,32 @@ class Reception extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array('reception'); $tables = array('reception');
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**
* Function used to replace a product id with another one. * Function used to replace a product id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old product id * @param int $origin_id Old thirdparty id
* @param int $dest_id New product id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'commande_fournisseur_dispatch' 'commande_fournisseur_dispatch'
); );
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceProduct($dbs, $origin_id, $dest_id, $tables);
} }
} }

View File

@ -1129,7 +1129,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '....'.$companypaymentmodetemp->last_four; print '....'.$companypaymentmodetemp->last_four;
} }
if ($companypaymentmodetemp->exp_date_month || $companypaymentmodetemp->exp_date_year) { if ($companypaymentmodetemp->exp_date_month || $companypaymentmodetemp->exp_date_year) {
print ' - '.sprintf("%02d", $companypaymentmodetemp->exp_date_month).'/'.$companypaymentmodetemp->exp_date_year.''; print ' - '.sprintf("%02d", $companypaymentmodetemp->exp_date_month).'/'.$companypaymentmodetemp->exp_date_year;
} }
print '</td><td>'; print '</td><td>';
if ($companypaymentmodetemp->country_code) { if ($companypaymentmodetemp->country_code) {
@ -1236,7 +1236,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
// Information // Information
print '<td valign="middle">'; print '<td valign="middle">';
if ($src->object == 'card') { if ($src->object == 'card') {
print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year;
print '</td><td>'; print '</td><td>';
if ($src->country) { if ($src->country) {
$img = picto_from_langcode($src->country); $img = picto_from_langcode($src->country);
@ -1246,7 +1246,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>'; print img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>';
} }
} elseif ($src->object == 'source' && $src->type == 'card') { } elseif ($src->object == 'source' && $src->type == 'card') {
print '<span class="opacitymedium">'.$src->owner->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '<span class="opacitymedium">'.$src->owner->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year;
print '</td><td>'; print '</td><td>';
if ($src->card->country) { if ($src->card->country) {
@ -1267,7 +1267,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>'; print img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>';
} }
} elseif ($src->object == 'payment_method' && $src->type == 'card') { } elseif ($src->object == 'payment_method' && $src->type == 'card') {
print '<span class="opacitymedium">'.$src->billing_details->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '<span class="opacitymedium">'.$src->billing_details->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year;
print '</td><td>'; print '</td><td>';
if ($src->card->country) { if ($src->card->country) {

View File

@ -2693,18 +2693,18 @@ class SupplierProposal extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'supplier_proposal' 'supplier_proposal'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }
/** /**

View File

@ -3642,18 +3642,18 @@ class User extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'user', 'user',
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
} }

View File

@ -218,7 +218,7 @@ if ($object->id > 0) {
// Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner) // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
if (!empty($conf->mutlicompany->enabled)) { if (!empty($conf->mutlicompany->enabled)) {
print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td colspan="2">'.$object->name.''; print '<td colspan="2">'.$object->name;
if (!$object->entity) { if (!$object->entity) {
print img_picto($langs->trans("GlobalGroup"), 'redstar'); print img_picto($langs->trans("GlobalGroup"), 'redstar');
} }

View File

@ -42,6 +42,15 @@ exclude:
- name: PhpArrayIsAlwaysEmptyInspection - name: PhpArrayIsAlwaysEmptyInspection
- name: PhpParameterByRefIsNotUsedAsReferenceInspection - name: PhpParameterByRefIsNotUsedAsReferenceInspection
- name: PhpWrongStringConcatenationInspection - name: PhpWrongStringConcatenationInspection
- name: PhpUnusedAliasInspection
- name: PhpUnusedPrivateMethodInspection
- name: PhpUnusedPrivateFieldInspection
- name: PhpExpressionAlwaysNullInspection - name: PhpExpressionAlwaysNullInspection
- name: PhpIfWithCommonPartsInspection - name: PhpIfWithCommonPartsInspection
- name: PhpTernaryExpressionCanBeReducedToShortVersionInspection
- name: PhpExpressionWithSameOperandsInspection
- name: PhpInArrayCanBeReplacedWithComparisonInspection
- name: PhpUnusedAliasInspection
- name: PhpPossiblePolymorphicInvocationInspection