Merge remote-tracking branch 'upstream/develop' into translations_errors

This commit is contained in:
Frédéric FRANCE
2024-04-03 14:47:01 +02:00
413 changed files with 3837 additions and 3128 deletions

View File

@@ -28,7 +28,7 @@ jobs:
# This is faster for a big repo.
- name: Get all changed php files (if PR)
id: changed-php
uses: tj-actions/changed-files@v43
uses: tj-actions/changed-files@v44
if: env.gh_event == 'pull_request'
with:
files: |
@@ -66,7 +66,7 @@ jobs:
# The next uses git, which is slow for a bit repo.
# - name: Get all changed php files (if PR)
# id: changed-php
# uses: tj-actions/changed-files@v43
# uses: tj-actions/changed-files@v44
# if: env.gh_event == 'pull_request'
# with:
# files: |
@@ -115,7 +115,7 @@ jobs:
ls -l ~/.cache/pre-commit/
- name: Convert Raw Log to Annotations
uses: mdeweerd/logToCheckStyle@v2024.3.4
uses: mdeweerd/logToCheckStyle@v2024.3.5
if: ${{ failure() }}
with:
in: ${{ env.RAW_LOG }}

View File

@@ -157,7 +157,7 @@ jobs:
for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A
- name: Convert Raw Log to Annotations
uses: mdeweerd/logToCheckStyle@v2024.3.4
uses: mdeweerd/logToCheckStyle@v2024.3.5
if: ${{ failure() }}
with:
in: ${{ env.PHPUNIT_LOG }}

View File

@@ -7,7 +7,7 @@ English Dolibarr ChangeLog
For users:
----------
NEW: Compatibility with PHP 8.3
NEW: Compatibility with PHP 8.2 (with no need to disable warnings)
...
For developers or integrators:
@@ -34,6 +34,10 @@ The following changes may create regressions for some external modules, but were
the deprecated field $fk_user_done in actioncomm table is removed. Please use $fk_user_action instead.
* The table commande_fournisseur_dispatch has been renamed into receptiondet_batch to better match its goal and the field fk_commande
and fk_commandefourndet were renamed into fk_element and fk_elementdet
* Removed trigger BILLREC_CREATEBILL. This trigger was not a CRUD event. If you used it, you can already use the trigger BILL_CREATE and
test that ($object->fac_rec > 0) to know if creation trigger is from a recurring invoice or not. Also this old trigger was never enabled
into table llx_c_action_trigger.
***** ChangeLog for 19.0.1 compared to 19.0.0 *****

View File

