Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2025-10-19 17:56:22 +02:00
27 changed files with 328 additions and 447 deletions

View File

@@ -1410,12 +1410,6 @@ parameters:
count: 1
path: ../../../htdocs/asset/tpl/depreciation_options_edit.tpl.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/asset/tpl/depreciation_options_view.tpl.php
-
message: '#^Variable \$parameters might not be defined\.$#'
identifier: variable.undefined
@@ -4032,12 +4026,6 @@ parameters:
count: 1
path: ../../../htdocs/compta/tva/clients.php
-
message: '#^Variable \$description might not be defined\.$#'
identifier: variable.undefined
count: 8
path: ../../../htdocs/compta/tva/clients.php
-
message: '#^Strict comparison using \=\=\= between true and true will always evaluate to true\.$#'
identifier: identical.alwaysTrue
@@ -7422,12 +7410,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/cheque/doc/pdf_blochet.class.php
-
message: '#^Parameter \#2 \$object of method BordereauChequeBlochet\:\:_pagefoot\(\) expects CommonObject, null given\.$#'
identifier: argument.type
count: 1
path: ../../../htdocs/core/modules/cheque/doc/pdf_blochet.class.php
-
message: '#^Property Commande\:\:\$availability \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@@ -8658,42 +8640,18 @@ parameters:
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_array_fields.tpl.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_print_fields.tpl.php
-
message: '#^Variable \$i might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_print_fields.tpl.php
-
message: '#^Variable \$obj might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/extrafields_list_print_fields.tpl.php
-
message: '#^Variable \$totalarray might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/core/tpl/extrafields_list_print_fields.tpl.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 8
path: ../../../htdocs/core/tpl/extrafields_list_search_sql.tpl.php
-
message: '#^Variable \$sql might not be defined\.$#'
identifier: variable.undefined
count: 7
path: ../../../htdocs/core/tpl/extrafields_list_search_sql.tpl.php
-
message: '#^Variable \$param might not be defined\.$#'
identifier: variable.undefined
@@ -8712,36 +8670,6 @@ parameters:
count: 1
path: ../../../htdocs/core/tpl/filemanager.tpl.php
-
message: '#^Variable \$action might not be defined\.$#'
identifier: variable.undefined
count: 6
path: ../../../htdocs/core/tpl/filemanager.tpl.php
-
message: '#^Variable \$ecmdir might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/filemanager.tpl.php
-
message: '#^Variable \$filepathnoext might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/filemanager.tpl.php
-
message: '#^Variable \$module in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
count: 1
path: ../../../htdocs/core/tpl/filemanager.tpl.php
-
message: '#^Variable \$pageid might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/filemanager.tpl.php
-
message: '#^Variable \$websitekey might not be defined\.$#'
identifier: variable.undefined
@@ -8814,18 +8742,6 @@ parameters:
count: 2
path: ../../../htdocs/core/tpl/objectline_view.tpl.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../../htdocs/core/tpl/objectlinked_lineimport.tpl.php
-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../../htdocs/core/tpl/objectlinked_lineimport.tpl.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
@@ -8874,54 +8790,6 @@ parameters:
count: 1
path: ../../../htdocs/core/website.inc.php
-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../../htdocs/core/website.inc.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 7
path: ../../../htdocs/core/website.inc.php
-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/core/website.inc.php
-
message: '#^Variable \$websitekey might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/core/website.inc.php
-
message: '#^Loose comparison using \=\= between 1 and 0 will always evaluate to false\.$#'
identifier: equal.alwaysFalse
count: 1
path: ../../../htdocs/cron/card.php
-
message: '#^Negated boolean expression is always false\.$#'
identifier: booleanNot.alwaysFalse
count: 2
path: ../../../htdocs/cron/card.php
-
message: '#^Result of && is always false\.$#'
identifier: booleanAnd.alwaysFalse
count: 2
path: ../../../htdocs/cron/card.php
-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue
count: 5
path: ../../../htdocs/cron/card.php
-
message: '#^Variable \$mc might not be defined\.$#'
identifier: variable.undefined
@@ -8940,12 +8808,6 @@ parameters:
count: 1
path: ../../../htdocs/cron/class/cronjob.class.php
-
message: '#^Ternary operator condition is always true\.$#'
identifier: ternary.alwaysTrue
count: 10
path: ../../../htdocs/cron/list.php
-
message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
@@ -15684,24 +15546,6 @@ parameters:
count: 1
path: ../../../htdocs/societe/class/companybankaccount.class.php
-
message: '#^Call to function method_exists\(\) with \$this\(Societe\) and ''getLibStatut'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: ../../../htdocs/societe/class/societe.class.php
-
message: '#^Call to function method_exists\(\) with \$this\(Societe\) and ''getNomUrl'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: ../../../htdocs/societe/class/societe.class.php
-
message: '#^Call to function property_exists\(\) with \$this\(Societe\) and ''code_client'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: ../../../htdocs/societe/class/societe.class.php
-
message: '#^Loose comparison using \!\= between ''email''\|''mobile'' and ''poste'' will always evaluate to true\.$#'
identifier: notEqual.alwaysTrue
@@ -15714,24 +15558,12 @@ parameters:
count: 1
path: ../../../htdocs/societe/class/societe.class.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 6
path: ../../../htdocs/societe/class/societe.class.php
-
message: '#^Property Contact\:\:\$roles \(array\<int, array\{id\: int, socid\: int, element\: string, source\: string, code\: string, label\: string\}\>\|null\) does not accept non\-empty\-list\<string\>\.$#'
identifier: assign.propertyType
count: 1
path: ../../../htdocs/societe/class/societe.class.php
-
message: '#^Property Societe\:\:\$bank_account \(Account\|string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../../htdocs/societe/class/societe.class.php
-
message: '#^Property Societe\:\:\$client \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@@ -15750,12 +15582,6 @@ parameters:
count: 1
path: ../../../htdocs/societe/class/societe.class.php
-
message: '#^Property Societe\:\:\$stcomm_id \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../../htdocs/societe/class/societe.class.php
-
message: '#^Property Societe\:\:\$typent_id \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@@ -15894,18 +15720,6 @@ parameters:
count: 1
path: ../../../htdocs/societe/price.php
-
message: '#^Variable \$db might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/societe/tpl/linesalesrepresentative.tpl.php
-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../../htdocs/societe/tpl/linesalesrepresentative.tpl.php
-
message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
@@ -16140,12 +15954,6 @@ parameters:
count: 5
path: ../../../htdocs/takepos/ajax/ajax.php
-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/takepos/css/pos.css.php
-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue

View File

@@ -11,20 +11,20 @@ return [
// # Issue statistics:
// PhanUndeclaredProperty : 420+ occurrences
// PhanTypeMismatchProperty : 100+ occurrences
// PhanTypeMismatchArgument : 70+ occurrences
// PhanTypeMismatchArgument : 65+ occurrences
// PhanUndeclaredGlobalVariable : 60+ occurrences
// PhanTypeMismatchArgumentNullable : 40+ occurrences
// PhanTypeInvalidDimOffset : 15+ occurrences
// PhanTypeMismatchDimFetch : 15+ occurrences
// PhanTypeMismatchDimFetch : 10+ occurrences
// PhanUndeclaredMethod : 8 occurrences
// PhanPossiblyUndeclaredGlobalVariable : 6 occurrences
// PhanTypeArraySuspiciousNull : 6 occurrences
// PhanTypeComparisonFromArray : 6 occurrences
// PhanTypeExpectedObjectPropAccess : 5 occurrences
// PhanTypeMismatchArgumentProbablyReal : 5 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
// PhanParamTooMany : 3 occurrences
// PhanPluginUndeclaredVariableIsset : 3 occurrences
// PhanTypeMismatchArgumentProbablyReal : 2 occurrences
// PhanPossiblyUndeclaredVariable : 1 occurrence
// PhanTypeExpectedObjectPropAccessButGotNull : 1 occurrence
// PhanTypeMismatchReturn : 1 occurrence
@@ -34,7 +34,7 @@ return [
'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/categories/viewcat.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/action/index.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/pertype.php' => ['PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchDimFetch'],
'htdocs/comm/action/pertype.php' => ['PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess'],
'htdocs/comm/action/peruser.php' => ['PhanTypeComparisonFromArray', 'PhanTypeMismatchArgument'],
'htdocs/comm/card.php' => ['PhanTypeMismatchArgument'],
'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'],
@@ -53,7 +53,6 @@ return [
'htdocs/compta/clients.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/facture/card-rec.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/localtax/card.php' => ['PhanUndeclaredGlobalVariable'],
@@ -72,7 +71,7 @@ return [
'htdocs/compta/tva/index.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument'],
'htdocs/contrat/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_massactions.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
@@ -105,7 +104,6 @@ return [
'htdocs/core/menus/standard/auguria.lib.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/core/modules/cheque/doc/pdf_blochet.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
@@ -196,7 +194,6 @@ return [
'htdocs/loan/document.php' => ['PhanUndeclaredProperty'],
'htdocs/loan/note.php' => ['PhanUndeclaredProperty'],
'htdocs/loan/payment/payment.php' => ['PhanUndeclaredProperty'],
'htdocs/mrp/class/mo.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/multicurrency/class/multicurrency.class.php' => ['PhanTypeExpectedObjectPropAccess'],
@@ -228,7 +225,6 @@ return [
'htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/public/members/new.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/public/payment/newpayment.php' => ['PhanUndeclaredProperty'],
'htdocs/public/payment/paymentok.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/public/project/suggestbooth.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/public/project/suggestconference.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/public/project/viewandvote.php' => ['PhanUndeclaredGlobalVariable'],

View File

@@ -50,51 +50,50 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("members", "companies", "categories"));
// Get parameters
$action = GETPOST('action', 'aZ09');
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOSTINT('show_files');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array:int');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array:int');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$optioncss = GETPOST('optioncss', 'aZ');
$mode = GETPOST('mode', 'alpha');
$optioncss = GETPOST('optioncss', 'aZ');
$mode = GETPOST('mode', 'alpha');
$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut'
// Search fields
$search = GETPOST("search", 'alpha');
$search = GETPOST("search", 'alpha');
$search_id = GETPOST('search_id', 'int');
$search_ref = GETPOST("search_ref", 'alpha');
$search_lastname = GETPOST("search_lastname", 'alpha');
$search_firstname = GETPOST("search_firstname", 'alpha');
$search_gender = GETPOST("search_gender", 'alpha');
$search_civility = GETPOST("search_civility", 'alpha');
$search_company = GETPOST('search_company', 'alphanohtml');
$search_login = GETPOST("search_login", 'alpha');
$search_address = GETPOST("search_address", 'alpha');
$search_zip = GETPOST("search_zip", 'alpha');
$search_town = GETPOST("search_town", 'alpha');
$search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state
$search_country = GETPOST("search_country", 'alpha');
$search_phone = GETPOST("search_phone", 'alpha');
$search_ref = GETPOST("search_ref", 'alpha');
$search_lastname = GETPOST("search_lastname", 'alpha');
$search_firstname = GETPOST("search_firstname", 'alpha');
$search_gender = GETPOST("search_gender", 'alpha');
$search_civility = GETPOST("search_civility", 'alpha');
$search_company = GETPOST('search_company', 'alphanohtml');
$search_login = GETPOST("search_login", 'alpha');
$search_address = GETPOST("search_address", 'alpha');
$search_zip = GETPOST("search_zip", 'alpha');
$search_town = GETPOST("search_town", 'alpha');
$search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state
$search_country = GETPOST("search_country", 'alpha');
$search_phone = GETPOST("search_phone", 'alpha');
$search_phone_perso = GETPOST("search_phone_perso", 'alpha');
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_type = GETPOST("search_type", 'alpha');
$search_email = GETPOST("search_email", 'alpha');
$search_categ = GETPOST("search_categ", 'intcomma');
$search_morphy = GETPOST("search_morphy", 'alpha');
$search_import_key = trim(GETPOST("search_import_key", 'alpha'));
$search_type = GETPOST("search_type", 'alpha');
$search_email = GETPOST("search_email", 'alpha');
$search_categ = GETPOST("search_categ", 'intcomma');
$search_morphy = GETPOST("search_morphy", 'alpha');
$search_import_key = trim(GETPOST("search_import_key", 'alpha'));
$socid = GETPOSTINT('socid');
if (GETPOSTINT('catid') && empty($search_categ)) {
$search_categ = GETPOSTINT('catid');
}
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma'); // status
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma'); // status
$search_datec_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datec_start_month'), GETPOSTINT('search_datec_start_day'), GETPOSTINT('search_datec_start_year'));
$search_datec_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datec_end_month'), GETPOSTINT('search_datec_end_day'), GETPOSTINT('search_datec_end_year'));
$search_datem_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datem_start_month'), GETPOSTINT('search_datem_start_day'), GETPOSTINT('search_datem_start_year'));
@@ -645,98 +644,116 @@ if ($search_type > 0) {
}
// $parameters
$param = '';
$query = [];
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
$query += ['mode' => $mode];
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
$query += ['contextpage' => $contextpage];
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
$query += ['limit' => $limit];
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
$query += ['optioncss' => $optioncss];
}
if ($groupby != '') {
$param .= '&groupby='.urlencode($groupby);
$query += ['groupby' => $groupby];
}
if ($search_all != "") {
$param .= "&search_all=".urlencode($search_all);
$query += ['search_all' => $search_all];
}
if ($search_ref) {
$param .= "&search_ref=".urlencode($search_ref);
$query += ['search_ref' => $search_ref];
}
if ($search_civility) {
$param .= "&search_civility=".urlencode($search_civility);
$query += ['search_civility' => $search_civility];
}
if ($search_firstname) {
$param .= "&search_firstname=".urlencode($search_firstname);
$query += ['search_firstname' => $search_firstname];
}
if ($search_lastname) {
$param .= "&search_lastname=".urlencode($search_lastname);
$query += ['search_lastname' => $search_lastname];
}
if ($search_gender) {
$param .= "&search_gender=".urlencode($search_gender);
$query += ['search_gender' => $search_gender];
}
if ($search_morphy != '' && $search_morphy != '-1') {
$query += ['search_morphy' => $search_morphy];
}
if ($search_login) {
$param .= "&search_login=".urlencode($search_login);
$query += ['search_login' => $search_login];
}
if ($search_email) {
$param .= "&search_email=".urlencode($search_email);
$query += ['search_email' => $search_email];
}
if ($search_categ > 0 || $search_categ == -2) {
$param .= "&search_categ=".urlencode((string) ($search_categ));
$query += ['search_categ' => $search_categ];
}
if ($search_company) {
$param .= "&search_company=".urlencode($search_company);
$query += ['search_company' => $search_company];
}
if ($search_address != '') {
$param .= "&search_address=".urlencode($search_address);
$query += ['search_address' => $search_address];
}
if ($search_town != '') {
$param .= "&search_town=".urlencode($search_town);
$query += ['search_town' => $search_town];
}
if ($search_zip != '') {
$param .= "&search_zip=".urlencode($search_zip);
$query += ['search_zip' => $search_zip];
}
if ($search_state != '') {
$param .= "&search_state=".urlencode($search_state);
$query += ['search_state' => $search_state];
}
if ($search_country != '') {
$param .= "&search_country=".urlencode($search_country);
$query += ['search_country' => $search_country];
}
if ($search_phone != '') {
$param .= "&search_phone=".urlencode($search_phone);
$query += ['search_phone' => $search_phone];
}
if ($search_phone_perso != '') {
$param .= "&search_phone_perso=".urlencode($search_phone_perso);
$query += ['search_phone_perso' => $search_phone_perso];
}
if ($search_phone_mobile != '') {
$param .= "&search_phone_mobile=".urlencode($search_phone_mobile);
$query += ['search_phone_mobile' => $search_phone_mobile];
}
if ($search_filter && $search_filter != '-1') {
$param .= "&search_filter=".urlencode($search_filter);
$query += ['search_filter' => $search_filter];
}
if ($search_status != "" && $search_status != -3) {
$param .= "&search_status=".urlencode($search_status);
$query += ['search_status' => $search_status];
}
if ($search_import_key != '') {
$param .= '&search_import_key='.urlencode($search_import_key);
$query += ['search_import_key' => $search_import_key];
}
if ($search_type > 0) {
$param .= "&search_type=".urlencode($search_type);
$query += ['search_type' => $search_type];
}
if ($search_datec_start) {
$param .= '&search_datec_start_day='.dol_print_date($search_datec_start, '%d').'&search_datec_start_month='.dol_print_date($search_datec_start, '%m').'&search_datec_start_year='.dol_print_date($search_datec_start, '%Y');
$query += [
'search_datec_start_day' => dol_print_date($search_datec_start, '%d'),
'search_datec_start_month' => dol_print_date($search_datec_start, '%m'),
'search_datec_start_year' => dol_print_date($search_datec_start, '%Y'),
];
}
if ($search_datem_end) {
$param .= '&search_datem_end_day='.dol_print_date($search_datem_end, '%d').'&search_datem_end_month='.dol_print_date($search_datem_end, '%m').'&search_datem_end_year='.dol_print_date($search_datem_end, '%Y');
$query += [
'search_datem_end_day' => dol_print_date($search_datem_end, '%d'),
'search_datem_end_month' => dol_print_date($search_datem_end, '%m'),
'search_datem_end_year' => dol_print_date($search_datem_end, '%Y'),
];
}
// Add $param from extra fields
// Add $query from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $query from hooks
$parameters = array('query' => &$query);
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// build $param
$param = http_build_query($query);
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
@@ -776,12 +793,14 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="page_y" value="">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
$queryforbutton = $query;
$queryforbutton['mode'] = 'common';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', dolBuildUrl($_SERVER["PHP_SELF"], $queryforbutton), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
$queryforbutton['mode'] = 'kanban';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', dolBuildUrl($_SERVER["PHP_SELF"], $queryforbutton), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create', '', $user->hasRight('adherent', 'creer'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', dolBuildUrl(DOL_URL_ROOT.'/adherents/card.php', ['action' => 'create']), '', $user->hasRight('adherent', 'creer'));
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@@ -27,6 +27,7 @@
*/
/**
* @var DoliDB $db
* @var Form $form
* @var HookManager $hookmanager
* @var AssetDepreciationOptions $assetdepreciationoptions

View File

@@ -6,7 +6,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -254,11 +254,11 @@ $nowday = $nowarray['mday'];
// Define list of all external calendars (global setup)
$listofextcals = array();
$prev = dol_get_first_day($year, $month);
$first_day = 1;
$first_month = 1;
$first_year = $year;
$prev = dol_get_first_day_week($day, $month, $year);
$week = $prev['week'];
$day = (int) $day;
@@ -339,7 +339,6 @@ $param .= "&maxprint=".urlencode((string) ($maxprint));
$paramnoactionodate = $param;
$prev = dol_get_first_day($year, 1);
$prev_year = $year - 1;
$prev_month = $month;
$prev_day = $day;
@@ -347,6 +346,7 @@ $first_day = 1;
$first_month = 1;
$first_year = $year;
$prev = dol_get_first_day_week(1, 1, $year);
$week = $prev['week'];
$day = (int) $day;

View File

@@ -1533,7 +1533,7 @@ class Facture extends CommonInvoice
/**
* Load an object from a contract and create a new invoice into database
*
* @param Facture $object Object source
* @param Contrat $object Object source
* @param User $user Object user
* @param int[] $lines Ids of lines to use for invoice. If empty, all lines will be used.
* @return int Return integer <0 if KO, 0 if nothing done, 1 if OK

View File

@@ -155,6 +155,7 @@ $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.
$builddate = dol_now();
$description = '';
if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice') {
$description = $langs->trans("RulesVATDueProducts");
}

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -153,7 +153,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
$value = ((GETPOST($key) == '1' || GETPOST($key) == 'on') ? 1 : 0);
} elseif ($object->fields[$key]['type'] == 'reference') {
$tmparraykey = array_keys($object->param_list);
$value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2');
$value = $tmparraykey[(int) GETPOST($key)].','.GETPOST($key.'2');
} elseif (preg_match('/^chkbxlst:(.*)/', $object->fields[$key]['type']) || $object->fields[$key]['type'] == 'checkbox') {
$value = '';
$values_arr = GETPOST($key, 'array');
@@ -315,7 +315,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
} elseif ($object->fields[$key]['type'] == 'reference') {
$value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
$value = array_keys($object->param_list)[(int) GETPOST($key)].','.GETPOST($key.'2');
} elseif (preg_match('/^chkbxlst:/', $object->fields[$key]['type']) || $object->fields[$key]['type'] == 'checkbox') {
$value = '';
$values_arr = GETPOST($key, 'array');

View File

@@ -1035,9 +1035,9 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
* @param float $marge_basse Margin bottom we use for the autobreak
* @param float $marge_gauche Margin left (no more used)
* @param float $page_hauteur Page height
* @param CommonObject $object Object shown in PDF
* @param ?CommonObject $object Object shown in PDF
* @param int<0,3> $showdetails Show company address details into footer (0=Nothing, 1=Show address, 2=Show managers, 3=Both)
* @param int $hidefreetext 1=Hide free text, 0=Show free text
* @param int<0,1> $hidefreetext 1=Hide free text, 0=Show free text
* @param float $page_largeur Page width
* @param string $watermark Watermark text to print on page
* @return int Return height of bottom margin including footer text

View File

@@ -208,7 +208,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$this->Body($pdf, $pagenb, $pages, $outputlangs);
// Pied de page
// Page footer
$this->_pagefoot($pdf, null, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) {
$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
@@ -427,7 +427,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param CommonObject $object Object to show
* @param ?CommonObject $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int<0,1> $hidefreetext 1=Hide free text
* @return int

View File

@@ -228,8 +228,9 @@ class pdf_eratosthene extends ModelePDFCommandes
$realpath = null;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
$entity = $objphoto->entity;
if ($entity !== null && $conf->entity != $entity) {
$dir = $conf->product->multidir_output[$entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
}

View File

@@ -329,8 +329,9 @@ class pdf_octopus extends ModelePDFFactures
$realpath = false;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
$entity = $objphoto->entity;
if ($entity !== null && $conf->entity != $entity) {
$dir = $conf->product->multidir_output[$entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
}
@@ -1480,13 +1481,13 @@ class pdf_octopus extends ModelePDFFactures
if ($object->status > Facture::STATUS_DRAFT && getDolGlobalInt('PDF_INVOICE_SHOW_BALANCE_SUMMARY')) {
// All customer previous invoices
$sql = "SELECT f.rowid, f.datef, f.total_ttc";
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql.= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql.= " AND f.entity IN (" . getEntity('invoice') . ")";
$sql.= " AND f.datef <= '" . $this->db->idate($object->date) . "'";
$sql.= " AND f.rowid < " . ((int) $object->id);
$sql.= " AND f.fk_statut > 0";
$sql.= " ORDER BY f.datef ASC";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql .= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql .= " AND f.entity IN (" . getEntity('invoice') . ")";
$sql .= " AND f.datef <= '" . $this->db->idate($object->date) . "'";
$sql .= " AND f.rowid < " . ((int) $object->id);
$sql .= " AND f.fk_statut > 0";
$sql .= " ORDER BY f.datef ASC";
$old_balance = 0;
$invoices = array();
@@ -1501,12 +1502,12 @@ class pdf_octopus extends ModelePDFFactures
// All payments before current date
$sql_payments = "SELECT p.datep, pf.fk_facture, pf.amount";
$sql_payments.= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
$sql_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement";
$sql_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture";
$sql_payments.= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql_payments.= " AND p.datep < '" . $this->db->idate($object->date) . "'";
$sql_payments.= " ORDER BY p.datep ASC";
$sql_payments .= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
$sql_payments .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement";
$sql_payments .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture";
$sql_payments .= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql_payments .= " AND p.datep < '" . $this->db->idate($object->date) . "'";
$sql_payments .= " ORDER BY p.datep ASC";
$total_payments = 0;
$resql_payments = $this->db->query($sql_payments);
@@ -1519,11 +1520,11 @@ class pdf_octopus extends ModelePDFFactures
// Payments made on current invoice date (including current invoice)
$sql_current_date_payments = "SELECT p.datep, pf.fk_facture, pf.amount";
$sql_current_date_payments.= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
$sql_current_date_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement";
$sql_current_date_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture";
$sql_current_date_payments.= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql_current_date_payments.= " AND DATE(p.datep) = DATE('" . $this->db->idate($object->date) . "')";
$sql_current_date_payments .= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
$sql_current_date_payments .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement";
$sql_current_date_payments .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture";
$sql_current_date_payments .= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql_current_date_payments .= " AND DATE(p.datep) = DATE('" . $this->db->idate($object->date) . "')";
$current_date_payments = 0;
$resql_current_date = $this->db->query($sql_current_date_payments);
@@ -1547,7 +1548,7 @@ class pdf_octopus extends ModelePDFFactures
$pdf->MultiCell($posxval - $this->marge_gauche + 8, 4, $titre, 0, 'L', true);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval+8, $posy);
$pdf->SetXY($posxval + 8, $posy);
$titre = $outputlangs->transnoentities("NewBalance").' : '.price($new_balance);
$pdf->MultiCell($posxend - $posxval - 8, 4, $titre, 0, 'L', true);

View File

@@ -264,8 +264,9 @@ class pdf_sponge extends ModelePDFFactures
$realpath = false;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
$entity = $objphoto->entity;
if ($entity !== null && $conf->entity != $entity) {
$dir = $conf->product->multidir_output[$entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
}
@@ -1399,13 +1400,13 @@ class pdf_sponge extends ModelePDFFactures
if ($object->status > Facture::STATUS_DRAFT && getDolGlobalInt('PDF_INVOICE_SHOW_BALANCE_SUMMARY')) {
// All customer previous invoices
$sql = "SELECT f.rowid, f.datef, f.total_ttc";
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql.= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql.= " AND f.entity IN (" . getEntity('invoice') . ")";
$sql.= " AND f.datef <= '" . $this->db->idate($object->date) . "'";
$sql.= " AND f.rowid < " . ((int) $object->id);
$sql.= " AND f.fk_statut > 0";
$sql.= " ORDER BY f.datef ASC";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql .= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql .= " AND f.entity IN (" . getEntity('invoice') . ")";
$sql .= " AND f.datef <= '" . $this->db->idate($object->date) . "'";
$sql .= " AND f.rowid < " . ((int) $object->id);
$sql .= " AND f.fk_statut > 0";
$sql .= " ORDER BY f.datef ASC";
$old_balance = 0;
$invoices = array();
@@ -1420,12 +1421,12 @@ class pdf_sponge extends ModelePDFFactures
// All payments before current date
$sql_payments = "SELECT p.datep, pf.fk_facture, pf.amount";
$sql_payments.= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
$sql_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement";
$sql_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture";
$sql_payments.= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql_payments.= " AND p.datep < '" . $this->db->idate($object->date) . "'";
$sql_payments.= " ORDER BY p.datep ASC";
$sql_payments .= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
$sql_payments .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement";
$sql_payments .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture";
$sql_payments .= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql_payments .= " AND p.datep < '" . $this->db->idate($object->date) . "'";
$sql_payments .= " ORDER BY p.datep ASC";
$total_payments = 0;
$resql_payments = $this->db->query($sql_payments);
@@ -1438,11 +1439,11 @@ class pdf_sponge extends ModelePDFFactures
// Payments made on current invoice date (including current invoice)
$sql_current_date_payments = "SELECT p.datep, pf.fk_facture, pf.amount";
$sql_current_date_payments.= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
$sql_current_date_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement";
$sql_current_date_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture";
$sql_current_date_payments.= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql_current_date_payments.= " AND DATE(p.datep) = DATE('" . $this->db->idate($object->date) . "')";
$sql_current_date_payments .= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
$sql_current_date_payments .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement";
$sql_current_date_payments .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture";
$sql_current_date_payments .= " WHERE f.fk_soc = " . ((int) $object->socid);
$sql_current_date_payments .= " AND DATE(p.datep) = DATE('" . $this->db->idate($object->date) . "')";
$current_date_payments = 0;
$resql_current_date = $this->db->query($sql_current_date_payments);
@@ -1466,7 +1467,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell($posxval - $this->marge_gauche + 8, 4, $titre, 0, 'L', true);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval+8, $posy);
$pdf->SetXY($posxval + 8, $posy);
$titre = $outputlangs->transnoentities("NewBalance").' : '.price($new_balance);
$pdf->MultiCell($posxend - $posxval - 8, 4, $titre, 0, 'L', true);

View File

@@ -243,8 +243,9 @@ class pdf_azur extends ModelePDFPropales
$realpath = '';
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
$entity = $objphoto->entity;
if ($entity !== null && $conf->entity != $entity) {
$dir = $conf->product->multidir_output[$entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
}

View File

@@ -220,8 +220,9 @@ class pdf_cyan extends ModelePDFPropales
$arephoto = false;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
$entity = $objphoto->entity;
if ($entity !== null && $conf->entity != $entity) {
$dir = $conf->product->multidir_output[$entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
}

View File

@@ -20,6 +20,8 @@
/**
* @var Conf $conf
* @var CommonObject $object
* @var stdClass $obj
* @var DoliDB $db
* @var ExtraFields $extrafields
*
* @var string $extrafieldsobjectkey
@@ -27,6 +29,7 @@
'
@phan-var-force CommonObject $object
@phan-var-force stdClass $obj
';
// Protection to avoid direct call of template

View File

@@ -26,17 +26,28 @@
* @var CommonObject $object
* @var ExtraFields $extrafields
*
* @var array<string,mixed> $search_array_options
* @var string $search_options_pattern
* @var string $param
* @var string $extrafieldsobjectkey
* @var array<string,mixed> $search_array_options
* @var string $search_options_pattern
* @var null|string $param
* @var null|array{string:mixed} $query
* @var string $extrafieldsobjectkey
*/
'
@phan-var-force null|array{string:mixed} $query
';
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit(1);
}
if (!isset($query)) {
$query = [];
}
if (!isset($param)) {
$param = '';
}
// Loop to complete $param for extrafields
if (!empty($search_array_options) && is_array($search_array_options)) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
@@ -46,7 +57,6 @@ if (!empty($search_array_options) && is_array($search_array_options)) { // $extr
if (empty($extrafieldsobjectkey) && is_object($object)) {
$extrafieldsobjectkey = $object->table_element;
}
foreach ($search_array_options as $key => $val) {
$tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key);
// date range from list filters is stored as array('start' => <timestamp>, 'end' => <timestamp>)
@@ -57,6 +67,13 @@ if (!empty($search_array_options) && is_array($search_array_options)) { // $extr
$param .= '&'.$search_options_pattern.$tmpkey.'_startday='.dol_print_date($val['start'], '%d');
$param .= '&'.$search_options_pattern.$tmpkey.'_starthour='.dol_print_date($val['start'], '%H');
$param .= '&'.$search_options_pattern.$tmpkey.'_startmin='.dol_print_date($val['start'], '%M');
$query += [
$search_options_pattern.$tmpkey.'_startyear' => dol_print_date($val['start'], '%Y'),
$search_options_pattern.$tmpkey.'_startmonth' => dol_print_date($val['start'], '%m'),
$search_options_pattern.$tmpkey.'_startday' => dol_print_date($val['start'], '%d'),
$search_options_pattern.$tmpkey.'_starthour' => dol_print_date($val['start'], '%H'),
$search_options_pattern.$tmpkey.'_startmin' => dol_print_date($val['start'], '%M'),
];
} elseif (is_array($val) && array_key_exists('end', $val)) {
// end date
$param .= '&'.$search_options_pattern.$tmpkey.'_endyear='.dol_print_date($val['end'], '%Y');
@@ -64,24 +81,35 @@ if (!empty($search_array_options) && is_array($search_array_options)) { // $extr
$param .= '&'.$search_options_pattern.$tmpkey.'_endday='.dol_print_date($val['end'], '%d');
$param .= '&'.$search_options_pattern.$tmpkey.'_endhour='.dol_print_date($val['end'], '%H');
$param .= '&'.$search_options_pattern.$tmpkey.'_endmin='.dol_print_date($val['end'], '%M');
$query += [
$search_options_pattern.$tmpkey.'_endyear' => dol_print_date($val['end'], '%Y'),
$search_options_pattern.$tmpkey.'_endmonth' => dol_print_date($val['end'], '%m'),
$search_options_pattern.$tmpkey.'_endday'=> dol_print_date($val['end'], '%d'),
$search_options_pattern.$tmpkey.'_endhour'=> dol_print_date($val['end'], '%H'),
$search_options_pattern.$tmpkey.'_endmin'=> dol_print_date($val['end'], '%M'),
];
$val = '';
} elseif ($val !== '' && $val !== null && $val !== []) {
if (is_array($val)) {
foreach ($val as $val2) {
$param .= '&'.$search_options_pattern.$tmpkey.'[]='.urlencode($val2);
$query += [$search_options_pattern.$tmpkey.'[]' => $val2];
}
} else {
// test if we have checkbox type, we add the _multiselect needed into param
$tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key);
if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey], array('checkbox', 'chkbxlst'))) {
$param .= '&'.$search_options_pattern.$tmpkey.'_multiselect='.urlencode($val);
$query += [$search_options_pattern.$tmpkey.'_multiselect' => $val];
}
// test if we have boolean type, we add the _booleand needed into param
if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey], array('boolean'))) {
$param .= '&'.$search_options_pattern.$tmpkey.'_boolean='.urlencode($val);
$query += [$search_options_pattern.$tmpkey.'_boolean' => $val];
}
$param .= '&'.$search_options_pattern.$tmpkey.'='.urlencode($val);
$query += [$search_options_pattern.$tmpkey => $val];
}
}
}