@@ -3,7 +3,7 @@
// Page created by Shepard [Fabian Pijcke] <Shepard8@laposte.net>
// Arno Esterhuizen <arno.esterhuizen@gmail.com>
// and Romain Bourdon <romain@anaska.com>
//
//
// icones by Mark James <http://www.famfamfam.com/lab/icons/silk/>
//
// Modified from WampServer project by Laurent Destailleur (NLTechno)
@@ -260,7 +260,7 @@ if (isset($_GET['askhelp']))
// Show PHPInfo
if (isset($_GET['phpinfo']))
{
phpinfo();
phpinfo(INFO_GENERAL|INFO_MODULES);
exit();
}
@@ -274,27 +274,27 @@ if (isset($_GET['img']))
header("Content-type: image/png");
echo base64_decode($pngFolder);
exit();
case 'pngFolderGo' :
header("Content-type: image/png");
echo base64_decode($pngFolderGo);
exit();
case 'pngLogo' :
header("Content-type: image/png");
echo base64_decode($pngLogo);
exit();
case 'pngPlugin' :
header("Content-type: image/png");
echo base64_decode($pngPlugin);
exit();
case 'pngWrench' :
header("Content-type: image/png");
echo base64_decode($pngWrench);
exit();
case 'favicon' :
header("Content-type: image/x-icon");
echo base64_decode($favicon);
@@ -324,7 +324,7 @@ foreach ($loaded_extensions as $extension) {
$phpExtContents .= "<li>${extension}</li>";
}
// Read alias directory
$listoffile=array();
$aliasarray=array();
@@ -337,10 +337,10 @@ if (is_dir($aliasDir)) {
}
}
sort($listoffiles);
foreach($listoffiles as $file) {
if (is_file($aliasDir.$file) && preg_match('/\.conf/',$file))
{
{
$msg = '';
$aliasContents.='<tr><td><ul class="aliases">';
@@ -350,7 +350,7 @@ if (is_dir($aliasDir)) {
if (preg_match('/dolibarr/i',$file)) $aliasContents .= $file.'</a></li></ul></td><td>http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/</td><td>http://<i>ipofyourserver</i>'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/</td></tr>';
elseif (preg_match('/phpmyadmin/i',$file)) $aliasContents .= $file.'</a></li></ul></td><td>http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/</td><td>'.$langues[$langue]['NotAvailable'].'</td></tr>';
else $aliasContents .= $file.'</a></li></ul></td> <td> </td><td>'.$langues[$langue]['NotAvailable'].'</td></tr>';
$aliasarray[]=$file;
}
}
@@ -358,13 +358,13 @@ if (is_dir($aliasDir)) {
}
if (!isset($aliasContents))
$aliasContents = '<tr><td colspan="3">'.$langues[$langue]['txtNoAlias'].'</td></tr>';
// Read projects in www dir
$listoffiles=array();
$handle=opendir(".");
if (is_resource($handle)) {
while ($file = readdir($handle))
while ($file = readdir($handle))
{
$listoffiles[]=$file;
}
@@ -372,14 +372,14 @@ if (is_resource($handle)) {
}
foreach($listoffiles as $file) {
if (is_dir($file) && !in_array($file,$projectsListIgnore) && !in_array($file,$aliasarray))
{
if (is_dir($file) && !in_array($file,$projectsListIgnore) && !in_array($file,$aliasarray))
{
$projectContents .= '<tr><td><ul class="projects">';
$projectContents .= '<li><a href="'.$file.'/">';
$projectContents .= $file.'</a>';
$projectContents .= '</li>';
$projectContents .= '</ul></td><td>http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/)'.'</td><td>'.$langues[$langue]['NotAvailable'].'</td></tr>';
}
}
@@ -509,7 +509,7 @@ a:hover {
font-size: 0.85em;
}
</style>
<link rel="shortcut icon" href="index.php?img=favicon" type="image/ico" />
</head>
@@ -533,7 +533,7 @@ a:hover {
<dd>${apacheVersion} &nbsp;</dd>
<dt>{$langues[$langue]['versp']}</dt>
<dd>${phpVersion} &nbsp;</dd>
<dt>{$langues[$langue]['phpExt']}</dt>
<dt>{$langues[$langue]['phpExt']}</dt>
<dd>
<ul>
${phpExtContents}
@@ -554,8 +554,8 @@ a:hover {
</td><td valign="middle">
{$langues[$langue]['FromInternet']}
</td></tr>
${aliasContents}
${projectContents}
${aliasContents}
${projectContents}
</table>
<h2>{$langues[$langue]['titrePage']}</h2>

View File

@@ -10,7 +10,8 @@ To: customer@customercompany.fr
Subject: [MyBigCompany - Ticket #TS2008-0040] Nouveau message
Date: Thu, 20 Aug 2020 18:31:37 +0200
Message-ID: <1597941097.SMTPs-dolibarr-tic58@83b5bc91f83a56e458db71e0adac2b62>
References: <1597941097.SMTPs-dolibarr-tic58@83b5bc91f83a56e458db71e0adac2b62>
References: <CALeEO_kij-ogXKzrjV_pTgqVbUB9j=287VkX34iVSWgDHFA8eg@mail.gmail.com>
In-Reply-To: <CALeEO_kij-ogXKzrjV_pTgqVbUB9j=287VkX34iVSWgDHFA8eg@mail.gmail.com>
X-Dolibarr-TRACKID: tic58@83b5bc91f83a56e458db71e0adac2b62
X-RemoteAddr: 127.0.0.1
X-Mailer: Dolibarr version 13.0.0-alpha (using SMTPs Mailer)
@@ -25,17 +26,17 @@ Content-Type: multipart/alternative; boundary="mul_872cdd6a64216735955664484832b
--mul_872cdd6a64216735955664484832b075
Content-Type: text/plain; charset=UTF-8
Bonjour
Bonjour
Une nouvelle réponse a été ajoutée à un ticket que vous suivez. Voici
le message :PredefinedMailContentTicket_send
le message :PredefinedMailContentTicket_send
Vous pouvez voir la progression du ticket en cliquant sur le lien
ci-dessus. : fr5uw2yospypn2rz
Cordialement,
ci-dessus. : fr5uw2yospypn2rz
Cordialement,
--
--mul_872cdd6a64216735955664484832b075
Content-Type: text/html; charset=UTF-8

View File

@@ -18,9 +18,11 @@ dollibarr->dolibarr
extrafeild->extrafield
thoose->those
# fiche->card
nempty->an empty, empty, not empty,
mot de passe->password
not de passe->password
nothtml->nohtml
shippin->shipping
tableau de bord->state board
tagret->target
thridparty->thirdparty

View File

@@ -9,23 +9,21 @@
*/
return [
// # Issue statistics:
// PhanParamSignatureMismatch : 25+ occurrences
// PhanParamSignatureMismatch : 20+ occurrences
// PhanPluginSuspiciousParamPosition : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences
// PhanTypeMismatchReturn : 8 occurrences
// PhanRedefineFunctionInternal : 6 occurrences
// PhanTypeArraySuspiciousNull : 6 occurrences
// PhanTypeMismatchReturn : 5 occurrences
// PhanParamTooMany : 4 occurrences
// PhanTypeMismatchReturnNullable : 3 occurrences
// PhanAccessMethodProtected : 1 occurrence
// PhanAccessPropertyStaticAsNonStatic : 1 occurrence
// PhanNoopStringLiteral : 1 occurrence
// PhanTypeArraySuspiciousNull : 1 occurrence
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'htdocs/adherents/admin/member.php' => ['PhanParamTooMany'],
'htdocs/adherents/type.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/admin/receiptprinter.php' => ['PhanRedefineFunctionInternal'],
'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected'],
@@ -35,23 +33,15 @@ return [
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany'],
'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/class/commondocgenerator.class.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/core/class/commonobject.class.php' => ['PhanTypeMismatchReturnNullable'],
'htdocs/core/class/extrafields.class.php' => ['PhanTypeMismatchReturnNullable'],
'htdocs/core/class/html.form.class.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/db/mysqli.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/db/pgsql.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturnNullable'],
'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanRedefineFunctionInternal'],
'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/core/modules/movement/doc/pdf_standard.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidRightOperandOfAdd'],
'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/expedition/class/api_shipments.class.php' => ['PhanTypeMismatchReturn'],
'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanTypeMismatchReturn'],
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanTypeMismatchReturn'],
'htdocs/fourn/class/fournisseur.facture.class.php' => ['PhanTypeMismatchReturn'],

View File

@@ -350,7 +350,13 @@ return [
// Note: trick to have different key for same regex:
'/^isModEnable[d]$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"],
'/^sanitizeVal$/' => [1, $sanitizeRegex,"UnknownSanitizeType"],
'/^checkVal$/' => [1, $sanitizeRegex,"UnknownCheckValSanitizeType"],
'/^\\\\ExtraFields::addExtraField$/' => [2, $extraFieldTypeRegex,"UnknownExtrafieldTypeBack"],
'/^dol_now$/' => [0, '{^(?:auto|gmt|tz(?:server|ref|user(?:rel)?))$}',"InvalidDolNowArgument"], // '', 0, 1 match bool and int values
'/^dol_mktime$/' => [6, '{^(?:|0|1|auto|gmt|tz(?:server|ref|user(?:rel)?|,[+a-zA-Z-/]+))$}',"InvalidDolMktimeArgument"], // '', 0, 1 match bool and int values
'/^dol_print_date$/' => [2, '{^(?:|0|1|auto|gmt|tz(?:server|user(?:rel)?))$}',"InvalidDolMktimeArgument"],
'/^GETPOSTFLOAT$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidGetPostFloatRounding"],
'/^price2num$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidPrice2NumRounding"],
],
'plugins' => [
__DIR__.'/plugins/NoVarDumpPlugin.php',

View File

@@ -1,324 +1,12 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/
define('DOL_PROJECT_ROOT', __DIR__.'/../../..');
define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs');
define('PHAN_DIR', __DIR__);
$sanitizeRegex
= '/^(array:)?(?:'.implode(
'|',
array(
// Documented:
'none',
'array',
'int',
'intcomma',
'alpha',
'alphawithlgt',
'alphanohtml',
'MS',
'aZ',
'aZ09',
'aZ09arobase',
'aZ09comma',
'san_alpha',
'restricthtml',
'nohtml',
'custom',
// Not documented:
'email',
'restricthtmlallowclass',
'restricthtmlallowunvalid',
'restricthtmlnolink',
//'ascii',
//'categ_id',
//'chaine',
//'html',
//'boolean',
//'double',
//'float',
//'string',
)
).')*$/';
// Load default configuration (with many exclusions)
//
$config = include __DIR__.DIRECTORY_SEPARATOR."config.php";
/**
* Map deprecated module names to new module names
*/
$DEPRECATED_MODULE_MAPPING = array(
'actioncomm' => 'agenda',
'adherent' => 'member',
'adherent_type' => 'member_type',
'banque' => 'bank',
'categorie' => 'category',
'commande' => 'order',
'contrat' => 'contract',
'entrepot' => 'stock',
'expedition' => 'shipping',
'facture' => 'invoice',
'ficheinter' => 'intervention',
'product_fournisseur_price' => 'productsupplierprice',
'product_price' => 'productprice',
'projet' => 'project',
'propale' => 'propal',
'socpeople' => 'contact',
);
/**
* Map module names to the 'class' name (the class is: mod<CLASSNAME>)
* Value is null when the module is not internal to the default
* Dolibarr setup.
*/
$VALID_MODULE_MAPPING = array(
'accounting' => 'Accounting',
'agenda' => 'Agenda',
'ai' => 'Ai',
'anothermodule' => null,
'api' => 'Api',
'asset' => 'Asset',
'bank' => 'Banque',
'barcode' => 'Barcode',
'blockedlog' => 'BlockedLog',
'bom' => 'Bom',
'bookcal' => 'BookCal',
'bookmark' => 'Bookmark',
'cashdesk' => null, // TODO: fill in proper class
'category' => 'Categorie',
'clicktodial' => 'ClickToDial',
'collab' => 'Collab',
'comptabilite' => 'Comptabilite',
'contact' => null, // TODO: fill in proper class
'contract' => 'Contrat',
'cron' => 'Cron',
'datapolicy' => 'DataPolicy',
'dav' => 'Dav',
'debugbar' => 'DebugBar',
'shipping' => 'Expedition',
'deplacement' => 'Deplacement',
"documentgeneration" => 'DocumentGeneration',
'don' => 'Don',
'dynamicprices' => 'DynamicPrices',
'ecm' => 'ECM',
'ecotax' => null, // TODO: External module ?
'emailcollector' => 'EmailCollector',
'eventorganization' => 'EventOrganization',
'expensereport' => 'ExpenseReport',
'export' => 'Export',
'externalrss' => 'ExternalRss',
'externalsite' => 'ExternalSite',
'fckeditor' => 'Fckeditor',
'fournisseur' => 'Fournisseur',
'ftp' => 'FTP',
'geoipmaxmind' => 'GeoIPMaxmind',
'google' => null, // External ?
'gravatar' => 'Gravatar',
'holiday' => 'Holiday',
'hrm' => 'HRM',
'import' => 'Import',
'incoterm' => 'Incoterm',
'intervention' => 'Ficheinter',
'intracommreport' => 'Intracommreport',
'invoice' => 'Facture',
'knowledgemanagement' => 'KnowledgeManagement',
'label' => 'Label',
'ldap' => 'Ldap',
'loan' => 'Loan',
'mailing' => 'Mailing',
'mailman' => null, // Same module as mailmanspip -> MailmanSpip ??
'mailmanspip' => 'MailmanSpip',
'margin' => 'Margin',
'member' => 'Adherent',
'memcached' => null, // TODO: External module?
'modulebuilder' => 'ModuleBuilder',
'mrp' => 'Mrp',
'multicompany' => null, // Not provided by default, no module tests
'multicurrency' => 'MultiCurrency',
'mymodule' => null, // modMyModule - Name used in module builder (avoid false positives)
'notification' => 'Notification',
'numberwords' => null, // Not provided by default, no module tests
'oauth' => 'Oauth',
'openstreetmap' => null, // External module?
'opensurvey' => 'OpenSurvey',
'order' => 'Commande',
'partnership' => 'Partnership',
'paybox' => 'Paybox',
'paymentbybanktransfer' => 'PaymentByBankTransfer',
'paypal' => 'Paypal',
'paypalplus' => null,
'prelevement' => 'Prelevement',
'printing' => 'Printing',
'product' => 'Product',
'productbatch' => 'ProductBatch',
'productprice' => null,
'productsupplierprice' => null,
'project' => 'Projet',
'propal' => 'Propale',
'receiptprinter' => 'ReceiptPrinter',
'reception' => 'Reception',
'recruitment' => 'Recruitment',
'resource' => 'Resource',
'salaries' => 'Salaries',
'service' => 'Service',
'socialnetworks' => 'SocialNetworks',
'societe' => 'Societe',
'stock' => 'Stock',
'stocktransfer' => 'StockTransfer',
'stripe' => 'Stripe',
'supplier_invoice' => null, // Special case, uses invoice
'supplier_order' => null, // Special case, uses invoice
'supplier_proposal' => 'SupplierProposal',
'syslog' => 'Syslog',
'takepos' => 'TakePos',
'tax' => 'Tax',
'theme_datacolor' => 'array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int},3:array{0:int,1:int,2:int}}',
'ticket' => 'Ticket',
'user' => 'User',
'variants' => 'Variants',
'webhook' => 'Webhook',
'webportal' => 'WebPortal',
'webservices' => 'WebServices',
'webservicesclient' => 'WebServicesClient',
'website' => 'Website',
'workflow' => 'Workflow',
'workstation' => 'Workstation',
'zapier' => 'Zapier',
);
$moduleNameRegex = '/^(?:'.implode('|', array_merge(array_keys($DEPRECATED_MODULE_MAPPING), array_keys($VALID_MODULE_MAPPING))).')$/';
$deprecatedModuleNameRegex = '/^(?!(?:'.implode('|', array_keys($DEPRECATED_MODULE_MAPPING)).')$).*/';
/**
* This configuration will be read and overlaid on top of the
* default configuration. Command line arguments will be applied
* after this file is read.
*/
return [
// 'processes' => 6,
'backward_compatibility_checks' => false,
'simplify_ast' => true,
'analyzed_file_extensions' => ['php','inc'],
'globals_type_map' => [
'action' => 'string',
'actioncode' => 'string',
'badgeStatus0' => 'string',
'badgeStatus1' => 'string',
'badgeStatus11' => 'string',
'badgeStatus3' => 'string',
'badgeStatus4' => 'string',
'badgeStatus6' => 'string',
'badgeStatus8' => 'string',
'badgeStatus9' => 'string',
'classname' => 'string',
'conf' => '\Conf',
'conffile' => 'string',
'conffiletoshow' => 'string',
'conffiletoshowshort' => 'string',
'db' => '\DoliDB',
'disableedit' => 'int<0,1>',
'disablemove' => 'int<0,1>',
'disableremove' => 'int<0,1>',
'dolibarr_main_authentication' => 'string',
'dolibarr_main_data_root' => 'string',
'dolibarr_main_data_root' => 'string',
'dolibarr_main_db_encrypted_pass' => 'string',
'dolibarr_main_db_host' => 'string',
'dolibarr_main_db_pass' => 'string',
'dolibarr_main_demo' => 'string',
'dolibarr_main_document_root' => 'string',
'dolibarr_main_url_root' => 'string',
'errormsg' => 'string',
'extrafields' => '\ExtraFields',
'filter' => 'string',
'filtert' => 'int',
'forceall' => 'int<0,1>',
'form' => '\Form',
'hookmanager' => '\HookManager',
'inputalsopricewithtax' => 'int<0,1>',
'langs' => '\Translate',
'leftmenu' => 'string',
'mainmenu' => 'string',
'menumanager' => '\MenuManager',
'mysoc' => '\Societe',
'nblines' => '\int',
'obj' => '\CommonObject', // Deprecated
'object_rights' => 'int|stdClass',
'objectoffield' => '\CommonObject',
'senderissupplier' => 'int<0,2>',
'user' => '\User',
'website' => 'string', // See discussion https://github.com/Dolibarr/dolibarr/pull/28891#issuecomment-2002268334 // Disable because Phan infers Website type
'websitepage' => '\WebSitePage',
'websitepagefile' => 'string',
// 'object' => '\CommonObject', // Deprecated, not enabled because conflicts with $object assignments
],
// Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`, `'7.4'`, `null`.
// If this is set to `null`,
// then Phan assumes the PHP version which is closest to the minor version
// of the php executable used to execute Phan.
//"target_php_version" => null,
"target_php_version" => '8.2',
//"target_php_version" => '7.3',
//"target_php_version" => '5.6',
// A list of directories that should be parsed for class and
// method information. After excluding the directories
// defined in exclude_analysis_directory_list, the remaining
// files will be statically analyzed for errors.
//
// Thus, both first-party and third-party code being used by
// your application should be included in this list.
'directory_list' => [
'htdocs',
PHAN_DIR . '/stubs/',
],
// A directory list that defines files that will be excluded
// from static analysis, but whose class and method
// information should be included.
//
// Generally, you'll want to include the directories for
// third-party code (such as "vendor/") in this list.
//
// n.b.: If you'd like to parse but not analyze 3rd
// party code, directories containing that code
// should be added to the `directory_list` as
// to `exclude_analysis_directory_list`.
"exclude_analysis_directory_list" => [
'htdocs/includes/',
'htdocs/install/doctemplates/websites/',
'htdocs/core/class/lessc.class.php', // External library
PHAN_DIR . '/stubs/',
],
//'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
'exclude_file_regex' => '@^(' // @phpstan-ignore-line
.'dummy' // @phpstan-ignore-line
.'|htdocs/.*/canvas/.*/tpl/.*.tpl.php' // @phpstan-ignore-line
.'|htdocs/modulebuilder/template/.*' // @phpstan-ignore-line
// Included as stub (old version + incompatible typing hints)
.'|htdocs/includes/restler/.*' // @phpstan-ignore-line
// Included as stub (did not seem properly analysed by phan without it)
.'|htdocs/includes/stripe/.*' // @phpstan-ignore-line
.'|htdocs/conf/conf.php' // @phpstan-ignore-line
.')@', // @phpstan-ignore-line
// A list of plugin files to execute.
// Plugins which are bundled with Phan can be added here by providing their name
// (e.g. 'AlwaysReturnPlugin')
//
// Documentation about available bundled plugins can be found
// at https://github.com/phan/phan/tree/master/.phan/plugins
//
// Alternately, you can pass in the full path to a PHP file
// with the plugin's implementation (e.g. 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php')
'ParamMatchRegexPlugin' => [
'/^GETPOST$/' => [1, $sanitizeRegex, 'GetPostUnknownSanitizeType'],
'/^isModEnabled$/' => [0, $moduleNameRegex, 'UnknownModuleName'],
// Note: trick to have different key for same regex:
'/^isModEnable[d]$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"],
'/^sanitizeVal$/' => [1, $sanitizeRegex,"UnknownSanitizeType"],
],
'plugins' => [
$config['plugins'] = [
__DIR__.'/plugins/NoVarDumpPlugin.php',
__DIR__.'/plugins/ParamMatchRegexPlugin.php',
'DeprecateAliasPlugin',
@@ -367,11 +55,11 @@ return [
'UseReturnValuePlugin',
'EmptyStatementListPlugin',
'LoopVariableReusePlugin',
],
];
// Add any issue types (such as 'PhanUndeclaredMethod')
// here to inhibit them from being reported
'suppress_issue_types' => [
// Add any issue types (such as 'PhanUndeclaredMethod')
// here to inhibit them from being reported
$config['suppress_issue_types'] = [
'PhanCompatibleNegativeStringOffset', // return false positive
'PhanPluginWhitespaceTab', // Dolibarr used tabs
@@ -394,50 +82,6 @@ return [
'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences
'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning
'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences
],
// You can put relative paths to internal stubs in this config option.
// Phan will continue using its detailed type annotations,
// but load the constants, classes, functions, and classes (and their Reflection types)
// from these stub files (doubling as valid php files).
// Use a different extension from php (and preferably a separate folder)
// to avoid accidentally parsing these as PHP (includes projects depending on this).
// The 'mkstubs' script can be used to generate your own stubs (compatible with php 7.0+ right now)
// Note: The array key must be the same as the extension name reported by `php -m`,
// so that phan can skip loading the stubs if the extension is actually available.
'autoload_internal_extension_signatures' => [
// Stubs may be available at https://github.com/JetBrains/phpstorm-stubs/tree/master
// Xdebug stubs are bundled with Phan 0.10.1+/0.8.9+ for usage,
// because Phan disables xdebug by default.
//'xdebug' => 'vendor/phan/phan/.phan/internal_stubs/xdebug.phan_php',
//'memcached' => PHAN_DIR . '/your_internal_stubs_folder_name/memcached.phan_php',
//'PDO' => PHAN_DIR . '/stubs/PDO.phan_php',
'brotli' => PHAN_DIR . '/stubs/brotli.phan_php',
'curl' => PHAN_DIR . '/stubs/curl.phan_php',
'calendar' => PHAN_DIR . '/stubs/calendar.phan_php',
'fileinfo' => PHAN_DIR . '/stubs/fileinfo.phan_php',
'ftp' => PHAN_DIR . '/stubs/ftp.phan_php',
'gd' => PHAN_DIR . '/stubs/gd.phan_php',
'geoip' => PHAN_DIR . '/stubs/geoip.phan_php',
'imap' => PHAN_DIR . '/stubs/imap.phan_php',
'imagick' => PHAN_DIR . '/stubs/imagick.phan_php',
'intl' => PHAN_DIR . '/stubs/intl.phan_php',
'ldap' => PHAN_DIR . '/stubs/ldap.phan_php',
'mcrypt' => PHAN_DIR . '/stubs/mcrypt.phan_php',
'memcache' => PHAN_DIR . '/stubs/memcache.phan_php',
'memcached' => PHAN_DIR . '/stubs/memcached.phan_php',
'mysqli' => PHAN_DIR . '/stubs/mysqli.phan_php',
'pdo_cubrid' => PHAN_DIR . '/stubs/pdo_cubrid.phan_php',
'pdo_mysql' => PHAN_DIR . '/stubs/pdo_mysql.phan_php',
'pdo_pgsql' => PHAN_DIR . '/stubs/pdo_pgsql.phan_php',
'pdo_sqlite' => PHAN_DIR . '/stubs/pdo_sqlite.phan_php',
'pgsql' => PHAN_DIR . '/stubs/pgsql.phan_php',
'session' => PHAN_DIR . '/stubs/session.phan_php',
'simplexml' => PHAN_DIR . '/stubs/SimpleXML.phan_php',
'soap' => PHAN_DIR . '/stubs/soap.phan_php',
'sockets' => PHAN_DIR . '/stubs/sockets.phan_php',
'tidy' => PHAN_DIR . '/stubs/tidy.phan_php',
'zip' => PHAN_DIR . '/stubs/zip.phan_php',
],
];
return $config;

View File

@@ -3,101 +3,22 @@
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*/
// Uncomment require_once to enable corresponding fixer
// Load default configuration (with many exclusions)
//
$config = include __DIR__.DIRECTORY_SEPARATOR."config.php";
//require_once __DIR__.'/plugins/DeprecatedModuleNameFixer.php';
//require_once __DIR__.'/plugins/PriceFormFixer.php';
//require_once __DIR__.'/plugins/UrlEncodeStringifyFixer.php';
require_once __DIR__.'/plugins/SelectDateFixer.php';
define('DOL_PROJECT_ROOT', __DIR__.'/../../..');
define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs');
define('PHAN_DIR', __DIR__);
$DEPRECATED_MODULE_MAPPING = array(
'actioncomm' => 'agenda',
'adherent' => 'member',
'adherent_type' => 'member_type',
'banque' => 'bank',
'categorie' => 'category',
'commande' => 'order',
'contrat' => 'contract',
'entrepot' => 'stock',
'expedition' => 'shipping',
'facture' => 'invoice',
'ficheinter' => 'intervention',
'product_fournisseur_price' => 'productsupplierprice',
'product_price' => 'productprice',
'projet' => 'project',
'propale' => 'propal',
'socpeople' => 'contact',
);
$deprecatedModuleNameRegex = '/^(?!(?:'.implode('|', array_keys($DEPRECATED_MODULE_MAPPING)).')$).*/';
//$deprecatedModuleNameRegex = '/^(?!(?:'.implode('|', array_keys($DEPRECATED_MODULE_MAPPING)).')$).*/';
require_once __DIR__.'/plugins/DeprecatedModuleNameFixer.php';
/**
* This configuration will be read and overlaid on top of the
* default configuration. Command line arguments will be applied
* after this file is read.
*/
return [
// 'processes' => 6,
'backward_compatibility_checks' => false,
'simplify_ast' => true,
'analyzed_file_extensions' => ['php','inc'],
'globals_type_map' => [
'conf' => '\Conf',
'db' => '\DoliDB',
'extrafields' => '\ExtraFields',
'hookmanager' => '\HookManager',
'langs' => '\Translate',
'mysoc' => '\Societe',
'nblines' => '\int',
'user' => '\User',
],
// Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`, `'7.4'`, `null`.
// If this is set to `null`,
// then Phan assumes the PHP version which is closest to the minor version
// of the php executable used to execute Phan.
//"target_php_version" => null,
"target_php_version" => '8.2',
//"target_php_version" => '7.3',
//"target_php_version" => '5.6',
// A list of directories that should be parsed for class and
// method information. After excluding the directories
// defined in exclude_analysis_directory_list, the remaining
// files will be statically analyzed for errors.
//
// Thus, both first-party and third-party code being used by
// your application should be included in this list.
'directory_list' => [
'htdocs',
PHAN_DIR . '/stubs/',
],
// A directory list that defines files that will be excluded
// from static analysis, but whose class and method
// information should be included.
//
// Generally, you'll want to include the directories for
// third-party code (such as "vendor/") in this list.
//
// n.b.: If you'd like to parse but not analyze 3rd
// party code, directories containing that code
// should be added to the `directory_list` as
// to `exclude_analysis_directory_list`.
"exclude_analysis_directory_list" => [
'htdocs/includes/',
'htdocs/install/doctemplates/websites/',
'htdocs/core/class/lessc.class.php', // External library
PHAN_DIR . '/stubs/',
],
//'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
'exclude_file_regex' => '@^(' // @phpstan-ignore-line
$config['exclude_file_regex'] = '@^(' // @phpstan-ignore-line
.'dummy' // @phpstan-ignore-line
.'|htdocs/.*/canvas/.*/tpl/.*.tpl.php' // @phpstan-ignore-line
.'|htdocs/modulebuilder/template/.*' // @phpstan-ignore-line
@@ -108,144 +29,12 @@ return [
.'|htdocs/conf/conf.php' // @phpstan-ignore-line
//.'|htdocs/[^c][^o][^r][^e][^/].*' // For testing @phpstan-ignore-line
//.'|htdocs/[^h].*' // For testing on restricted set @phpstan-ignore-line
.')@', // @phpstan-ignore-line
.')@'; // @phpstan-ignore-line
// A list of plugin files to execute.
// Plugins which are bundled with Phan can be added here by providing their name
// (e.g. 'AlwaysReturnPlugin')
//
// Documentation about available bundled plugins can be found
// at https://github.com/phan/phan/tree/master/.phan/plugins
//
// Alternately, you can pass in the full path to a PHP file
// with the plugin's implementation (e.g. 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php')
'ParamMatchRegexPlugin' => [
'/^isModEnabled$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"],
],
'plugins' => [
__DIR__.'/plugins/ParamMatchRegexPlugin.php',
'DeprecateAliasPlugin',
// __DIR__.'/plugins/NoVarDumpPlugin.php',
//__DIR__.'/plugins/GetPostFixerPlugin.php',
//'PHPDocToRealTypesPlugin',
// $config['plugins'][] = __DIR__.'/plugins/ParamMatchRegexPlugin.php';
$config['plugins'][] = 'DeprecateAliasPlugin';
$config['plugins'][] = 'DeprecateAliasPlugin';
// $config['plugins'][] = __DIR__.'/plugins/GetPostFixerPlugin.php';
// $config['plugins'][] = 'PHPDocToRealTypesPlugin';
/*
//'EmptyMethodAndFunctionPlugin',
'InvalidVariableIssetPlugin',
//'MoreSpecificElementTypePlugin',
'NoAssertPlugin',
'NotFullyQualifiedUsagePlugin',
'PHPDocRedundantPlugin',
'PHPUnitNotDeadCodePlugin',
//'PossiblyStaticMethodPlugin',
'PreferNamespaceUsePlugin',
'PrintfCheckerPlugin',
'RedundantAssignmentPlugin',
'ConstantVariablePlugin', // Warns about values that are actually constant
//'HasPHPDocPlugin', // Requires PHPDoc
'InlineHTMLPlugin', // html in PHP file, or at end of file
'NonBoolBranchPlugin', // Requires test on bool, nont on ints
'NonBoolInLogicalArithPlugin',
'NumericalComparisonPlugin',
'PHPDocToRealTypesPlugin',
'PHPDocInWrongCommentPlugin', // Missing /** (/* was used)
//'ShortArrayPlugin', // Checks that [] is used
//'StrictLiteralComparisonPlugin',
'UnknownClassElementAccessPlugin',
'UnknownElementTypePlugin',
'WhitespacePlugin',
//'RemoveDebugStatementPlugin', // Reports echo, print, ...
//'StrictComparisonPlugin', // Expects ===
'SuspiciousParamOrderPlugin',
'UnsafeCodePlugin',
//'UnusedSuppressionPlugin',
'AlwaysReturnPlugin',
//'DollarDollarPlugin',
'DuplicateArrayKeyPlugin',
'DuplicateExpressionPlugin',
'PregRegexCheckerPlugin',
'PrintfCheckerPlugin',
'SleepCheckerPlugin',
// Checks for syntactically unreachable statements in
// the global scope or function bodies.
'UnreachableCodePlugin',
'UseReturnValuePlugin',
'EmptyStatementListPlugin',
'LoopVariableReusePlugin',
*/
],
// Add any issue types (such as 'PhanUndeclaredMethod')
// here to inhibit them from being reported
'suppress_issue_types' => [
'PhanCompatibleNegativeStringOffset', // return false positive
'PhanPluginWhitespaceTab', // Dolibarr used tabs
'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility
'PhanPluginShortArray', // Dolibarr uses array()
'PhanPluginShortArrayList', // Dolibarr uses array()
// The following may require that --quick is not used
// Fixers From PHPDocToRealTypesPlugin:
'PhanPluginCanUseParamType', // Fixer - Report/Add types in the function definition (function abc(string $var) (adds string)
'PhanPluginCanUseReturnType', // Fixer - Report/Add return types in the function definition (function abc(string $var) (adds string)
'PhanPluginCanUseNullableParamType', // Fixer - Report/Add nullable parameter types in the function definition
'PhanPluginCanUseNullableReturnType', // Fixer - Report/Add nullable return types in the function definition
'PhanPluginNonBoolBranch', // Not essential - 31240+ occurrences
'PhanPluginNumericalComparison', // Not essential - 19870+ occurrences
'PhanTypeMismatchArgument', // Not essential - 12300+ occurrences
'PhanPluginNonBoolInLogicalArith', // Not essential - 11040+ occurrences
'PhanPluginConstantVariableScalar', // Not essential - 5180+ occurrences
'PhanPluginDuplicateAdjacentStatement',
'PhanPluginDuplicateConditionalTernaryDuplication', // 2750+ occurrences
'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences
'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning
],
// You can put relative paths to internal stubs in this config option.
// Phan will continue using its detailed type annotations,
// but load the constants, classes, functions, and classes (and their Reflection types)
// from these stub files (doubling as valid php files).
// Use a different extension from php (and preferably a separate folder)
// to avoid accidentally parsing these as PHP (includes projects depending on this).
// The 'mkstubs' script can be used to generate your own stubs (compatible with php 7.0+ right now)
// Note: The array key must be the same as the extension name reported by `php -m`,
// so that phan can skip loading the stubs if the extension is actually available.
'autoload_internal_extension_signatures' => [
// Stubs may be available at https://github.com/JetBrains/phpstorm-stubs/tree/master
// Xdebug stubs are bundled with Phan 0.10.1+/0.8.9+ for usage,
// because Phan disables xdebug by default.
//'xdebug' => 'vendor/phan/phan/.phan/internal_stubs/xdebug.phan_php',
//'memcached' => PHAN_DIR . '/your_internal_stubs_folder_name/memcached.phan_php',
//'PDO' => PHAN_DIR . '/stubs/PDO.phan_php',
'brotli' => PHAN_DIR . '/stubs/brotli.phan_php',
'curl' => PHAN_DIR . '/stubs/curl.phan_php',
'calendar' => PHAN_DIR . '/stubs/calendar.phan_php',
'fileinfo' => PHAN_DIR . '/stubs/fileinfo.phan_php',
'ftp' => PHAN_DIR . '/stubs/ftp.phan_php',
'gd' => PHAN_DIR . '/stubs/gd.phan_php',
'geoip' => PHAN_DIR . '/stubs/geoip.phan_php',
'imap' => PHAN_DIR . '/stubs/imap.phan_php',
'imagick' => PHAN_DIR . '/stubs/imagick.phan_php',
'intl' => PHAN_DIR . '/stubs/intl.phan_php',
'ldap' => PHAN_DIR . '/stubs/ldap.phan_php',
'mcrypt' => PHAN_DIR . '/stubs/mcrypt.phan_php',
'memcache' => PHAN_DIR . '/stubs/memcache.phan_php',
'memcached' => PHAN_DIR . '/stubs/memcached.phan_php',
'mysqli' => PHAN_DIR . '/stubs/mysqli.phan_php',
'pdo_cubrid' => PHAN_DIR . '/stubs/pdo_cubrid.phan_php',
'pdo_mysql' => PHAN_DIR . '/stubs/pdo_mysql.phan_php',
'pdo_pgsql' => PHAN_DIR . '/stubs/pdo_pgsql.phan_php',
'pdo_sqlite' => PHAN_DIR . '/stubs/pdo_sqlite.phan_php',
'pgsql' => PHAN_DIR . '/stubs/pgsql.phan_php',
'session' => PHAN_DIR . '/stubs/session.phan_php',
'simplexml' => PHAN_DIR . '/stubs/SimpleXML.phan_php',
'soap' => PHAN_DIR . '/stubs/soap.phan_php',
'tidy' => PHAN_DIR . '/stubs/tidy.phan_php',
'sockets' => PHAN_DIR . '/stubs/sockets.phan_php',
'zip' => PHAN_DIR . '/stubs/zip.phan_php',
],
];
return $config;

View File

@@ -1,5 +1,7 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* Note: in this context Entity == Company.
*/
class ActionsMulticompany
{
@@ -9,12 +11,83 @@ class ActionsMulticompany
public function __construct($db)
{
}
/** @ver string */
/** @var string */
public $id;
/** @ver string */
/** @var string */
public $label;
/** @var array{stock:string[],referent:string} */
public $sharings;
/** @ver DoliDB */
/** @var DoliDB */
public $db;
/**
* @param string $login
* @param bool $bool1
* @param bool $bool2
* @return array<int,string>
*/
public function getEntitiesList($login = '', $bool1 = false, $bool2 = false)
{
}
/**
* @param string $entity
* @return void
*/
public function getInfo($entity)
{
}
/**
* @param int $id
* @param string $key
* @param string $param_str
* @param bool $bool1
* @param bool $bool2
* @param bool $bool3
* @param bool $bool4
* @param bool $bool5
* @return string */
public function select_entities($id, $key = '', $param_str = '', $bool1 = false, $bool2 = false, $bool3 = false, $bool4 = false, $bool5 = false)
{
}
/**
* @param Conf $conf
* @return void
*/
public function setValues($conf)
{
}
/**
* @param string $element
* @param int<0,1> $shared
* @param ?CommonObject $currentobject
* @return string
*/
public function getEntity($element, $shared = 1, $currentobject = 0)
{
}
/**
* @param CommonObject $currentobject
* @return int
*/
public function setEntity($currentobject)
{
}
/**
* @param int $entityid
* @return int<-1,0>
*/
public function switchEntity($entityid)
{
}
/**
* @param int $id
* @param string $entitytotest
* @return int
*/
public function checkRight($id, $entitytotest)
{
}
}

View File

@@ -437,6 +437,7 @@ CardContent
CardProduct0
CardProduct1
Cards
Cart
CashAccounts
CashDeskBankCB
CashDeskBankCash
@@ -2030,6 +2031,7 @@ Notify_MEMBER_MODIFY
Notify_MEMBER_RESILIATE
Notify_MEMBER_SUBSCRIPTION
Notify_MEMBER_VALIDATE
Notify_ORDER_CANCEL
Notify_ORDER_CLOSE
Notify_ORDER_SENTBYMAIL
Notify_ORDER_SUPPLIER_APPROVE

View File

@@ -45,6 +45,7 @@ IPP_Device
InstallChoiceRecommanded
IsInPackage
MailNoChangePossible
MailSentBy
ModuleBuilderDesc2
ModulesMarketPlaceDesc
MoveField
@@ -403,11 +404,6 @@ EventFee
EventIntoASerie
EventOrganizationArea
EventParticipant
ExampleOnlyForATBEDEITNLESCustomers
ExampleOnlyForBECustomers
ExampleOnlyForDECustomers
ExampleOnlyForKlarnaCustomers
ExampleOnlyForNLCustomers
Expedition
Experimental
Expired
@@ -518,7 +514,6 @@ MO
MRP
MYDATA_AADE_KEY
MYDATA_AADE_USER
Mailman
MainAccountForRevenueStampSaleNotDefined
Manual
Map
@@ -754,18 +749,11 @@ Roles
Rowid
RulesPurchaseTurnoverCollectedOfExpenseAccounts
SID
SOAPError
SPIP
SQL
SQLSort
STATE_
STATE_IPP_
STRIPE_APPLICATION_FEE_PLATFORM
STRIPE_BANCONTACT
STRIPE_GIROPAY
STRIPE_IDEAL
STRIPE_KLARNA
STRIPE_SOFORT
ST_
SaveFailed
Saved

View File

@@ -304,13 +304,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
setEventMessages($db->error(), null, 'errors');
}
}
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
// if (GETPOST('actioncancel', 'alpha')) {
// $_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
// }
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
$rowidcol = "rowid";

View File

@@ -216,20 +216,6 @@ if ($num) {
}
}
print "</table>\n";
print "<br>\n";
/*
* Export model
*/
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("Modelcsv").'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td width="50%">'.$langs->trans("Selectmodelcsv").'</td>';
if (!$conf->use_javascript_ajax) {
@@ -238,12 +224,13 @@ if (!$conf->use_javascript_ajax) {
print "</td>";
} else {
print '<td>';
$listmodelcsv = $accountancyexport->getType();
print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listmodelcsv, getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV'), 0, 0, 0, '', 0, 0, 0, '', '', 1);
$listofexporttemplates = $accountancyexport->getType(1);
print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listofexporttemplates, getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV'), 0, 0, 0, '', 0, 0, 0, '', '', 1);
print '</td>';
}
print "</td></tr>";
print "</table>";
print "<br>\n";

View File

@@ -275,14 +275,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
setEventMessages($db->error(), null, 'errors');
}
}
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
//if (GETPOST('actioncancel', 'alpha'))
//{
// $_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
//}
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
if ($tabrowid[$id]) {
$rowidcol = $tabrowid[$id];

View File

@@ -6,6 +6,7 @@
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Progiseize <a.bisotti@progiseize.fr>
* Copyright (C) 2024 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
@@ -165,7 +166,7 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
$res = $db->query($query);
if ($res->num_rows > 0) {
if ($db->num_rows($res) > 0) {
$fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start);
$search_date_end = strtotime($fiscalYear->date_end);
@@ -321,17 +322,17 @@ if (empty($reshook)) {
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$tmp = dol_getdate($search_date_start);
$param .= '&search_date_startmonth='.urlencode($tmp['mon']).'&search_date_startday='.urlencode($tmp['mday']).'&search_date_startyear='.urlencode($tmp['year']);
$param .= '&search_date_startmonth='.((int) $tmp['mon']).'&search_date_startday='.((int) $tmp['mday']).'&search_date_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$tmp = dol_getdate($search_date_end);
$param .= '&search_date_endmonth='.urlencode($tmp['mon']).'&search_date_endday='.urlencode($tmp['mday']).'&search_date_endyear='.urlencode($tmp['year']);
$param .= '&search_date_endmonth='.((int) $tmp['mon']).'&search_date_endday='.((int) $tmp['mday']).'&search_date_endyear='.((int) $tmp['year']);
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$tmp = dol_getdate($search_doc_date);
$param .= '&doc_datemonth='.urlencode($tmp['mon']).'&doc_dateday='.urlencode($tmp['mday']).'&doc_dateyear='.urlencode($tmp['year']);
$param .= '&doc_datemonth='.((int) $tmp['mon']).'&doc_dateday='.((int) $tmp['mday']).'&doc_dateyear='.((int) $tmp['year']);
}
if (!empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type;
@@ -400,42 +401,42 @@ if (empty($reshook)) {
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start;
$tmp = dol_getdate($search_date_creation_start);
$param .= '&search_date_creation_startmonth='.urlencode($tmp['mon']).'&search_date_creation_startday='.urlencode($tmp['mday']).'&search_date_creation_startyear='.urlencode($tmp['year']);
$param .= '&search_date_creation_startmonth='.((int) $tmp['mon']).'&search_date_creation_startday='.((int) $tmp['mday']).'&search_date_creation_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_creation_end)) {
$filter['t.date_creation<='] = $search_date_creation_end;
$tmp = dol_getdate($search_date_creation_end);
$param .= '&search_date_creation_endmonth='.urlencode($tmp['mon']).'&search_date_creation_endday='.urlencode($tmp['mday']).'&search_date_creation_endyear='.urlencode($tmp['year']);
$param .= '&search_date_creation_endmonth='.((int) $tmp['mon']).'&search_date_creation_endday='.((int) $tmp['mday']).'&search_date_creation_endyear='.((int) $tmp['year']);
}
if (!empty($search_date_modification_start)) {
$filter['t.tms>='] = $search_date_modification_start;
$tmp = dol_getdate($search_date_modification_start);
$param .= '&search_date_modification_startmonth='.urlencode($tmp['mon']).'&search_date_modification_startday='.urlencode($tmp['mday']).'&search_date_modification_startyear='.urlencode($tmp['year']);
$param .= '&search_date_modification_startmonth='.((int) $tmp['mon']).'&search_date_modification_startday='.((int) $tmp['mday']).'&search_date_modification_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_modification_end)) {
$filter['t.tms<='] = $search_date_modification_end;
$tmp = dol_getdate($search_date_modification_end);
$param .= '&search_date_modification_endmonth='.urlencode($tmp['mon']).'&search_date_modification_endday='.urlencode($tmp['mday']).'&search_date_modification_endyear='.urlencode($tmp['year']);
$param .= '&search_date_modification_endmonth='.((int) $tmp['mon']).'&search_date_modification_endday='.((int) $tmp['mday']).'&search_date_modification_endyear='.((int) $tmp['year']);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$tmp = dol_getdate($search_date_export_start);
$param .= '&search_date_export_startmonth='.urlencode($tmp['mon']).'&search_date_export_startday='.urlencode($tmp['mday']).'&search_date_export_startyear='.urlencode($tmp['year']);
$param .= '&search_date_export_startmonth='.((int) $tmp['mon']).'&search_date_export_startday='.((int) $tmp['mday']).'&search_date_export_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$tmp = dol_getdate($search_date_export_end);
$param .= '&search_date_export_endmonth='.urlencode($tmp['mon']).'&search_date_export_endday='.urlencode($tmp['mday']).'&search_date_export_endyear='.urlencode($tmp['year']);
$param .= '&search_date_export_endmonth='.((int) $tmp['mon']).'&search_date_export_endday='.((int) $tmp['mday']).'&search_date_export_endyear='.((int) $tmp['year']);
}
if (!empty($search_date_validation_start)) {
$filter['t.date_validated>='] = $search_date_validation_start;
$tmp = dol_getdate($search_date_validation_start);
$param .= '&search_date_validation_startmonth='.urlencode($tmp['mon']).'&search_date_validation_startday='.urlencode($tmp['mday']).'&search_date_validation_startyear='.urlencode($tmp['year']);
$param .= '&search_date_validation_startmonth='.((int) $tmp['mon']).'&search_date_validation_startday='.((int) $tmp['mday']).'&search_date_validation_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_validation_end)) {
$filter['t.date_validated<='] = $search_date_validation_end;
$tmp = dol_getdate($search_date_validation_end);
$param .= '&search_date_validation_endmonth='.urlencode($tmp['mon']).'&search_date_validation_endday='.urlencode($tmp['mday']).'&search_date_validation_endyear='.urlencode($tmp['year']);
$param .= '&search_date_validation_endmonth='.((int) $tmp['mon']).'&search_date_validation_endday='.((int) $tmp['mday']).'&search_date_validation_endyear='.((int) $tmp['year']);
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
@@ -835,8 +836,11 @@ if ($action == 'export_file') {
$form_question['separator3'] = array('name' => 'separator3', 'type' => 'separator');
}
// add documents in an archive for accountancy export (Quadratus)
if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS) {
// add documents in an archive for some accountancy export format
if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS
|| getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_FEC
|| getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_FEC2
) {
$form_question['notifiedexportfull'] = array(
'name' => 'notifiedexportfull',
'type' => 'checkbox',
@@ -1263,6 +1267,7 @@ while ($i < min($num, $limit)) {
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked'])) {
$documentlink = '';
$objectstatic = null;
if ($line->doc_type == 'customer_invoice') {
$langs->loadLangs(array('bills'));
@@ -1273,7 +1278,7 @@ while ($i < min($num, $limit)) {
if ($objectstatic->id > 0) {
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->invoice->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
}
@@ -1315,7 +1320,7 @@ while ($i < min($num, $limit)) {
$labeltoshow = '';
$labeltoshowalt = '';
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') {
if (($objectstatic instanceof CommonObject) && in_array($line->doc_type, array('customer_invoice', 'supplier_invoice', 'expense_report'))) {
if ($objectstatic->id > 0) {
$labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
$labeltoshow .= $documentlink;

View File

@@ -6,6 +6,7 @@
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Progiseize <a.bisotti@progiseize.fr>
* Copyright (C) 2024 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
@@ -160,7 +161,7 @@ if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('beg
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
$res = $db->query($query);
if ($res->num_rows > 0) {
if ($db->num_rows($res) > 0) {
$fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start);
$search_date_end = strtotime($fiscalYear->date_end);
@@ -309,17 +310,17 @@ if (empty($reshook)) {
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$tmp = dol_getdate($search_date_start);
$param .= '&search_date_startmonth='.urlencode($tmp['mon']).'&search_date_startday='.urlencode($tmp['mday']).'&search_date_startyear='.urlencode($tmp['year']);
$param .= '&search_date_startmonth='.((int) $tmp['mon']).'&search_date_startday='.((int) $tmp['mday']).'&search_date_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$tmp = dol_getdate($search_date_end);
$param .= '&search_date_endmonth='.urlencode($tmp['mon']).'&search_date_endday='.urlencode($tmp['mday']).'&search_date_endyear='.urlencode($tmp['year']);
$param .= '&search_date_endmonth='.((int) $tmp['mon']).'&search_date_endday='.((int) $tmp['mday']).'&search_date_endyear='.((int) $tmp['year']);
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$tmp = dol_getdate($search_doc_date);
$param .= '&doc_datemonth='.urlencode($tmp['mon']).'&doc_dateday='.urlencode($tmp['mday']).'&doc_dateyear='.urlencode($tmp['year']);
$param .= '&doc_datemonth='.((int) $tmp['mon']).'&doc_dateday='.((int) $tmp['mday']).'&doc_dateyear='.((int) $tmp['year']);
}
if (!empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type;
@@ -388,42 +389,42 @@ if (empty($reshook)) {
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start;
$tmp = dol_getdate($search_date_creation_start);
$param .= '&search_date_creation_startmonth='.urlencode($tmp['mon']).'&search_date_creation_startday='.urlencode($tmp['mday']).'&search_date_creation_startyear='.urlencode($tmp['year']);
$param .= '&search_date_creation_startmonth='.((int) $tmp['mon']).'&search_date_creation_startday='.((int) $tmp['mday']).'&search_date_creation_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_creation_end)) {
$filter['t.date_creation<='] = $search_date_creation_end;
$tmp = dol_getdate($search_date_creation_end);
$param .= '&search_date_creation_endmonth='.urlencode($tmp['mon']).'&search_date_creation_endday='.urlencode($tmp['mday']).'&search_date_creation_endyear='.urlencode($tmp['year']);
$param .= '&search_date_creation_endmonth='.((int) $tmp['mon']).'&search_date_creation_endday='.((int) $tmp['mday']).'&search_date_creation_endyear='.((int) $tmp['year']);
}
if (!empty($search_date_modification_start)) {
$filter['t.tms>='] = $search_date_modification_start;
$tmp = dol_getdate($search_date_modification_start);
$param .= '&search_date_modification_startmonth='.urlencode($tmp['mon']).'&search_date_modification_startday='.urlencode($tmp['mday']).'&search_date_modification_startyear='.urlencode($tmp['year']);
$param .= '&search_date_modification_startmonth='.((int) $tmp['mon']).'&search_date_modification_startday='.((int) $tmp['mday']).'&search_date_modification_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_modification_end)) {
$filter['t.tms<='] = $search_date_modification_end;
$tmp = dol_getdate($search_date_modification_end);
$param .= '&search_date_modification_endmonth='.urlencode($tmp['mon']).'&search_date_modification_endday='.urlencode($tmp['mday']).'&search_date_modification_endyear='.urlencode($tmp['year']);
$param .= '&search_date_modification_endmonth='.((int) $tmp['mon']).'&search_date_modification_endday='.((int) $tmp['mday']).'&search_date_modification_endyear='.((int) $tmp['year']);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$tmp = dol_getdate($search_date_export_start);
$param .= '&search_date_export_startmonth='.urlencode($tmp['mon']).'&search_date_export_startday='.urlencode($tmp['mday']).'&search_date_export_startyear='.urlencode($tmp['year']);
$param .= '&search_date_export_startmonth='.((int) $tmp['mon']).'&search_date_export_startday='.((int) $tmp['mday']).'&search_date_export_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$tmp = dol_getdate($search_date_export_end);
$param .= '&search_date_export_endmonth='.urlencode($tmp['mon']).'&search_date_export_endday='.urlencode($tmp['mday']).'&search_date_export_endyear='.urlencode($tmp['year']);
$param .= '&search_date_export_endmonth='.((int) $tmp['mon']).'&search_date_export_endday='.((int) $tmp['mday']).'&search_date_export_endyear='.((int) $tmp['year']);
}
if (!empty($search_date_validation_start)) {
$filter['t.date_validated>='] = $search_date_validation_start;
$tmp = dol_getdate($search_date_validation_start);
$param .= '&search_date_validation_startmonth='.urlencode($tmp['mon']).'&search_date_validation_startday='.urlencode($tmp['mday']).'&search_date_validation_startyear='.urlencode($tmp['year']);
$param .= '&search_date_validation_startmonth='.((int) $tmp['mon']).'&search_date_validation_startday='.((int) $tmp['mday']).'&search_date_validation_startyear='.((int) $tmp['year']);
}
if (!empty($search_date_validation_end)) {
$filter['t.date_validated<='] = $search_date_validation_end;
$tmp = dol_getdate($search_date_validation_end);
$param .= '&search_date_validation_endmonth='.urlencode($tmp['mon']).'&search_date_validation_endday='.urlencode($tmp['mday']).'&search_date_validation_endyear='.urlencode($tmp['year']);
$param .= '&search_date_validation_endmonth='.((int) $tmp['mon']).'&search_date_validation_endday='.((int) $tmp['mday']).'&search_date_validation_endyear='.((int) $tmp['year']);
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
@@ -468,6 +469,7 @@ if (empty($reshook)) {
}
$nbok = 0;
$result = 0;
if (!$error) {
foreach ($toselect as $toselectid) {
$result = $object->fetch($toselectid);

View File

@@ -5,7 +5,7 @@
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2024 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
@@ -116,14 +116,14 @@ class AccountancyExport
/**
* Array with all export type available (key + label)
*
* @return array of type
* @param int $mode Mode of list: 0=flat list, 1=rich list
* @return array of type
*/
public function getType()
public function getType($mode = 0)
{
global $langs, $hookmanager;
$listofexporttypes = array(
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
$listofspecialformatexport = array(
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
@@ -140,17 +140,37 @@ class AccountancyExport
self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'),
self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinumv3'),
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinumv5'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
);
$listofgenericformatexport = array(
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
);
if (empty($mode)) {
$listofexporttypes = $listofgenericformatexport + $listofspecialformatexport;
ksort($listofexporttypes, SORT_NUMERIC);
} else {
ksort($listofspecialformatexport, SORT_NUMERIC);
$listofexporttypes = array();
$i = 0;
foreach ($listofgenericformatexport as $key => $val) {
$i++;
$listofexporttypes[$key] = array('id' => $key, 'label' => $val, 'position' => $i);
}
$listofexporttypes['separator_'.$i] = array('id' => 0, 'label' => '----------------', 'position' => $i, 'disabled' => 'disabled');
foreach ($listofspecialformatexport as $key => $val) {
$i++;
$listofexporttypes[$key] = array('id' => $key, 'label' => $val, 'position' => $i);
}
}
// allow modules to define export formats
$parameters = array();
$reshook = $hookmanager->executeHooks('getType', $parameters, $listofexporttypes);
ksort($listofexporttypes, SORT_NUMERIC);
return $listofexporttypes;
}
@@ -395,11 +415,12 @@ class AccountancyExport
// directory already created when module is enabled
$outputDir .= '/export';
$outputDir .= '/'.dol_sanitizePathName($formatexportset);
if (!dol_is_dir($outputDir)) {
if (dol_mkdir($outputDir) < 0) {
$this->errors[] = $langs->trans('ErrorCanNotCreateDir', $outputDir);
return -1;
}
}
if (!dol_is_dir($outputDir)) {
if (dol_mkdir($outputDir) < 0) {
$this->errors[] = $langs->trans('ErrorCanNotCreateDir', $outputDir);
return -1;
}
}

View File

@@ -77,11 +77,6 @@ class AccountingJournal extends CommonObject
*/
public $active;
/**
* @var AccountingJournal[] array of lines
*/
public $lines;
/**
* @var array Accounting account cached
*/
@@ -159,88 +154,6 @@ class AccountingJournal extends CommonObject
return -1;
}
/**
* Load object in memory from the database
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit limit
* @param int $offset offset limit
* @param string|array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @return int Return integer <0 if KO, >0 if OK
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND')
{
$sql = "SELECT rowid, code, label, nature, active";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE 1 = 1';
$sql .= " AND entity IN (".getEntity('accountancy').")";
// Manage filter
if (is_array($filter)) {
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.code' || $key == 't.label' || $key == 't.nature') {
$sqlwhere[] = $key." = '".$this->db->escape($value)."'";
} elseif ($key == 't.rowid' || $key == 't.active') {
$sqlwhere[] = $key.'='.((int) $value);
}
}
}
if (count($sqlwhere) > 0) {
$sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
}
$filter = '';
}
// Manage filter
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
if ($errormessage) {
$this->errors[] = $errormessage;
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
return -1;
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder);
}
if (!empty($limit)) {
$sql .= $this->db->plimit($limit + 1, $offset);
}
$this->lines = array();
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql)) {
$line = new self($this->db);
$line->id = $obj->rowid;
$line->code = $obj->code;
$line->label = $obj->label;
$line->nature = $obj->nature;
$line->active = $obj->active;
$this->lines[] = $line;
}
$this->db->free($resql);
return $num;
} else {
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
return -1;
}
}
/**
* Return clickable name (with picto eventually)
*
@@ -253,7 +166,7 @@ class AccountingJournal extends CommonObject
*/
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0)
{
global $langs, $conf, $user, $hookmanager;
global $langs, $conf, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips

View File

@@ -507,8 +507,8 @@ if ($result) {
}
print '</td>';
print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
print '<td class="tdoverflowmax200 small" title="'.dol_escape_htmltag($text).'">';
$trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
print '</td>';

View File

@@ -663,8 +663,8 @@ if ($result) {
print '</td>';
// Description of line
print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
print '<td class="tdoverflowmax200 small" title="'.dol_escape_htmltag($text).'">';
$trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
print '</td>';

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -383,7 +384,7 @@ if ($result) {
$userstatic->id = $objp->userid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->status = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;

View File

@@ -5,6 +5,7 @@
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -462,7 +463,7 @@ if ($result) {
$userstatic->id = $objp->userid;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->status = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;

View File

@@ -8,7 +8,7 @@
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
@@ -66,7 +66,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
// Load translation files required by the page
$langs->loadLangs(array("companies", "other", "compta", "banks", "bills", "donations", "loan", "accountancy", "trips", "salaries", "hrm", "members"));
// Multi journal
// Multi journal&search_status=-1
$id_journal = GETPOSTINT('id_journal');
$date_startmonth = GETPOSTINT('date_startmonth');
@@ -393,7 +393,6 @@ if ($result) {
$userstatic->email = $tabuser[$obj->rowid]['email'];
$userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
$userstatic->statut = $tabuser[$obj->rowid]['status'];
$userstatic->status = $tabuser[$obj->rowid]['status'];
$userstatic->accountancy_code = $tabuser[$obj->rowid]['accountancy_code'];
if ($userstatic->id > 0) {
@@ -478,7 +477,7 @@ if ($result) {
$userstatic->email = $tmpsalary->user->email;
$userstatic->firstname = $tmpsalary->user->firstname;
$userstatic->lastname = $tmpsalary->user->lastname;
$userstatic->statut = $tmpsalary->user->status;
$userstatic->status = $tmpsalary->user->status;
$userstatic->accountancy_code = $tmpsalary->user->accountancy_code;
if ($userstatic->id > 0) {
@@ -1139,8 +1138,10 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1'
|| getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1'
|| getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1'
|| getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSERERPORT') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSERERPORT') == '-1') {
|| (isModEnabled("salaries") && (getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1'))
|| (isModEnabled("expensereport") && (getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT') == '-1'))) {
print($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);

View File

@@ -517,8 +517,8 @@ if ($result) {
*/
// Supplier invoice label
print '<td class="tdoverflowonsmartphone small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
print $objp->invoice_label;
print '<td class="tdoverflowmax200 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
print dol_escape_htmltag($objp->invoice_label);
print '</td>';
// Date invoice
@@ -537,8 +537,8 @@ if ($result) {
}
print '</td>';
print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
print '<td class="tdoverflowmax200 small" title="'.dol_escape_htmltag($text).'">';
$trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
print '</td>';

View File

@@ -690,8 +690,8 @@ if ($result) {
print '</td>';
// Description of line
print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
print '<td class="tdoverflowmax200 small" title="'.dol_escape_htmltag($text).'">';
$trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
print '</td>';

View File

@@ -10,6 +10,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2020-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2023 Waël Almoman <info@almoman.com>
* Copyright (C) 2024 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
@@ -286,6 +287,7 @@ foreach ($dirModMember as $dirroot) {
}
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
'@phan-var-force array<string,ModeleNumRefMembers> $arrayofmodules';
foreach ($arrayofmodules as $file => $modCodeMember) {
print '<tr class="oddeven">'."\n";

View File

@@ -1001,7 +1001,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$listetype = $adht->liste_array(1);
print img_picto('', $adht->picto, 'class="pictofixedwidth"');
if (count($listetype)) {
print $form->selectarray("typeid", $listetype, (GETPOSTINT('typeid') ? GETPOSTINT('typeid') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, '', 0, 0, 0, '', '', 1);
print $form->selectarray("typeid", $listetype, (GETPOSTINT('typeid') ? GETPOSTINT('typeid') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, '', 0, 0, 0, '', 'minwidth150', 1);
} else {
print '<span class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</span>';
}
@@ -1122,8 +1122,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Categories
if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
print img_picto('', 'category').$form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, 0, 'parent', 0, 0, 1);
print img_picto('', 'category').$form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}

View File

@@ -674,6 +674,7 @@ class Adherent extends CommonObject
require_once $modfile;
$modname = getDolGlobalString('MEMBER_CODEMEMBER_ADDON');
$modCodeMember = new $modname();
'@phan-var-force ModeleNumRefMembers $modCodeMember';
$this->ref = $modCodeMember->getNextValue($mysoc, $this);
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
@@ -1836,8 +1837,8 @@ class Adherent extends CommonObject
// Possibility to add external linked objects with hooks
$invoice->linked_objects['subscription'] = $subscriptionid;
if (!empty($_POST['other_linked_objects']) && is_array($_POST['other_linked_objects'])) {
$invoice->linked_objects = array_merge($invoice->linked_objects, $_POST['other_linked_objects']);
if (GETPOSTISARRAY('other_linked_objects')) {
$invoice->linked_objects = array_merge($invoice->linked_objects, GETPOST('other_linked_objects', 'array:int'));
}
$result = $invoice->create($user);

View File

@@ -170,7 +170,7 @@ class AdherentStats extends Stats
* Return count of member by status group by adh type, total and average
*
* @param int $numberYears Number of years to scan (0 = all)
* @return array<string,array{label:string,members_draft:int,members_pending:0,members_uptodate:int,members_expired:int,members_excluded:int,members_resiliated:int,all?:float|int,total_adhtag:float|int}> Array with total of draft, pending, uptodate, expired, resiliated for each member type
* @return array<int|string,array{label:string,members_draft:int,members_pending:int,members_uptodate:int,members_expired:int,members_excluded:int,members_resiliated:int,all?:float|int,total_adhtag:float|int}> Array with total of draft, pending, uptodate, expired, resiliated for each member type
*/
public function countMembersByTypeAndStatus($numberYears = 0)
{

View File

@@ -81,7 +81,7 @@ class Members extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('adherent', $member->id) && $id > 0) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($member);
@@ -114,7 +114,7 @@ class Members extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($member);
@@ -153,7 +153,7 @@ class Members extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($member);
@@ -192,7 +192,7 @@ class Members extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($member);
@@ -301,11 +301,11 @@ class Members extends DolibarrApi
foreach ($request_data as $field => $value) {
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$member->context['caller'] = $request_data['caller'];
$member->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
$member->$field = $value;
$member->$field = $this->_checkValForAPI($field, $value, $member);
}
if ($member->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, 'Error creating member', array_merge(array($member->error), $member->errors));
@@ -337,7 +337,7 @@ class Members extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('member', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach ($request_data as $field => $value) {
@@ -346,10 +346,15 @@ class Members extends DolibarrApi
}
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$member->context['caller'] = $request_data['caller'];
$member->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$member->array_options[$index] = $val;
}
continue;
}
// Process the status separately because it must be updated using
// the validate(), resiliate() and exclude() methods of the class Adherent.
if ($field == 'statut') {
@@ -370,7 +375,7 @@ class Members extends DolibarrApi
}
}
} else {
$member->$field = $value;
$member->$field = $this->_checkValForAPI($field, $value, $member);
}
}
@@ -405,7 +410,7 @@ class Members extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('member', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -646,7 +651,7 @@ class Members extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($membertype);
@@ -745,11 +750,11 @@ class Members extends DolibarrApi
foreach ($request_data as $field => $value) {
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$membertype->context['caller'] = $request_data['caller'];
$membertype->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
$membertype->$field = $value;
$membertype->$field = $this->_checkValForAPI($field, $value, $membertype);
}
if ($membertype->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, 'Error creating member type', array_merge(array($membertype->error), $membertype->errors));
@@ -783,7 +788,7 @@ class Members extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach ($request_data as $field => $value) {
@@ -792,13 +797,13 @@ class Members extends DolibarrApi
}
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$membertype->context['caller'] = $request_data['caller'];
$membertype->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
// Process the status separately because it must be updated using
// the validate(), resiliate() and exclude() methods of the class AdherentType.
$membertype->$field = $value;
$membertype->$field = $this->_checkValForAPI($field, $value, $membertype);
}
// If there is no error, update() returns the number of affected rows
@@ -834,7 +839,7 @@ class Members extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$res = $membertype->delete(DolibarrApiAccess::$user);

View File

@@ -161,11 +161,11 @@ class Subscriptions extends DolibarrApi
foreach ($request_data as $field => $value) {
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$subscription->context['caller'] = $request_data['caller'];
$subscription->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
$subscription->$field = $value;
$subscription->$field = $this->_checkValForAPI($field, $value, $subscription);
}
if ($subscription->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors));
@@ -202,11 +202,11 @@ class Subscriptions extends DolibarrApi
}
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$subscription->context['caller'] = $request_data['caller'];
$subscription->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
$subscription->$field = $value;
$subscription->$field = $this->_checkValForAPI($field, $value, $subscription);
}
if ($subscription->update(DolibarrApiAccess::$user) > 0) {

View File

@@ -421,11 +421,11 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscripti
// Clean some POST vars
if (!$error) {
$_POST["subscription"] = '';
$_POST["accountid"] = '';
$_POST["operation"] = '';
$_POST["label"] = '';
$_POST["num_chq"] = '';
$accountid = '';
$operation = '';
$label = '';
$num_chq = '';
$option = '';
}
}
}

View File

@@ -137,6 +137,7 @@ if ($action == 'set') {
require_once $file;
$module = new $classname($db, $commande);
'@phan-var-force pdf_standard_actions $module';
if ($module->write_file($commande, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");

View File

@@ -100,6 +100,7 @@ if ($action == 'set') {
require_once $file;
$module = new $classname($db, $commande);
'@phan-var-force pdf_standard_actions $module';
if ($module->write_file($commande, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");

View File

@@ -145,6 +145,7 @@ if ($action == 'specimen') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModeleBankAccountDoc $module';
if ($module->write_file($object, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf");

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 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
@@ -189,7 +190,7 @@ foreach ($dirbarcode as $reldir) {
}
}
}
'@phan-var-force array<string,ModeleBarCode> $barcodelist';
// Select barcode numbering module
@@ -224,6 +225,7 @@ if (isModEnabled('product')) {
}
$modBarCode = new $file();
'@phan-var-force ModeleNumRefBarCode $modBarCode';
print '<tr class="oddeven">';
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";

View File

@@ -90,6 +90,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModelePDFBom $module';
if ($module->write_file($bom, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bom&file=SPECIMEN.pdf");

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2024 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
@@ -151,6 +152,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.$filebis;
$module = new $classname($db);
'@phan-var-force ModeleNumRefChequeReceipts $module';
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -100,6 +100,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModelePDFCommandes $module';
if ($module->write_file($commande, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");

View File

@@ -281,8 +281,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
}
if ($action == 'addthumb' || $action == 'addthumbsquarred') { // Regenerate thumbs
if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"])) {
$isimage = image_format_supported($_GET["file"]);
if (file_exists($conf->mycompany->dir_output.'/logos/'.GETPOST("file"))) {
$isimage = image_format_supported(GETPOST("file"));
// Create thumbs of logo
if ($isimage > 0) {
@@ -297,7 +297,7 @@ if ($action == 'addthumb' || $action == 'addthumbsquarred') { // Regenerate thu
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get...
// Create small thumb. Used on logon for example
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small', $quality);
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.GETPOST("file"), $maxwidthsmall, $maxheightsmall, '_small', $quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
$imgThumbSmall = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
@@ -306,7 +306,7 @@ if ($action == 'addthumb' || $action == 'addthumbsquarred') { // Regenerate thu
}
// Create mini thumbs. Used on menu or for setup page for example
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini', $quality);
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.GETPOST("file"), $maxwidthmini, $maxheightmini, '_mini', $quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
$imgThumbMini = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
@@ -642,7 +642,7 @@ print '<input name="capital" id="capital" class="maxwidth100" value="'.dol_escap
// Juridical Status
print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
if ($mysoc->country_code) {
print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
print $formcompany->select_juridicalstatus(getDolGlobalString('MAIN_INFO_SOCIETE_FORME_JURIDIQUE'), $mysoc->country_code, '', 'forme_juridique_code');
} else {
print $countrynotdefined;
}
@@ -760,12 +760,12 @@ if ($langs->transcountry("ProfId10", $mysoc->country_code) != '-') {
// Intra-community VAT number
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_TVAINTRA') ? $conf->global->MAIN_INFO_TVAINTRA : '').'">';
print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_TVAINTRA')).'">';
print '</td></tr>';
// Object of the company
print '<tr class="oddeven"><td><label for="socialobject">'.$langs->trans("CompanyObject").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="socialobject" id="socialobject" rows="'.ROWS_5.'">'.(getDolGlobalString('MAIN_INFO_SOCIETE_OBJECT') ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
print '<textarea class="flat quatrevingtpercent" name="socialobject" id="socialobject" rows="'.ROWS_5.'">'.(getDolGlobalString('MAIN_INFO_SOCIETE_OBJECT')).'</textarea></td></tr>';
print '</td></tr>';
print '</table>';
@@ -882,7 +882,7 @@ if ($mysoc->useLocalTax(2)) {
$tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i>\n" : "");
if (!isOnlyOneLocalTax(2)) {
print '<br><label for="lt2">'.$langs->trans("LTRate").'</label>: ';
$formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2");
$formcompany->select_localtax(2, getDolGlobalString('MAIN_INFO_VALUE_LOCALTAX2'), "lt2");
}
print '<br><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
print $form->selectarray("clt2", $opcions, getDolGlobalString('MAIN_INFO_LOCALTAX_CALC2'));

View File

@@ -96,6 +96,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModelePDFContract $module';
if ($module->write_file($contract, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=contract&file=SPECIMEN.pdf");

View File

@@ -145,6 +145,7 @@ if ($action == 'specimen') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModelePDFDeliveryOrder $module';
if ($module->write_file($sending, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=delivery&file=SPECIMEN.pdf");

View File

@@ -116,6 +116,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModelePdfExpedition $module';
if ($module->write_file($exp, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expedition&file=SPECIMEN.pdf");

View File

@@ -97,6 +97,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModeleExpenseReport $module';
if ($module->write_file($expensespecimen, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expensereport&file=SPECIMEN.pdf");

View File

@@ -7,6 +7,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2024 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
@@ -280,7 +281,7 @@ if ($resql) {
print '<tr class="oddeven">';
print "<td>".$langs->trans("Status")."</td>";
print "<td>";
if ($result > 0 && empty($rss->error)) {
if ($result > 0 && empty($rssparser->error)) {
print '<span class="ok">'.$langs->trans("Online").'</div>';
} else {
print '<span class="error">'.$langs->trans("Offline");

View File

@@ -96,6 +96,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModelePDFFicheinter $module';
if ($module->write_file($inter, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");

View File

@@ -96,6 +96,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($holiday, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf");

View File

@@ -140,6 +140,7 @@ if ($action == 'update') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");

View File

@@ -113,6 +113,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($facture, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf");

View File

@@ -123,6 +123,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $className($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");

View File

@@ -293,7 +293,7 @@ show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
if (function_exists("ldap_connect")) {
if ($_GET["action"] == 'test') {
if ($action == 'test') {
// Create object
$object = new Contact($db);
$object->initAsSpecimen();

View File

@@ -444,7 +444,7 @@ if (getDolGlobalString('LDAP_MEMBER_ACTIVE')) {
}
if (function_exists("ldap_connect")) {
if ($_GET["action"] == 'testmember') {
if ($action == 'testmember') {
// Create object
$object = new Adherent($db);
$object->initAsSpecimen();

View File

@@ -200,7 +200,7 @@ if (getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDA
}
if (function_exists("ldap_connect")) {
if ($_GET["action"] == 'testmembertype') {
if ($action == 'testmembertype') {
// Create object
$object = new AdherentType($db);
$object->initAsSpecimen();

View File

@@ -80,7 +80,7 @@ if ($action == 'update' || $action == 'add') {
// Action to activate a submodule of the 'adherent' module
if ($action == 'set') {
$result = dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity);
$result = dolibarr_set_const($db, GETPOST("name", 'aZ09'), GETPOST("value"), '', 0, '', $conf->entity);
if ($result < 0) {
dol_print_error($db);
}
@@ -88,7 +88,7 @@ if ($action == 'set') {
// Action to deactivate a submodule of the 'adherent' module
if ($action == 'unset') {
$result = dolibarr_del_const($db, $_GET["name"], $conf->entity);
$result = dolibarr_del_const($db, GETPOST("name", 'aZ09'), $conf->entity);
if ($result < 0) {
dol_print_error($db);
}

View File

@@ -1041,7 +1041,7 @@ foreach ($fieldlist as $field => $value) {
}
$sortfieldtouse = ($sortable ? $fieldlist[$field] : '');
if ($sortfieldtouse == 'type_template') {
$sortfieldtouse .= 'type_template,lang,position,label';
$sortfieldtouse .= ',lang,position,label';
}
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], $sortfieldtouse, ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $css.' ');
}

View File

@@ -30,7 +30,7 @@
* \brief Page to activate/disable all modules
*/
if (!defined('CSRFCHECK_WITH_TOKEN') && (empty($_GET['action']) || $_GET['action'] != 'reset')) { // We force security except to disable modules so we can do it if problem of a module
if (!defined('CSRFCHECK_WITH_TOKEN') && (empty($_GET['action']) || $_GET['action'] != 'reset')) { // We force security except to disable modules so we can do it if a problem occurs on a module
define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
}
@@ -361,13 +361,17 @@ llxHeader('', $langs->trans("Setup"), $help_url, '', '', '', $morejs, $morecss,
// Search modules dirs
$modulesdir = dolGetModulesDirs();
$arrayofnatures = array('core' => $langs->transnoentitiesnoconv("NativeModules"), 'external' => $langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
$arrayofnatures = array(
'core' => array('label' => $langs->transnoentitiesnoconv("NativeModules")),
'external' => array('label' => $langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']')
);
$arrayofwarnings = array(); // Array of warning each module want to show when activated
$arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module
$filename = array();
$modules = array();
$orders = array();
$categ = array();
$publisherlogoarray = array();
$i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined.
@@ -427,9 +431,16 @@ foreach ($modulesdir as $dir) {
$external = ($objMod->isCoreOrExternalModule() == 'external');
if ($external) {
if ($publisher) {
$arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
// Check if there is a logo forpublisher
/* Do not show the company logo in combo. Make combo list dirty.
if (!empty($objMod->editor_squarred_logo)) {
$publisherlogoarray['external_'.$publisher] = img_picto('', $objMod->editor_squarred_logo, 'class="publisherlogoinline"');
}
$publisherlogo = empty($publisherlogoarray['external_'.$publisher]) ? '' : $publisherlogoarray['external_'.$publisher];
*/
$arrayofnatures['external_'.$publisher] = array('label' => $langs->trans("External").' - '.$publisher, 'data-html' => $langs->trans("External").' - <span class="opacitymedium inine-block valignmiddle">'.$publisher.'</span>');
} else {
$arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
$arrayofnatures['external_'] = array('label' => $langs->trans("External").' - ['.$langs->trans("UnknownPublishers").']');
}
}
ksort($arrayofnatures);
@@ -641,7 +652,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '</div>';
$moreforfilter .= ' ';
$moreforfilter .= '<div class="divsearchfield valignmiddle inline-block">';
$moreforfilter .= '<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
$moreforfilter .= '<input type="submit" name="buttonsubmit" class="button small nomarginleft" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
if ($search_keyword || ($search_nature && $search_nature != '-1') || ($search_version && $search_version != '-1') || ($search_status && $search_status != '-1')) {
$moreforfilter .= ' ';
$moreforfilter .= '<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
@@ -864,6 +875,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if (!empty($objMod->disabled)) {
$codeenabledisable .= $langs->trans("Disabled");
} elseif (!empty($objMod->always_enabled) || ((isModEnabled('multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
// @phan-suppress-next-line PhanUndeclaredMethodCall
if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
$codeenabledisable .= $langs->trans("Used");
} else {
@@ -874,6 +886,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$disableSetup++;
}
} else {
// @phan-suppress-next-line PhanUndeclaredMethodCall
if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.urlencode($objMod->warnings_unactivation[$mysoc->country_code]).'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');

View File

@@ -91,6 +91,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($mo, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mrp&file=SPECIMEN.pdf");

View File

@@ -189,35 +189,25 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvalue">';
print '<div class="div-table-responsive">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationEMailFrom").'</td>';
print '<td>';
print img_picto('', 'email', 'class="pictofixedwidth"');
print '<input class="width150 quatrevingtpercentminusx" type="email" name="email_from" value="'.getDolGlobalString('NOTIFICATION_EMAIL_FROM').'">';
if (getDolGlobalString('NOTIFICATION_EMAIL_FROM') && !isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) {
if (getDolGlobalString('NOTIFICATION_EMAIL_FROM') && !isValidEmail(getDolGlobalString('NOTIFICATION_EMAIL_FROM'))) {
print ' '.img_warning($langs->trans("ErrorBadEMail"));
}
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessageContact").'</td>';
print '<td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT", $arrval, getDolGlobalString('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT'));
}
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessageUser").'</td>';
@@ -231,6 +221,20 @@ if ($conf->use_javascript_ajax) {
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessageContact").'</td>';
print '<td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT", $arrval, getDolGlobalString('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT'));
}
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationDisableConfirmMessageFix").'</td>';
print '<td>';
@@ -242,6 +246,8 @@ if ($conf->use_javascript_ajax) {
}
print '</td>';
print '</tr>';
print '</table>';
print '</div>';

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2024 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
@@ -154,6 +155,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.$filebis;
$module = new $classname($db);
'@phan-var-force ModeleNumRefPayments $module';
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -204,7 +204,7 @@ if ($result) {
// Show break line
print '<tr class="oddeven trforbreak">';
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
print '<td class="maxwidthonsmartphone tdoverflowmax200" title="'.dol_escape_htmltag($objMod->getName()).'">';
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
print '<a name="'.$objMod->getName().'"></a>';
print '</td>';
@@ -222,7 +222,7 @@ if ($result) {
print '<tr class="oddeven">';
// Picto and label of module
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
print '<td class="maxwidthonsmartphone tdoverflowmax200">';
//print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
print '</td>';

View File

@@ -96,6 +96,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($propal, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf");

View File

@@ -64,6 +64,7 @@ if (!function_exists('gzdecode')) {
*
* @param string $data data to deflate
* @return string data deflated
* @phan-suppress PhanRedefineFunctionInternal
*/
function gzdecode($data)
{

View File

@@ -119,6 +119,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($exp, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=reception&file=SPECIMEN.pdf");

View File

@@ -207,6 +207,7 @@ if (is_resource($handle)) {
require_once $dir.'/'.$file;
$obj = new $classname($db, $conf, $langs, $user);
'@phan-var-force ModeleGenPassword $obj';
$arrayhandler[$obj->id] = $obj;
$i++;
}

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 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
@@ -86,7 +87,7 @@ if ($action == 'updateform') {
if (!preg_match('/^0/', $tmpumask)) {
$tmpumask = '0'.$tmpumask;
}
if (empty($tmpumask) || $tmpumask === '0') {
if (empty($tmpumask)) { // Also matches '0'
$tmpumask = '0664';
}

View File

@@ -82,7 +82,7 @@ if ($action == 'update' || $action == 'add') {
// Action activation d'un sous module du module adherent
if ($action == 'set') {
$result = dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity);
$result = dolibarr_set_const($db, GETPOST("name", 'aZ09'), GETPOST("value"), '', 0, '', $conf->entity);
if ($result < 0) {
dol_print_error($db);
}
@@ -90,7 +90,7 @@ if ($action == 'set') {
// Action deactivation d'un sous module du module adherent
if ($action == 'unset') {
$result = dolibarr_del_const($db, $_GET["name"], $conf->entity);
$result = dolibarr_del_const($db, GETPOST("name", 'aZ09'), $conf->entity);
if ($result < 0) {
dol_print_error($db);
}

View File

@@ -123,6 +123,7 @@ if ($action == 'specimen') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($object, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=stock&file=SPECIMEN.pdf");
@@ -585,6 +586,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.'/'.$file;
$module = new $classname($db);
'@phan-var-force ModelePDFStock $module';
$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -105,6 +105,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");

View File

@@ -116,6 +116,7 @@ if ($action == 'specimen') { // For invoices
require_once $file;
$module = new $classname($db, $facture);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($facture, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");

View File

@@ -106,6 +106,7 @@ if ($action == 'specimen') { // For orders
require_once $file;
$module = new $classname($db, $commande);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($commande, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");

View File

@@ -117,6 +117,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($paiementFourn, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_payment&file=SPECIMEN.pdf");

View File

@@ -95,6 +95,7 @@ if ($action == 'specimen') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($supplier_proposal, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_proposal&file=SPECIMEN.pdf");
@@ -261,6 +262,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.'/'.$file.'.php';
$module = new $file();
'@phan-var-force ModeleNumRefSupplierProposal $module';
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@@ -393,6 +395,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.'/'.$file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 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
@@ -63,6 +64,7 @@ foreach ($dirsyslogs as $reldir) {
require_once $newdir.$file.'.php';
$module = new $file();
'@phan-var-force LogHandler $module';
// Show modules according to features level
if ($module->getVersion() == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@@ -96,6 +98,7 @@ if ($action == 'set') {
foreach ($syslogModules as $syslogHandler) {
if (in_array($syslogHandler, $syslogModules)) {
$module = new $syslogHandler();
'@phan-var-force LogHandler $module';
if (in_array($syslogHandler, $selectedModules)) {
$newActiveModules[] = $syslogHandler;
@@ -118,6 +121,7 @@ if ($action == 'set') {
// Check configuration
foreach ($activeModules as $modulename) {
$module = new $modulename();
'@phan-var-force LogHandler $module';
$res = $module->checkConfiguration();
if (!$res) {
$error++;
@@ -210,6 +214,7 @@ print "</tr>\n";
foreach ($syslogModules as $moduleName) {
$module = new $moduleName();
'@phan-var-force LogHandler $module';
$moduleactive = (int) $module->isActive();
//print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)."<br>\n";

View File

@@ -115,6 +115,7 @@ foreach ($modulesdir as $dir) {
if (class_exists($modName)) {
try {
$objMod = new $modName($db);
'@phan-var-force DolibarrModules $objMod';
$modules[$objMod->numero] = $objMod;
$modules_files[$objMod->numero] = $file;
@@ -132,6 +133,7 @@ foreach ($modulesdir as $dir) {
closedir($handle);
}
}
'@phan-var-force array<string,DolibarrModules> $modules';
// create pre-filtered list for modules
foreach ($modules as $key => $module) {

View File

@@ -115,7 +115,7 @@ if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) {
print '</td></tr>';
print '<tr><td>GET and POST support</td><td>';
if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["mainmenu"])) { // We must keep $_GET and $_POST here
if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["mainmenu"])) { // We must keep $_GET and $_POST here. This is a specific test.
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("PHPSupportPOSTGETKo");
print ' (<a href="'.$_SERVER["PHP_SELF"].'?testget=ok">'.$langs->trans("Recheck").'</a>)';
} else {

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2022-2023 Udo Tamm <dev@dolibit.de>
* Copyright (C) 2023 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2024 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
@@ -289,6 +290,7 @@ foreach ($dirmodels as $reldir) {
include_once $dir.'/'.$file.'.php';
$module = new $file();
'@phan-var-force ModeleNumRefTicket $module';
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@@ -423,6 +425,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.'/'.$file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -166,7 +166,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans("ImportMySqlCommand", $command, ($showpass ? $paramclear : $paramcrypted)).'</textarea><br>';
print ajax_autoselect('restorecommand');
if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) {
if (!GETPOST("showpass") && $dolibarr_main_db_pass) {
print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=mysql_options">'.$langs->trans("UnHidePassword").'</a>';
}
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
@@ -205,8 +205,6 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<br>';
print '<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans("ImportPostgreSqlCommand", $command, ($showpass ? $paramclear : $paramcrypted)).'</textarea><br>';
print ajax_autoselect('restorecommand');
//if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>';
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
print '</div>';
print '<br>';

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 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
@@ -299,22 +300,22 @@ if ($result) {
$param .= '&search_prefix_session='.urlencode($search_prefix_session);
}
if ($date_startmonth) {
$param .= "&date_startmonth=".urlencode($date_startmonth);
$param .= "&date_startmonth=".((int) $date_startmonth);
}
if ($date_startday) {
$param .= "&date_startday=".urlencode($date_startday);
$param .= "&date_startday=".((int) $date_startday);
}
if ($date_startyear) {
$param .= "&date_startyear=".urlencode($date_startyear);
$param .= "&date_startyear=".((int) $date_startyear);
}
if ($date_endmonth) {
$param .= "&date_endmonth=".urlencode($date_endmonth);
$param .= "&date_endmonth=".((int) $date_endmonth);
}
if ($date_endday) {
$param .= "&date_endday=".urlencode($date_endday);
$param .= "&date_endday=".((int) $date_endday);
}
if ($date_endyear) {
$param .= "&date_endyear=".urlencode($date_endyear);
$param .= "&date_endyear=".((int) $date_endyear);
}
$center = '';

View File

@@ -7,6 +7,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 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
@@ -246,6 +247,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.'/'.$file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 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
@@ -169,6 +170,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.'/'.$file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -257,7 +257,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
$sql .= ",";
}
$sql .= $field."=";
if ($_POST[$listfieldvalue[$i]] == '') {
if (GETPOST($listfieldvalue[$i]) == '') {
$sql .= "null";
} else {
$sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'";
@@ -300,11 +300,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
$db->rollback();
}
}
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
if (GETPOST('actioncancel', 'alpha')) {
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete

View File

@@ -107,6 +107,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
@@ -260,6 +261,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
require_once $dir.'/'.$file.'.php';
$module = new $file($db);
'@phan-var-force CommonNumRefGenerator $module';
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@@ -399,6 +401,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
require_once $dir.'/'.$file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -150,7 +150,7 @@ print ' '.$langs->trans("Example").': '.$langs->trans("IPListExample");
print '</td>';
print '<td><input type="text" name="API_RESTRICT_ON_IP" value="'.dol_escape_htmltag(getDolGlobalString('API_RESTRICT_ON_IP')).'"></td>';
print '<td>';
print '<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></td>';
print '<input type="submit" class="button button-save small" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></td>';
print '</td>';
print '</tr>';

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 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
@@ -73,8 +74,6 @@ class DolibarrApi
/**
* Check and convert a string depending on its type/name.
*
* Display a short message an return a http code 200
*
* @param string $field Field name
* @param string|array $value Value to check/clean
* @param Object $object Object
@@ -84,16 +83,45 @@ class DolibarrApi
{
// phpcs:enable
if (!is_array($value)) {
// TODO Use type detected in $object->fields if $object known and we can
// Sanitize the value using its type declared into ->fields of $object
if (!empty($object->fields) && !empty($object->fields[$field]) && !empty($object->fields[$field]['type'])) {
if (strpos($object->fields[$field]['type'], 'int') || strpos($object->fields[$field]['type'], 'double') || in_array($object->fields[$field]['type'], array('real', 'price', 'stock'))) {
return sanitizeVal($value, 'int');
}
if ($object->fields[$field]['type'] == 'html') {
return sanitizeVal($value, 'restricthtml');
}
if ($object->fields[$field]['type'] == 'select') {
// Check values are in the list of possible 'options'
// TODO
}
if ($object->fields[$field]['type'] == 'sellist' || $object->fields[$field]['type'] == 'checkbox') {
// TODO
}
if ($object->fields[$field]['type'] == 'boolean' || $object->fields[$field]['type'] == 'radio') {
// TODO
}
if ($object->fields[$field]['type'] == 'email') {
return sanitizeVal($value, 'email');
}
if ($object->fields[$field]['type'] == 'password') {
return sanitizeVal($value, 'none');
}
// Others will use 'alphanohtml'
}
if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) {
return sanitizeVal($value, 'restricthtml');
} else {
return sanitizeVal($value, 'alphanohtml');
}
} else {
// TODO Recall _checkValForAPI for each element of array
} else { // Example when $field = 'extrafields' and $value = content of $object->array_options
$newarrayvalue = array();
foreach ($value as $tmpkey => $tmpvalue) {
$newarrayvalue[$tmpkey] = $this->_checkValForAPI($tmpkey, $tmpvalue, $object);
}
return $value;
return $newarrayvalue;
}
}
@@ -107,16 +135,41 @@ class DolibarrApi
*/
protected function _filterObjectProperties($object, $properties)
{
// phpcs:enable
// If properties is empty, we return all properties
if (empty($properties)) {
return $object;
}
// Else we filter properties
// Copy of exploded array for efficiency
$arr_properties = explode(',', $properties);
$magic_properties = array();
$real_properties = get_object_vars($object);
// Unsetting real properties may unset magic properties.
// We keep a copy of the requested magic properties
foreach ($arr_properties as $key) {
if (!array_key_exists($key, $real_properties)) {
// Not a real property,
// check if $key is a magic property (we want to keep '$obj->$key')
if (property_exists($object, $key) && isset($object->$key)) {
$magic_properties[$key] = $object->$key;
}
}
}
// Filter real properties (may indirectly unset magic properties)
foreach (get_object_vars($object) as $key => $value) {
if (!in_array($key, explode(',', $properties))) {
if (!in_array($key, $arr_properties)) {
unset($object->$key);
}
}
// Restore the magic properties
foreach ($magic_properties as $key => $value) {
$object->$key = $value;
}
return $object;
}

View File

@@ -106,7 +106,7 @@ class DolibarrApiAccess implements iAuthenticate
// api key can be provided in url with parameter api_key=xxx or ni header with header DOLAPIKEY:xxx
$api_key = '';
if (isset($_GET['api_key'])) { // For backward compatibility
if (isset($_GET['api_key'])) { // For backward compatibility. Keep $_GET here.
// TODO Add option to disable use of api key on url. Return errors if used.
$api_key = $_GET['api_key'];
}

View File

@@ -167,6 +167,7 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
$refreshcache = true;
if (!is_writable($conf->api->dir_temp)) {
print 'Erreur temp dir api/temp not writable';
header('HTTP/1.1 500 temp dir api/temp not writable');
exit(0);
}
}

View File

@@ -119,6 +119,7 @@ if ($action == 'updateMask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
@@ -232,6 +233,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
require_once $dir.'/'.$file.'.php';
$module = new $file($db);
'@phan-var-force CommonNumRefGenerator $module';
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@@ -371,6 +373,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
require_once $dir.'/'.$file;
$module = new $classname($db);
'@phan-var-force CommonDocGenerator $module';
$modulequalified = 1;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@@ -194,8 +194,6 @@ if ($action == 'create') {
print dol_get_fiche_head(array(), '');
// Set some default values
//if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
print '<table class="border centpercent tableforfieldcreate">'."\n";

View File

@@ -158,7 +158,7 @@ class Asset extends CommonObject
public $status;
/**
* @var Asset object oldcopy
* @var static object oldcopy
*/
public $oldcopy;

View File

@@ -180,8 +180,6 @@ if ($action == 'create') {
print dol_get_fiche_head(array(), '');
// Set some default values
//if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
print '<table class="border centpercent tableforfieldcreate">' . "\n";

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2014-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 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
@@ -86,6 +87,7 @@ if (getDolGlobalString('BARCODE_THIRDPARTY_ADDON_NUM')) {
}
$modBarCodeThirdparty = new $file();
'@phan-var-force ModeleNumRefBarCode $module';
break;
}
}
@@ -190,6 +192,7 @@ if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) {
}
$modBarCodeProduct = new $file();
'@phan-var-force ModeleNumRefBarCode $module';
break;
}
}

View File

@@ -24,6 +24,7 @@
* \brief Page to print sheets with barcodes using the document templates into core/modules/printsheets
*/
// Do not use GETPOST, the function does not exists yet.
if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must not renew the token.
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
@@ -179,6 +180,7 @@ if (empty($reshook)) {
// Load barcode class for generating barcode image
$classname = "mod".ucfirst($generator);
$module = new $classname($db);
'@phan-var-force ModeleBarCode $module';
if ($generator != 'tcpdfbarcode') {
// May be phpbarcode
$template = 'standardlabel';

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2017-2018 Laurent Destailleur <eldy@destailleur.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 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
@@ -349,25 +350,25 @@ if ($search_fk_user > 0) {
$param .= '&search_fk_user='.urlencode($search_fk_user);
}
if ($search_startyear > 0) {
$param .= '&search_startyear='.urlencode($search_startyear);
$param .= '&search_startyear='.((int) $search_startyear);
}
if ($search_startmonth > 0) {
$param .= '&search_startmonth='.urlencode($search_startmonth);
$param .= '&search_startmonth='.((int) $search_startmonth);
}
if ($search_startday > 0) {
$param .= '&search_startday='.urlencode($search_startday);
$param .= '&search_startday='.((int) $search_startday);
}
if ($search_endyear > 0) {
$param .= '&search_endyear='.urlencode((string) ($search_endyear));
$param .= '&search_endyear='.((int) $search_endyear);
}
if ($search_endmonth > 0) {
$param .= '&search_endmonth='.urlencode((string) ($search_endmonth));
$param .= '&search_endmonth='.((int) $search_endmonth);
}
if ($search_endday > 0) {
$param .= '&search_endday='.urlencode((string) ($search_endday));
$param .= '&search_endday='.((int) $search_endday);
}
if ($search_showonlyerrors > 0) {
$param .= '&search_showonlyerrors='.urlencode((string) ($search_showonlyerrors));
$param .= '&search_showonlyerrors='.((int) $search_showonlyerrors);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);

View File

@@ -371,13 +371,13 @@ class BlockedLog
}
/**
* Populate properties of log from object data
* Populate properties of log from object data
*
* @param Object $object object to store
* @param string $action action
* @param string $amounts amounts
* @param User $fuser User object (forced)
* @return int >0 if OK, <0 if KO
* @param CommonObject $object object to store
* @param string $action action
* @param string $amounts amounts
* @param ?User $fuser User object (forced)
* @return int >0 if OK, <0 if KO
*/
public function setObjectData(&$object, $action, $amounts, $fuser = null)
{
@@ -1096,7 +1096,7 @@ class BlockedLog
* @param string $search_ref search ref
* @param string $search_amount search amount
* @param string $search_code search code
* @return array|int Array of object log or <0 if error
* @return BlockedLog[]|int<-2,-1> Array of object log or <0 if error
*/
public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '')
{

View File

@@ -164,7 +164,7 @@ if (empty($reshook)) {
$idprod = $bom_child->fk_product;
}
} else {
$idprod = (!empty(GETPOSTINT('idprodservice')) ? GETPOSTINT('idprodservice') : GETPOSTINT('idprod'));
$idprod = (GETPOSTINT('idprodservice') ? GETPOSTINT('idprodservice') : GETPOSTINT('idprod'));
}
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');

View File

@@ -196,11 +196,11 @@ class Boms extends DolibarrApi
foreach ($request_data as $field => $value) {
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$this->bom->context['caller'] = $request_data['caller'];
$this->bom->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
$this->bom->$field = $value;
$this->bom->$field = $this->_checkValForAPI($field, $value, $this->bom);
}
$this->checkRefNumbering();
@@ -243,11 +243,18 @@ class Boms extends DolibarrApi
}
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
$this->bom->context['caller'] = $request_data['caller'];
$this->bom->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
$this->bom->$field = $value;
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->bom->array_options[$index] = $this->_checkValForAPI('extrafields', $val, $this->bom);
}
continue;
}
$this->bom->$field = $this->_checkValForAPI($field, $value, $this->bom);
}
$this->checkRefNumbering();
@@ -280,7 +287,7 @@ class Boms extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('bom', $this->bom->id, 'bom_bom')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (!$this->bom->delete(DolibarrApiAccess::$user)) {
@@ -531,6 +538,14 @@ class Boms extends DolibarrApi
unset($object->fk_incoterms);
unset($object->label_incoterms);
unset($object->location_incoterms);
unset($object->multicurrency_code);
unset($object->multicurrency_tx);
unset($object->multicurrency_total_ht);
unset($object->multicurrency_total_ttc);
unset($object->multicurrency_total_tva);
unset($object->multicurrency_total_localtax1);
unset($object->multicurrency_total_localtax2);
// If object has lines, remove $db property
if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {

View File

@@ -196,11 +196,11 @@ if ($filtertype != 1) {
print '</td>';
}
$coldisplay += $colspan;
print '<td class="bordertop nobottom linecoledit center valignmiddle" colspan="' . $colspan . '">';
print '<input type="submit" class="button button-add" name="addline" id="addline" value="' . $langs->trans('Add') . '">';
print '</td>';
print '</tr>';
$coldisplay += $colspan;
print '<td class="bordertop nobottom linecoledit right valignmiddle" colspan="' . $colspan . '">';
print '<input type="submit" class="button button-add small" name="addline" id="addline" value="' . $langs->trans('Add') . '">';
print '</td>';
print '</tr>';
?>

View File

@@ -351,11 +351,12 @@ if ($resql) {
print '<span class="amount">'.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * (float) $line->qty, 'MT')).'</span></td>';
$total_cost .= $sub_bom_product->pmp * $sub_bom_line->qty * (float) $line->qty;
} else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql_supplier_price .= ' WHERE fk_product = '. (int) $sub_bom_product->id;
$sql_supplier_price = "SELECT MIN(price) AS min_price, quantity AS qty FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql_supplier_price .= " WHERE fk_product = ". (int) $sub_bom_product->id;
$sql_supplier_price .= " GROUP BY quantity ORDER BY quantity ASC";
$resql_supplier_price = $object->db->query($sql_supplier_price);
if ($resql_supplier_price) {
$obj = $object->db->fetch_object($resql_supplier_price);
$obj = $object->db->fetch_object($resql_supplier_price); // Take first value so the ref with the smaller minimum quantity
if (!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) {
$line_cost = $obj->min_price / $obj->qty * $sub_bom_line->qty * (float) $line->qty;
} else {

Some files were not shown because too many files have changed in this diff Show More