View File

@@ -24,7 +24,9 @@
/**
* @var Conf $conf
* @var CommonObject $object
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var string $sql
*/
// Protection to avoid direct call of template

View File

@@ -23,13 +23,19 @@
/**
* @var Conf $conf
* @var DoliDB $db
* @var EcmDirectory $ecmdir
* @var Form $form
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
* @var Website $website
*
* @var string $module
* @var string $action
* @var ?string $module
* @var int $section
* @var string $filepathnoext
* @var string $pageid
* @var int $formalreadyopen
*/
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
@@ -42,6 +48,7 @@ if (empty($conf) || !is_object($conf)) {
@phan-var-force string $filepathnoext
@phan-var-force string $pageid
@phan-var-force EcmDirectory $ecmdir
@phan-var-force ?string $module
@phan-var-force int $section
';
@@ -56,7 +63,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
$langs->load("ecm");
if (empty($module)) {
if (!isset($module)) {
$module = 'ecm';
}

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011-2013 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2011-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -15,6 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @var Conf $conf
* @var CommonObject $object
* @var Translate $langs
*/
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
@@ -24,7 +29,7 @@ if (empty($conf) || !is_object($conf)) {
$objectUrl = $object->getNomUrl(0, '', '0', 1);
if ($object->element == 'propal') {
$objectUrl = DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id;
$objectUrl = dolBuildUrl(DOL_URL_ROOT.'/comm/propal/card.php', ['id' => $object->id]);
}
?>
@@ -94,12 +99,7 @@ $(document).ready(function(){
{
$.jnotify("<?php echo $langs->trans('ErrorNoUrl'); ?>", "error", true);
}
});
});
</script>

View File

@@ -24,6 +24,13 @@
* It is run only when a web page is called.
* The global variable $websitekey must be defined.
*/
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
*
* @var string $websitekey
*/
// Load website class
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';

View File

@@ -56,14 +56,14 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$securitykey = GETPOST('securitykey', 'alpha');
if (!$user->hasRight('cron', 'create')) {
accessforbidden();
}
$permissiontoadd = $user->hasRight('cron', 'create');
$permissiontoexecute = $user->hasRight('cron', 'execute');
$permissiontodelete = $user->hasRight('cron', 'delete');
if (!$permissiontoadd) {
accessforbidden();
}
// after this test $permissiontoadd is always true and never can't be false
/*
* Actions
@@ -131,7 +131,7 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $permissiontoexecute) {
}
if ($action == 'add' && $permissiontoadd) {
if ($action == 'add'/* && $permissiontoadd */) {
$object->jobtype = GETPOST('jobtype');
$object->label = GETPOST('label');
$object->command = GETPOST('command');
@@ -167,7 +167,7 @@ if ($action == 'add' && $permissiontoadd) {
}
// Save parameters
if ($action == 'update' && $permissiontoadd) {
if ($action == 'update'/* && $permissiontoadd */) {
$object->id = $id;
$object->jobtype = GETPOST('jobtype');
$object->label = GETPOST('label');
@@ -201,7 +201,7 @@ if ($action == 'update' && $permissiontoadd) {
}
}
if ($action == 'activate' && $permissiontoadd) {
if ($action == 'activate'/* && $permissiontoadd */) {
$object->status = 1;
// Add cron task
@@ -217,7 +217,7 @@ if ($action == 'activate' && $permissiontoadd) {
}
}
if ($action == 'inactive' && $permissiontoadd) {
if ($action == 'inactive'/* && $permissiontoadd */) {
$object->status = 0;
$object->processing = 0;
@@ -235,7 +235,8 @@ if ($action == 'inactive' && $permissiontoadd) {
}
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) {
if ($action == 'confirm_clone' && $confirm == 'yes'/* && $permissiontoadd */) {
// @phpstan-ignore-next-line
if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { // @phan-suppress-current-line PhanPluginBothLiteralsBinaryOp
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
} else {
@@ -799,11 +800,7 @@ if (($action == "create") || ($action == "edit")) {
print "\n\n".'<div class="tabsAction">'."\n";
if (!$user->hasRight('cron', 'create')) {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Edit").'</a>';
} else {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Edit").'</a>';
}
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Edit").'</a>';
if ((!$user->hasRight('cron', 'execute'))) {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronExecute").'</a>';
@@ -813,18 +810,16 @@ if (($action == "create") || ($action == "edit")) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=execute&token='.newToken().'&id='.$object->id.(!getDolGlobalString('CRON_KEY') ? '' : '&securitykey='.urlencode(getDolGlobalString('CRON_KEY'))).'">'.$langs->trans("CronExecute").'</a>';
}
if (!$user->hasRight('cron', 'create')) {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronStatusActiveBtn").'/'.$langs->trans("CronStatusInactiveBtn").'</a>';
} else {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&token='.newToken().'&id='.$object->id.'">'.$langs->trans("ToClone").'</a>';
if (empty($object->status)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=activate&token='.newToken().'&id='.$object->id.'">'.$langs->trans("CronStatusActiveBtn").'</a>';
} else {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=inactive&id='.$object->id.'">'.$langs->trans("CronStatusInactiveBtn").'</a>';
}
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&token='.newToken().'&id='.$object->id.'">'.$langs->trans("ToClone").'</a>';
if (empty($object->status)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=activate&token='.newToken().'&id='.$object->id.'">'.$langs->trans("CronStatusActiveBtn").'</a>';
} else {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=inactive&id='.$object->id.'">'.$langs->trans("CronStatusInactiveBtn").'</a>';
}
if (!$user->hasRight('cron', 'delete')) {
print '<a class="butActionDeleteRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Delete").'</a>';
} else {

View File

@@ -136,16 +136,18 @@ foreach ($object->fields as $key => $val) {
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
// Security
if (!$user->hasRight('cron', 'read')) {
accessforbidden();
}
$permissiontoread = $user->hasRight('cron', 'read');
$permissiontoadd = $user->hasRight('cron', 'create') ? $user->hasRight('cron', 'create') : $user->hasRight('cron', 'write');
$permissiontodelete = $user->hasRight('cron', 'delete');
$permissiontoexecute = $user->hasRight('cron', 'execute');
// Security
if (!$permissiontoread) {
accessforbidden();
}
// after this test $permissiontoread is always true and never can't be false
$error = 0;
//var_dump($arrayfields);
@@ -251,7 +253,7 @@ if (empty($reshook)) {
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
header("Location: ".DOL_URL_ROOT.'/cron/list.php?'.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '')); // Make a redirect to avoid to run twice the job when using back
header("Location: ".DOL_URL_ROOT.'/cron/list.php?'.$param.'&sortfield='.$sortfield.'&sortorder='.$sortorder); // Make a redirect to avoid to run twice the job when using back
exit;
}
}
@@ -867,13 +869,13 @@ if ($num > 0) {
// Action
print '<td class="nowraponall right">';
$backtopage = urlencode($_SERVER["PHP_SELF"].'?'.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : ''));
$backtopage = urlencode($_SERVER["PHP_SELF"].'?'.$param.'&sortfield='.$sortfield.'&sortorder='.$sortorder);
if ($user->hasRight('cron', 'create')) {
print '<a class="editfielda" href="'.DOL_URL_ROOT."/cron/card.php?id=".$obj->rowid.'&action=edit&token='.newToken().($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').$param;
print '<a class="editfielda" href="'.DOL_URL_ROOT."/cron/card.php?id=".$obj->rowid.'&action=edit&token='.newToken().'&sortfield='.$sortfield.'&sortorder='.$sortorder.$param;
print "&backtopage=".$backtopage."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'), 'edit')."</a> &nbsp;";
}
if ($user->hasRight('cron', 'delete')) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"]."?id=".$obj->rowid.'&action=delete&token='.newToken().($page ? '&page='.$page : '').($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').$param;
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"]."?id=".$obj->rowid.'&action=delete&token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.$param;
print '" title="'.dol_escape_htmltag($langs->trans('CronDelete')).'">'.img_picto($langs->trans('CronDelete'), 'delete', '', 0, 0, 0, '', 'marginleftonly').'</a> &nbsp; ';
} else {
print '<a href="#" title="'.dol_escape_htmltag($langs->trans('NotEnoughPermissions')).'">'.img_picto($langs->trans('NotEnoughPermissions'), 'delete', '', 0, 0, 0, '', 'marginleftonly').'</a> &nbsp; ';
@@ -881,9 +883,9 @@ if ($num > 0) {
if ($user->hasRight('cron', 'execute')) {
if (!empty($obj->status)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute&token='.newToken();
print(!getDolGlobalString('CRON_KEY') ? '' : '&securitykey=' . getDolGlobalString('CRON_KEY'));
print($sortfield ? '&sortfield='.$sortfield : '');
print($sortorder ? '&sortorder='.$sortorder : '');
print (!getDolGlobalString('CRON_KEY') ? '' : '&securitykey=' . getDolGlobalString('CRON_KEY'));
print '&sortfield='.$sortfield;
print '&sortorder='.$sortorder;
print $param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play", '', 0, 0, 0, '', 'marginleftonly').'</a>';
} else {
print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'), "playdisabled", '', 0, 0, 0, '', 'marginleftonly').'</a>';

View File

@@ -795,14 +795,14 @@ class Mo extends CommonObject
/**
* Recurse through BOM only adding products to list to consume/produce
*
* @param User $user User that modifies
* @param string $role MoLine Role that products are added as
* @param BOM $bom BOM to parse lines from
* @param float $quantity Quantity modifier for sub products/BOM
* @return int Return integer <0 if KO, >0 if OK
*/
* Recurse through BOM only adding products to list to consume/produce
*
* @param User $user User that modifies
* @param string $role MoLine Role that products are added as
* @param BOM $bom BOM to parse lines from
* @param float $quantity Quantity modifier for sub products/BOM
* @return int Return integer <0 if KO, >0 if OK
*/
public function processBOM(User $user, $role, $bom, $quantity)
{
$error = 0;
@@ -850,7 +850,9 @@ class Mo extends CommonObject
}
}
}
if ($error) break;
if ($error) {
break;
}
}
return $error;
}
@@ -968,6 +970,7 @@ class Mo extends CommonObject
$arrayoflines = $this->fetchLinesLinked('consumed', $idline); // Get lines consumed under the one to delete
$result = 0;
$error = 0;
$this->db->begin();
@@ -997,7 +1000,7 @@ class Mo extends CommonObject
$idstockmove = $stockmove->livraison($user, $movement->product_id, $movement->warehouse_id, $qtytoprocess, 0, $labelmovementCancel, dol_now(), '', '', $movement->batch, 0, $codemovementCancel);
}
if ($idstockmove < 0) {
$this->error++;
$error++;
setEventMessages($stockmove->error, $stockmove->errors, 'errors');
} else {
$result = $moline->delete($user, $notrigger);
@@ -1020,7 +1023,7 @@ class Mo extends CommonObject
$idstockmove = $stockmove->livraison($user, $lineDetails['fk_product'], $lineDetails['fk_warehouse'], $qtytoprocess, 0, $labelmovementCancel, dol_now(), '', '', $lineDetails['batch'], 0, $codemovementCancel);
}
if ($idstockmove < 0) {
$this->error++;
$error++;
setEventMessages($stockmove->error, $stockmove->errors, 'errors');
} else {
$moline = new MoLine($this->db);
@@ -1028,13 +1031,13 @@ class Mo extends CommonObject
$resdel = $moline->delete($user, $notrigger);
if ($resdel < 0) {
$this->error++;
$error++;
setEventMessages($moline->error, $moline->errors, 'errors');
}
}
}
if (empty($this->error)) {
if ($error == 0) {
$result = $this->deleteLineCommon($user, $idline, $notrigger);
}
}
@@ -1043,7 +1046,7 @@ class Mo extends CommonObject
$result = $this->deleteLineCommon($user, $idline, $notrigger);
}
if (!empty($this->error) || $result <= 0) {
if ($error != 0 || $result <= 0) {
$this->db->rollback();
} else {
$this->db->commit();

View File

@@ -545,14 +545,17 @@ class Societe extends CommonObject
* @var int Type thirdparty
*/
public $typent_id = 0;
/**
* @var string
*/
public $typent_code;
/**
* @var int
*/
public $effectif;
/**
* @var int
*/
@@ -722,7 +725,7 @@ class Societe extends CommonObject
/**
* Status prospect id
* @var int
* @var ?int
*/
public $stcomm_id;
@@ -891,7 +894,7 @@ class Societe extends CommonObject
/**
* @var Account|string Default BAN account
* @var null|Account|string Default BAN account
*/
public $bank_account;
@@ -1108,7 +1111,7 @@ class Societe extends CommonObject
$ret = $this->update($this->id, $user, 0, 1, 1, 'add');
// update accountancy for this entity
if (!$error && getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
$this->db->query("DELETE FROM ".MAIN_DB_PREFIX."societe_perentity WHERE fk_soc = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_perentity (";
@@ -1208,19 +1211,19 @@ class Societe extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$contact = new Contact($this->db);
$contact->name = $this->name_bis;
$contact->firstname = $this->firstname;
$contact->civility_id = $this->civility_id;
$contact->socid = $this->id; // fk_soc
$contact->statut = 1; // deprecated
$contact->status = 1;
$contact->priv = 0;
$contact->country_id = $this->country_id;
$contact->state_id = $this->state_id;
$contact->address = $this->address;
$contact->email = $this->email;
$contact->zip = $this->zip;
$contact->town = $this->town;
$contact->name = $this->name_bis;
$contact->firstname = $this->firstname;
$contact->civility_id = $this->civility_id;
$contact->socid = $this->id; // fk_soc
$contact->statut = 1; // deprecated
$contact->status = 1;
$contact->priv = 0;
$contact->country_id = $this->country_id;
$contact->state_id = $this->state_id;
$contact->address = $this->address;
$contact->email = $this->email;
$contact->zip = $this->zip;
$contact->town = $this->town;
$this->setUpperOrLowerCase();
$contact->phone_pro = $this->phone;
if (getDolGlobalString('CONTACTS_DEFAULT_ROLES')) {
@@ -1489,13 +1492,13 @@ class Societe extends CommonObject
$this->email = trim((string) $this->email);
$this->url = $this->url ? clean_url($this->url, 0) : '';
$this->note_private = (empty($this->note_private) ? '' : trim($this->note_private));
$this->note_public = (empty($this->note_public) ? '' : trim($this->note_public));
$this->idprof1 = trim((string) $this->idprof1);
$this->idprof2 = trim((string) $this->idprof2);
$this->idprof3 = trim((string) $this->idprof3);
$this->idprof4 = trim((string) $this->idprof4);
$this->idprof5 = (!empty($this->idprof5) ? trim($this->idprof5) : '');
$this->idprof6 = (!empty($this->idprof6) ? trim($this->idprof6) : '');
$this->note_public = (empty($this->note_public) ? '' : trim($this->note_public));
$this->idprof1 = trim((string) $this->idprof1);
$this->idprof2 = trim((string) $this->idprof2);
$this->idprof3 = trim((string) $this->idprof3);
$this->idprof4 = trim((string) $this->idprof4);
$this->idprof5 = (!empty($this->idprof5) ? trim($this->idprof5) : '');
$this->idprof6 = (!empty($this->idprof6) ? trim($this->idprof6) : '');
$this->prefix_comm = trim((string) $this->prefix_comm);
$this->outstanding_limit = price2num($this->outstanding_limit);
$this->order_min_amount = price2num($this->order_min_amount);
@@ -1769,7 +1772,7 @@ class Societe extends CommonObject
$nbrowsaffected = $this->db->affected_rows($resql);
if (!$error && $nbrowsaffected) {
if ($nbrowsaffected) {
// Update information on linked member if it is an update
if (!$nosyncmember && isModEnabled('member')) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@@ -2415,7 +2418,7 @@ class Societe extends CommonObject
$this->db->begin();
// User is mandatory for trigger call
if (!$error && $call_trigger) {
if ($call_trigger) {
// Call trigger
$result = $this->call_trigger('COMPANY_DELETE', $fuser);
if ($result < 0) {
@@ -2972,15 +2975,13 @@ class Societe extends CommonObject
if ($this->id > 0 && $commid > 0) {
$this->db->begin();
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux";
$sql .= " WHERE fk_soc = ".((int) $this->id)." AND fk_user = ".((int) $commid);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux";
$sql .= " WHERE fk_soc = ".((int) $this->id)." AND fk_user = ".((int) $commid);
$resql = $this->db->query($sql);
if (!$resql) {
dol_syslog(get_class($this)."::add_commercial Error ".$this->db->lasterror());
$error++;
}
$resql = $this->db->query($sql);
if (!$resql) {
dol_syslog(get_class($this)."::add_commercial Error ".$this->db->lasterror());
$error++;
}
if (!$error) {
@@ -5084,7 +5085,7 @@ class Societe extends CommonObject
*/
public function getLibProspCommStatut($mode = 0, $label = '')
{
return $this->LibProspCommStatut($this->stcomm_id, $mode, $label, $this->stcomm_picto);
return $this->LibProspCommStatut((int) $this->stcomm_id, $mode, $label, $this->stcomm_picto);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -5652,43 +5653,41 @@ class Societe extends CommonObject
{
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$out = '<div class="box-flex-item box-flex-grow-zero">';
$out .= '<div class="info-box info-box-sm">';
$out .= '<span class="info-box-icon bg-infobox-action">';
if (!empty($this->logo) && class_exists('Form')) {
$return .= Form::showphoto('societe', $this, 0, 40, 0, 'photokanban', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
$out .= Form::showphoto('societe', $this, 0, 40, 0, 'photokanban', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
} else {
$return .= img_picto('', $this->picto);
$out .= img_picto('', $this->picto);
}
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<div class="info-box-ref inline-block tdoverflowmax125 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref);
$return .= '</div>';
$out .= '</span>';
$out .= '<div class="info-box-content">';
$out .= '<div class="info-box-ref inline-block tdoverflowmax125 valignmiddle">' . $this->getNomUrl(1);
$out .= '</div>';
if (!empty($this->phone)) {
$return .= '<div class="inline-block valignmiddle">';
$out .= '<div class="inline-block valignmiddle">';
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
$return .= dol_print_phone($this->phone, $this->country_code, 0, $this->id, 'tel', 'hidenum', 'phone', $this->phone, 0, 'paddingleft paddingright');
$return .= '</div>';
$out .= dol_print_phone($this->phone, $this->country_code, 0, $this->id, 'tel', 'hidenum', 'phone', $this->phone, 0, 'paddingleft paddingright');
$out .= '</div>';
}
if (!empty($this->email)) {
$return .= '<div class="inline-block valignmiddle">';
$return .= dol_print_email($this->email, 0, $this->id, 'thirdparty', -1, 1, 2, 'paddingleft paddingright');
$return .= '</div>';
$out .= '<div class="inline-block valignmiddle">';
$out .= dol_print_email($this->email, 0, $this->id, 'thirdparty', -1, 1, 2, 'paddingleft paddingright');
$out .= '</div>';
}
if ($selected >= 0) {
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
$out .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
if (property_exists($this, 'code_client')) {
$return .= '<br><span class="info-box-label opacitymedium">'.$this->code_client.'</span>';
if (!empty($this->code_client)) {
$out .= '<br><span class="info-box-label opacitymedium">'.$this->code_client.'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
}
$return .= '</div>'; // end info-box-content
$return .= '</div>';
$return .= '</div>';
$out .= '<br><div class="info-box-status">' . $this->getLibStatut(3) . '</div>';
$out .= '</div>'; // end info-box-content
$out .= '</div>';
$out .= '</div>';
return $return;
return $out;
}
/**
@@ -5791,7 +5790,7 @@ class Societe extends CommonObject
dol_syslog("mergeCompany merge thirdparty id=".$soc_origin_id." (will be deleted) into the thirdparty id=".$this->id);
if (!$error && $soc_origin->fetch($soc_origin_id) < 1) {
if ($soc_origin->fetch($soc_origin_id) < 1) {
$this->error = $langs->trans('ErrorRecordNotFound');
$error++;
}
@@ -5935,7 +5934,7 @@ class Societe extends CommonObject
require_once DOL_DOCUMENT_ROOT.$object_file;
if (!$error && !$object_name::replaceThirdparty($this->db, $soc_origin->id, $this->id)) {
if (!$object_name::replaceThirdparty($this->db, $soc_origin->id, $this->id)) {
$error++;
$this->error = $this->db->lasterror();
break;

View File

@@ -18,9 +18,11 @@
*/
/**
* @var Conf $conf
* @var DoliDB $db
* @var Form $form
* @var Translate $langs
* @var User $user
* @var Societe $object
*
* @var string $action
*/
@@ -39,7 +41,7 @@ print $langs->trans('SalesRepresentatives');
print '</td>';
if ($action != 'editsalesrepresentatives' && $user->hasRight('societe', 'creer')) {
print '<td class="right">';
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editsalesrepresentatives&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
print '<a class="editfielda reposition" href="' . dolBuildUrl($_SERVER["PHP_SELF"], ['action' => 'editsalesrepresentatives', 'socid' => $object->id], true) . '">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
print '</td>';
}
print '</tr></table>';

View File

@@ -52,6 +52,9 @@ define('ISLOADEDBYSTEELSHEET', '1');
session_cache_limiter('public');
require_once __DIR__.'/../../main.inc.php'; // __DIR__ allow this script to be included in custom themes
/**
* @var Conf $conf
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Define css type