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

This commit is contained in:
Christophe Battarel
2019-03-06 11:01:51 +01:00
744 changed files with 21320 additions and 20013 deletions

View File

@@ -309,7 +309,7 @@ script:
set -e
# Exclusions are defined in the ruleset.xml file
#phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 .
phpcs -s -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
set +e
echo

View File

@@ -236,6 +236,12 @@ source_file = htdocs/langs/en_US/modulebuilder.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.mrp]
file_filter = htdocs/langs/<lang>/mrp.lang
source_file = htdocs/langs/en_US/mrp.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.multicurrency]
file_filter = htdocs/langs/<lang>/multicurrency.lang
source_file = htdocs/langs/en_US/multicurrency.lang

View File

@@ -34,7 +34,7 @@ Swift Mailer 5.4.2-DEV MIT license Yes
Stripe 4.7.0 MIT licence Yes Library for Stripe module
JS libraries:
jQuery 3.1.1 MIT License Yes JS library
jQuery 3.3.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)

View File

@@ -22,21 +22,51 @@ Following changes may create regressions for some external modules, but were nec
FIX: #10381
FIX: #10460 compatibility with MariaDB 10.4
FIX: #10485
FIX: #10638
FIX: Accountancy - Adding transaction with multicompany uses all the time 1st entity
FIX: actioncomm export: ORDER BY clause is in wrong export property + event type filter does not work
FIX: add fk_unit on addline action
FIX: adding css by page if url is externam
FIX: Bad link in menu manager
FIX: better test on fetch
FIX: can't add lines on invoices
FIX: Check for old picture name if the new one was not found
FIX: could not create several superadmin in transversal mode
FIX: creation of menu entry with parent id not int
FIX: creation of new left menu entry
FIX: Default language of company is not set
FIX: error on setup of password if pass generators have a .old file.
FIX: error report not returned
FIX: expedition: reset status on rollback + replace hardcoded status with const
FIX: fetch module / pos source
FIX: fk_default_warehouse missing in group by
FIX: function sendEmailsReminder isn't completely developed, then MAIN_FEATURES_LEVEL must be 2 to "use" it
FIX: if empty error message, we just see "error" displayed
FIX: label of bank account
FIX: line edit template: keep fk_parent_line
FIX: Mark credit note as available for credit note in other currency
FIX: missing access security checking with multicompany
FIX: missing entity filter in function "build_filterField()" (export module)
FIX: missing $ismultientitymanaged for previous/next ref
FIX: Missing province in export of invoice
FIX: must fetch member in current entity
FIX: positive values creating diff on addline rounding
FIX: positive values IN supplier credit notes creating diff on addline rounding
FIX: Price in combo list of service does not use the correct price level
FIX: supplier invoice payment total doesnt care about deposit or credit
FIX: project_title for display of getNomUrl()
FIX: same thing here
FIX: Show button POS Ticket only if invoice was generated by POS
FIX: supplier invoice payment total doesn't care about deposit or credit
FIX: supplier invoice product stats total ht is line total not invoice total
FIX: The notes was also copied on invoice
FIX: Transaction on leave approval and decrease ko if setup not complete
FIX: Translation not loaded by scheduled jobs
FIX: [URGENT] broken feature, "$usercancreate" is for Dolibarr 9
FIX: we want to be able to reopen fourn credit note
FIX: wrong feature2 when user rights "group_advance" is used
FIX: wrong merged conflict
FIX: wrong tests on fetch
NEW: Add protection to avoid packaging if files non indexed exists into
NEW: Add protection to avoid packaging if files non indexed exists
***** ChangeLog for 9.0.0 compared to 8.0.0 *****
For Users:

View File

@@ -11,10 +11,8 @@
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
<exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">*.min.css</exclude-pattern>
<exclude-pattern type="relative">*.js</exclude-pattern>
<!-- List of all tests -->
<!-- List of all tests -->
<!-- Rules from Internal Standard -->
@@ -201,7 +199,7 @@
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
<severity>0</severity>
</rule>
<rule ref="Squiz.Scope.MethodScope.Missing" />
<!-- Rules from PEAR Standard -->

View File

@@ -50,7 +50,7 @@ class autoTranslator
* @param string $_apikey Api key
* @return void
*/
function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey)
public function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey)
{
// Set enviorment variables
@@ -346,5 +346,5 @@ class autoTranslator
//print "OK ".join('',$src_texts).' => '.$rep."\n";
return $rep;
}
}
}

View File

@@ -307,11 +307,11 @@ if ($resql)
print '<tr class="liste_titre">';
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, 'align="left"', $sortfield, $sortorder);
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']);
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
$accountstatic = new AccountingAccount($db);
@@ -403,7 +403,7 @@ if ($resql)
}
// Action
print '<td align="center">';
print '<td class="center">';
if ($user->rights->accounting->chartofaccount) {
print '<a href="./card.php?action=update&id=' . $obj->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
print img_edit();

View File

@@ -532,8 +532,8 @@ if ($id)
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($valuetoshow != '') {
print '<td align="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<td class="'.$class.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (! empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
@@ -662,23 +662,29 @@ if ($id)
*/
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
$valuetoshow=$langs->trans("Label");
if ($id != 25) $valuetoshow.="*";
}
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
if ($fieldlist[$field]=='country_id') { $showfield=0; }
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($fieldlist[$field]=='code') {
$valuetoshow=$langs->trans("Code");
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
$valuetoshow=$langs->trans("Label");
if ($id != 25) $valuetoshow.="*";
}
if ($fieldlist[$field]=='country') {
$valuetoshow=$langs->trans("Country");
}
if ($fieldlist[$field]=='country_id') {
$showfield=0;
}
if ($fieldlist[$field]=='fk_pcg_version') {
$valuetoshow=$langs->trans("Pcg_version");
}
// Affiche nom du champ
if ($showfield)
{
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
if ($showfield) {
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' ');
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
@@ -757,7 +763,7 @@ if ($id)
$class='tddict';
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
// Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
}
}
@@ -769,17 +775,17 @@ if ($id)
$url.='&';
// Active
print '<td align="center" class="nowrap">';
print '<td class="center nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else print $langs->trans("AlwaysActive");
print "</td>";
// Modify link
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>';
// Delete link
if ($iserasable) print '<td align="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>';
if ($iserasable) print '<td class="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>';
else print '<td>&nbsp;</td>';
print "</tr>\n";
@@ -852,7 +858,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
}
}
elseif ($fieldlist[$field] == 'type_cdr') {
if ($fieldlist[$field] == 'type_cdr') print '<td align="center">';
if ($fieldlist[$field] == 'type_cdr') print '<td class="center">';
else print '<td>';
if ($fieldlist[$field] == 'type_cdr') {
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));

View File

@@ -41,8 +41,7 @@ $rowid=GETPOST('rowid', 'alpha');
$code=GETPOST('code', 'alpha');
// Security access
if (empty($user->rights->accounting->chartofaccount))
{
if (empty($user->rights->accounting->chartofaccount)) {
accessforbidden();
}
@@ -468,29 +467,46 @@ if ($id)
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
$class="left";
if ($fieldlist[$field]=='type') {
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
else $valuetoshow=$langs->trans("Type");
if ($fieldlist[$field]=='type') {
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
$valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
} else {
$valuetoshow=$langs->trans("Type");
}
}
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
if ($fieldlist[$field]=='code') {
$valuetoshow=$langs->trans("Code");
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); }
if ($fieldlist[$field]=='country') {
if ($fieldlist[$field]=='libelle_facture') {
$valuetoshow=$langs->trans("LabelOnDocuments");
}
if ($fieldlist[$field]=='country') {
$valuetoshow=$langs->trans("Country");
}
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
if ($fieldlist[$field]=='accountancy_code') {
$valuetoshow=$langs->trans("AccountancyCode");
}
if ($fieldlist[$field]=='accountancy_code_sell') {
$valuetoshow=$langs->trans("AccountancyCodeSell");
}
if ($fieldlist[$field]=='accountancy_code_buy') {
$valuetoshow=$langs->trans("AccountancyCodeBuy");
}
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') {
$valuetoshow=$langs->trans("Pcg_version");
}
if ($fieldlist[$field]=='range_account') {
$valuetoshow=$langs->trans("Comment");
}
if ($fieldlist[$field]=='category_type') {
$valuetoshow=$langs->trans("Calculated");
}
if ($valuetoshow != '')
{
print '<td align="'.$align.'">';
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
else print $valuetoshow;
@@ -591,7 +607,7 @@ if ($id)
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="center">';
print '<td class="liste_titre center">';
if ($filterfound)
{
$searchpicto=$form->showFilterAndCheckAddButtons(0);
@@ -613,38 +629,73 @@ if ($id)
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
if ($fieldlist[$field]=='taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
else $valuetoshow=$langs->trans("Amount");
$align='center';
if ($fieldlist[$field]=='source') {
$valuetoshow=$langs->trans("Contact");
}
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
if ($fieldlist[$field]=='price') {
$valuetoshow=$langs->trans("PriceUHT");
}
if ($fieldlist[$field]=='taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
$valuetoshow=$langs->trans("Rate");
} else {
$valuetoshow=$langs->trans("Amount");
}
$class='center';
}
if ($fieldlist[$field]=='type') {
$valuetoshow=$langs->trans("Type");
}
if ($fieldlist[$field]=='code') {
$valuetoshow=$langs->trans("Code");
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; }
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); }
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
if ($fieldlist[$field]=='country') {
$valuetoshow=$langs->trans("Country");
}
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
$showfield=0;
}
if ($fieldlist[$field]=='accountancy_code') {
$valuetoshow=$langs->trans("AccountancyCode");
}
if ($fieldlist[$field]=='accountancy_code_sell') {
$valuetoshow=$langs->trans("AccountancyCodeSell");
$sortable=0;
}
if ($fieldlist[$field]=='accountancy_code_buy') {
$valuetoshow=$langs->trans("AccountancyCodeBuy");
$sortable=0;
}
if ($fieldlist[$field]=='fk_pcg_version') {
$valuetoshow=$langs->trans("Pcg_version");
}
if ($fieldlist[$field]=='account_parent') {
$valuetoshow=$langs->trans("Accountsparent");
}
if ($fieldlist[$field]=='pcg_type') {
$valuetoshow=$langs->trans("Pcg_type");
}
if ($fieldlist[$field]=='pcg_subtype') {
$valuetoshow=$langs->trans("Pcg_subtype");
}
if ($fieldlist[$field]=='type_template') {
$valuetoshow=$langs->trans("TypeOfTemplate");
}
if ($fieldlist[$field]=='range_account') {
$valuetoshow=$langs->trans("Comment");
}
if ($fieldlist[$field]=='category_type') {
$valuetoshow=$langs->trans("Calculated");
}
// Affiche nom du champ
if ($showfield)
{
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
if ($showfield) {
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' ');
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
@@ -670,7 +721,7 @@ if ($id)
print '<td></td>';
print '<td></td>';
print '<td align="center">';
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
@@ -732,7 +783,7 @@ if ($id)
$class='tddict';
// Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
}
}
@@ -750,7 +801,7 @@ if ($id)
$url.='&';
// Active
print '<td align="center" class="nowrap">';
print '<td class="center" class="nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else
{
@@ -759,13 +810,13 @@ if ($id)
print "</td>";
// Modify link
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>';
// Delete link
if ($iserasable)
{
print '<td align="center">';
print '<td class="center">';
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>';

View File

@@ -32,8 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$langs->loadLangs(array("compta","admin","accountancy"));
// Security check
if (empty($user->rights->accounting->chartofaccount))
{
if (empty($user->rights->accounting->chartofaccount)) {
accessforbidden();
}
@@ -112,7 +111,7 @@ foreach ($list_account_main as $key) {
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
print '<td>'; // Do not force align=right, or it align also the content of the select box
print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';

View File

@@ -156,7 +156,7 @@ foreach ($list_account_main as $key) {
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
print '<td>'; // Do not force align=right, or it align also the content of the select box
print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';
@@ -179,7 +179,7 @@ foreach ($list_account as $key) {
$label = $langs->trans($key);
print '<td width="50%">' . $label . '</td>';
// Value
print '<td>'; // Do not force align=right, or it align also the content of the select box
print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';

View File

@@ -131,8 +131,8 @@ if ($result)
print '<td>' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("DateStart") . '</td>';
print '<td>' . $langs->trans("DateEnd") . '</td>';
print '<td align="center">' . $langs->trans("NumberOfAccountancyEntries") . '</td>';
print '<td align="center">' . $langs->trans("NumberOfAccountancyMovements") . '</td>';
print '<td class="center">' . $langs->trans("NumberOfAccountancyEntries") . '</td>';
print '<td class="center">' . $langs->trans("NumberOfAccountancyMovements") . '</td>';
print '<td class="right">' . $langs->trans("Statut") . '</td>';
print '</tr>';
@@ -147,8 +147,8 @@ if ($result)
print '<td class="left">' . $obj->label . '</td>';
print '<td class="left">' . dol_print_date($db->jdate($obj->date_start), 'day') . '</td>';
print '<td class="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>';
print '<td align="center">' . $object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end) . '</td>';
print '<td align="center">' . $object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end) . '</td>';
print '<td class="center">' . $object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end) . '</td>';
print '<td class="center">' . $object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end) . '</td>';
print '<td class="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>';
print '</tr>';
$i++;

View File

@@ -132,7 +132,7 @@ if ($result) {
print '<td>' . $langs->trans("Accountparent") . '</td>';
print '<td>' . $langs->trans("Pcgtype") . '</td>';
print '<td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td align="center">' . $langs->trans("Import") . '</td>';
print '<td class="center">' . $langs->trans("Import") . '</td>';
print '</tr>';
$form = new Form($db);
@@ -166,7 +166,7 @@ if ($result) {
// Colonne choix ligne a ventiler
$checked = ('label' == 'O') ? ' checked' : '';
print '<td align="center">';
print '<td class="center">';
print '<input type="checkbox" name="mesCasesCochees[]" ' . $checked . ' value="' . $objp->accounting . '"/>';
print '</td>';
@@ -174,7 +174,7 @@ if ($result) {
$i ++;
}
print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Import") . '"></td></tr>';
print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" class="center"><input type="submit" class="butAction" value="' . $langs->trans("Import") . '"></td></tr>';
print '</table>';
print '</form>';

View File

@@ -430,16 +430,18 @@ if ($id)
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
$class="left";
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
if ($fieldlist[$field]=='code') {
$valuetoshow=$langs->trans("Code");
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
if ($fieldlist[$field]=='nature') {
$valuetoshow=$langs->trans("Nature");
}
if ($valuetoshow != '')
{
print '<td align="'.$align.'">';
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
else print $valuetoshow;
@@ -549,17 +551,22 @@ if ($id)
*/
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
if ($fieldlist[$field]=='code') {
$valuetoshow=$langs->trans("Code");
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='nature') {
$valuetoshow=$langs->trans("Nature");
}
// Affiche nom du champ
if ($showfield)
{
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
if ($showfield) {
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' ');
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
@@ -621,7 +628,7 @@ if ($id)
$class='tddict';
// Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
}
}
@@ -696,11 +703,11 @@ $db->close();
/**
* Show fields in insert/edit mode
*
* @param array $fieldlist Array of fields
* @param Object $obj If we show a particular record, obj is filled with record fields
* @param string $tabname Name of SQL table
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
* @param array $fieldlist Array of fields
* @param Object $obj If we show a particular record, obj is filled with record fields
* @param string $tabname Name of SQL table
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
*/
function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
{

View File

@@ -307,7 +307,7 @@ if ($result)
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
print "</table>\n";
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
print "<br>\n";
@@ -338,7 +338,7 @@ if ($result)
print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1);
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="center" class="liste_titre">';
print '<td class="center liste_titre">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
@@ -348,14 +348,14 @@ if ($result)
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder);
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder);
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') $fieldtosortaccount="p.accountancy_code_buy";
else $fieldtosortaccount="p.accountancy_code_sell";
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AssignDedicatedAccountingAccount");
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"');
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
print '</tr>';
$product_static = new Product($db);
@@ -408,10 +408,10 @@ if ($result)
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL')
print '<td align="center">'.$product_static->getLibStatut(3, 0).'</td>';
print '<td class="center">'.$product_static->getLibStatut(3, 0).'</td>';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY')
print '<td align="center">'.$product_static->getLibStatut(3, 1).'</td>';
print '<td class="center">'.$product_static->getLibStatut(3, 1).'</td>';
// Current accounting account
print '<td class="left">';
@@ -450,7 +450,7 @@ if ($result)
}
// Checkbox select
print '<td align="center">';
print '<td class="center">';
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
print "</tr>";
$i ++;
@@ -485,7 +485,7 @@ if ($result)
</script>';
print '<br><div align="center"><input type="submit" class="butAction" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '"></div>';
print '<br><div class="center"><input type="submit" class="butAction" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '"></div>';
print '</form>';

View File

@@ -248,7 +248,7 @@ if ($action != 'export_csv')
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" class="center"', $sortfield, $sortorder);
print "</tr>\n";
$total_debit = 0;
@@ -296,7 +296,7 @@ if ($action != 'export_csv')
print '<td class="right">' . price($line->debit) . '</td>';
print '<td class="right">' . price($line->credit) . '</td>';
print '<td class="right">' . price($line->credit - $line->debit) . '</td>';
print '<td align="center">' . $link;
print '<td class="center">' . $link;
print '</td>';
print "</tr>\n";

View File

@@ -73,19 +73,19 @@ $y = $year_current;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width=150>' . $langs->trans("Label") . '</td>';
print '<td align="center">' . $langs->trans("JanuaryMin") . '</td>';
print '<td align="center">' . $langs->trans("FebruaryMin") . '</td>';
print '<td align="center">' . $langs->trans("MarchMin") . '</td>';
print '<td align="center">' . $langs->trans("AprilMin") . '</td>';
print '<td align="center">' . $langs->trans("MayMin") . '</td>';
print '<td align="center">' . $langs->trans("JuneMin") . '</td>';
print '<td align="center">' . $langs->trans("JulyMin") . '</td>';
print '<td align="center">' . $langs->trans("AugustMin") . '</td>';
print '<td align="center">' . $langs->trans("SeptemberMin") . '</td>';
print '<td align="center">' . $langs->trans("OctoberMin") . '</td>';
print '<td align="center">' . $langs->trans("NovemberMin") . '</td>';
print '<td align="center">' . $langs->trans("DecemberMin") . '</td>';
print '<td align="center"><strong>Total</strong></td>';
print '<td class="center">' . $langs->trans("JanuaryMin") . '</td>';
print '<td class="center">' . $langs->trans("FebruaryMin") . '</td>';
print '<td class="center">' . $langs->trans("MarchMin") . '</td>';
print '<td class="center">' . $langs->trans("AprilMin") . '</td>';
print '<td class="center">' . $langs->trans("MayMin") . '</td>';
print '<td class="center">' . $langs->trans("JuneMin") . '</td>';
print '<td class="center">' . $langs->trans("JulyMin") . '</td>';
print '<td class="center">' . $langs->trans("AugustMin") . '</td>';
print '<td class="center">' . $langs->trans("SeptemberMin") . '</td>';
print '<td class="center">' . $langs->trans("OctoberMin") . '</td>';
print '<td class="center">' . $langs->trans("NovemberMin") . '</td>';
print '<td class="center">' . $langs->trans("DecemberMin") . '</td>';
print '<td class="center"><strong>Total</strong></td>';
print '</tr>';
$sql = "SELECT bk.numero_compte AS 'compte',";

View File

@@ -604,7 +604,7 @@ if ($action == 'create')
print_liste_field_titre("LabelOperation");
print_liste_field_titre("Debit", "", "", "", "", 'class="right"');
print_liste_field_titre("Credit", "", "", "", "", 'class="right"');
print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"');
print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"');
print "</tr>\n";
@@ -644,7 +644,7 @@ if ($action == 'create')
print '<td class="right">' . price($line->debit) . '</td>';
print '<td class="right">' . price($line->credit) . '</td>';
print '<td align="center">';
print '<td class="center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
print img_edit();
print '</a> &nbsp;';

View File

@@ -606,18 +606,18 @@ print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, 'class="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";

View File

@@ -286,7 +286,7 @@ print $formaccounting->select_account($search_accountancy_code_end, 'search_acco
print '</div>';
print '</td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="center">';
print '<td class="liste_titre center">';
print $langs->trans('From') . ': ';
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1);
print '<br>';
@@ -297,7 +297,7 @@ print '<td class="liste_titre"><input type="text" size="7" class="flat" name="se
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="' . dol_escape_htmltag($search_label_operation) . '"/></td>';
print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
print '<td class="liste_titre" align="center"><input type="text" name="search_ledger_code" size="3" value="' . dol_escape_htmltag($search_ledger_code) . '"></td>';
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . dol_escape_htmltag($search_ledger_code) . '"></td>';
print '<td class="liste_titre right" colspan="2">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
@@ -305,14 +305,14 @@ print '</td>';
print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Piece", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label");
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center ');
print "</tr>\n";
print '</tr>';
@@ -364,7 +364,7 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">';
print '<td>&nbsp;</td>';
print '<td class="right"><a href="./card.php?piece_num=' . $line->piece_num . '">'.$line->piece_num.'</a></td>';
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
print '<td class="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
// TODO Add a link according to doc_type and fk_doc
print '<td class="nowrap">';
@@ -384,9 +384,9 @@ while ($i < min($num, $limit))
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td align="center">' . $journaltoshow . '</td>';
print '<td class="center">' . $journaltoshow . '</td>';
print '<td align="center">';
print '<td class="center">';
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>';

View File

@@ -238,12 +238,12 @@ if ($resql) {
print '<td class="right">' . price($obj->debit) . '</td>';
print '<td class="right">' . price($obj->credit) . '</td>';
print '<td class="right">' . price(round($solde, 2)) . '</td>';
print '<td align="center">' . $obj->code_journal . '</td>';
print '<td class="center">' . $obj->code_journal . '</td>';
if (empty($obj->lettering_code)) {
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
} else
print '<td align="center">' . $obj->lettering_code . '</td>';
print '<td class="center">' . $obj->lettering_code . '</td>';
print "</tr>\n";
}

View File

@@ -240,12 +240,12 @@ if ($resql) {
print '<td class="right">' . price($obj->debit) . '</td>';
print '<td class="right">' . price($obj->credit) . '</td>';
print '<td class="right">' . price(round($solde, 2)) . '</td>';
print '<td align="center">' . $obj->code_journal . '</td>';
print '<td class="center">' . $obj->code_journal . '</td>';
if (empty($obj->lettering_code)) {
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
} else
print '<td align="center">' . $obj->lettering_code . '</td>';
print '<td class="center">' . $obj->lettering_code . '</td>';
print "</tr>\n";
}

View File

@@ -129,7 +129,7 @@ class AccountancyCategory // extends CommonObject
*
* @param DoliDb $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
}
@@ -142,7 +142,7 @@ class AccountancyCategory // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
function create($user, $notrigger = 0)
public function create($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -239,7 +239,7 @@ class AccountancyCategory // extends CommonObject
* @param string $label Label
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $code = '', $label = '')
public function fetch($id, $code = '', $label = '')
{
$sql = "SELECT";
$sql.= " t.rowid,";
@@ -299,7 +299,7 @@ class AccountancyCategory // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user = null, $notrigger = 0)
public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -379,7 +379,7 @@ class AccountancyCategory // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger = 0)
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -460,7 +460,7 @@ class AccountancyCategory // extends CommonObject
return - 1;
}
}
}
/**
* Function to select accounting category of an accounting account present in chart of accounts
@@ -509,7 +509,7 @@ class AccountancyCategory // extends CommonObject
return - 1;
}
}
}
/**
* Function to select accounting category of an accounting account present in chart of accounts
@@ -552,7 +552,7 @@ class AccountancyCategory // extends CommonObject
return - 1;
}
}
}
/**
* Function to add an accounting account in an accounting category
@@ -617,7 +617,7 @@ class AccountancyCategory // extends CommonObject
return 1;
}
}
}
/**
* Function to delete an accounting account from an accounting category
@@ -643,7 +643,7 @@ class AccountancyCategory // extends CommonObject
}
// Commit or rollback
if ($error) {
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
@@ -651,12 +651,12 @@ class AccountancyCategory // extends CommonObject
$this->db->rollback();
return - 1 * $error;
} else {
} else {
$this->db->commit();
return 1;
}
}
return 1;
}
}
/**
* Function to know all category from accounting account

View File

@@ -8,7 +8,7 @@
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -98,18 +98,18 @@ class AccountancyExport
global $langs;
return array (
//self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
);
//self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
);
}
/**

View File

@@ -64,10 +64,10 @@ class AccountancySystem
*
* @param DoliDB $db handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
}
}
/**
@@ -77,7 +77,7 @@ class AccountancySystem
* @param string $ref ref
* @return int <0 if KO, Id of record if OK and found
*/
function fetch($rowid = 0, $ref = '')
public function fetch($rowid = 0, $ref = '')
{
global $conf;
@@ -124,7 +124,7 @@ class AccountancySystem
* @param User $user making insert
* @return int if KO, Id of line if OK
*/
function create($user)
public function create($user)
{
$now = dol_now();
@@ -151,6 +151,6 @@ class AccountancySystem
dol_syslog($this->error, LOG_ERR);
}
return $result;
}
return $result;
}
}

View File

@@ -138,13 +138,13 @@ class AccountingAccount extends CommonObject
*
* @param DoliDB $db Database handle
*/
function __construct($db)
public function __construct($db)
{
global $conf;
$this->db = $db;
$this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method
}
}
/**
* Load record in memory
@@ -154,7 +154,7 @@ class AccountingAccount extends CommonObject
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, 0 if not found, Id of record if OK and found
*/
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
{
global $conf;
@@ -216,7 +216,7 @@ class AccountingAccount extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function create($user, $notrigger = 0)
public function create($user, $notrigger = 0)
{
global $conf;
$error = 0;
@@ -317,7 +317,7 @@ class AccountingAccount extends CommonObject
$this->db->commit();
return $this->id;
}
}
}
/**
* Update record
@@ -325,7 +325,7 @@ class AccountingAccount extends CommonObject
* @param User $user Use making update
* @return int <0 if KO, >0 if OK
*/
function update($user)
public function update($user)
{
// Check parameters
if (empty($this->pcg_type) || $this->pcg_type == '-1')
@@ -368,7 +368,7 @@ class AccountingAccount extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
function checkUsage()
public function checkUsage()
{
global $langs;
@@ -402,7 +402,7 @@ class AccountingAccount extends CommonObject
* @param int $notrigger 0=triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger = 0)
public function delete($user, $notrigger = 0)
{
$error = 0;
@@ -453,9 +453,9 @@ class AccountingAccount extends CommonObject
} else {
return - 1;
}
}
}
/**
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
@@ -466,8 +466,8 @@ class AccountingAccount extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
{
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
{
global $langs, $conf, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@@ -522,7 +522,7 @@ class AccountingAccount extends CommonObject
if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
return $result;
}
}
/**
* Information on record
@@ -530,7 +530,7 @@ class AccountingAccount extends CommonObject
* @param int $id of record
* @return void
*/
function info($id)
public function info($id)
{
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
@@ -562,14 +562,14 @@ class AccountingAccount extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Account deactivated
*
* @param int $id Id
* @return int <0 if KO, >0 if OK
*/
function account_desactivate($id)
public function account_desactivate($id)
{
// phpcs:enable
$result = $this->checkUsage();
@@ -597,14 +597,14 @@ class AccountingAccount extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Account activated
*
* @param int $id Id
* @return int <0 if KO, >0 if OK
*/
function account_activate($id)
public function account_activate($id)
{
// phpcs:enable
$this->db->begin();
@@ -615,15 +615,15 @@ class AccountingAccount extends CommonObject
dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($result) {
$this->db->commit();
return 1;
} else {
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return - 1;
}
}
}
}
/**
@@ -632,12 +632,12 @@ class AccountingAccount extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -645,7 +645,7 @@ class AccountingAccount extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function LibStatut($statut, $mode = 0)
public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -655,32 +655,32 @@ class AccountingAccount extends CommonObject
{
$prefix='';
if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled');
elseif ($statut == 0) return $langs->trans('Disabled');
}
elseif ($mode == 1)
{
if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled');
elseif ($statut == 0) return $langs->trans('Disabled');
}
elseif ($mode == 2)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 3)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4');
if ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5');
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5');
}
elseif ($mode == 4)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 5)
{
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
}
}
}

View File

@@ -74,10 +74,10 @@ class AccountingJournal extends CommonObject
*
* @param DoliDB $db Database handle
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
}
$this->db = $db;
}
/**
* Load an object from database
@@ -86,7 +86,7 @@ class AccountingJournal extends CommonObject
* @param string $journal_code Journal code
* @return int <0 if KO, Id of record if OK and found
*/
function fetch($rowid = null, $journal_code = null)
public function fetch($rowid = null, $journal_code = null)
{
global $conf;
@@ -146,7 +146,7 @@ class AccountingJournal extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
$sql = "SELECT rowid, code, label, nature, active";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
@@ -213,7 +213,7 @@ class AccountingJournal extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0)
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0)
{
global $langs, $conf, $user;
@@ -270,12 +270,12 @@ class AccountingJournal extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type
*/
function getLibType($mode = 0)
public function getLibType($mode = 0)
{
return $this->LibType($this->nature, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return type of an accounting journal
*
@@ -283,7 +283,7 @@ class AccountingJournal extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type
*/
function LibType($nature, $mode = 0)
public function LibType($nature, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -294,20 +294,20 @@ class AccountingJournal extends CommonObject
{
$prefix='';
if ($nature == 9) return $langs->trans('AccountingJournalType9');
if ($nature == 5) return $langs->trans('AccountingJournalType5');
if ($nature == 4) return $langs->trans('AccountingJournalType4');
if ($nature == 3) return $langs->trans('AccountingJournalType3');
if ($nature == 2) return $langs->trans('AccountingJournalType2');
if ($nature == 1) return $langs->trans('AccountingJournalType1');
elseif ($nature == 5) return $langs->trans('AccountingJournalType5');
elseif ($nature == 4) return $langs->trans('AccountingJournalType4');
elseif ($nature == 3) return $langs->trans('AccountingJournalType3');
elseif ($nature == 2) return $langs->trans('AccountingJournalType2');
elseif ($nature == 1) return $langs->trans('AccountingJournalType1');
}
if ($mode == 1)
elseif ($mode == 1)
{
if ($nature == 9) return $langs->trans('AccountingJournalType9');
if ($nature == 5) return $langs->trans('AccountingJournalType5');
if ($nature == 4) return $langs->trans('AccountingJournalType4');
if ($nature == 3) return $langs->trans('AccountingJournalType3');
if ($nature == 2) return $langs->trans('AccountingJournalType2');
if ($nature == 1) return $langs->trans('AccountingJournalType1');
elseif ($nature == 5) return $langs->trans('AccountingJournalType5');
elseif ($nature == 4) return $langs->trans('AccountingJournalType4');
elseif ($nature == 3) return $langs->trans('AccountingJournalType3');
elseif ($nature == 2) return $langs->trans('AccountingJournalType2');
elseif ($nature == 1) return $langs->trans('AccountingJournalType1');
}
}
}

View File

@@ -167,10 +167,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = trim($this->doc_ref);
}
if (isset($this->fk_doc)) {
$this->fk_doc = trim($this->fk_doc);
$this->fk_doc = (int) $this->fk_doc;
}
if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet);
$this->fk_docdet = (int) $this->fk_docdet;
}
if (isset($this->thirdparty_code)) {
$this->thirdparty_code = trim($this->thirdparty_code);
@@ -411,7 +411,7 @@ class BookKeeping extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -487,10 +487,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = trim($this->doc_ref);
}
if (isset($this->fk_doc)) {
$this->fk_doc = trim($this->fk_doc);
$this->fk_doc = (int) $this->fk_doc;
}
if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet);
$this->fk_docdet = (int) $this->fk_docdet;
}
if (isset($this->thirdparty_code)) {
$this->thirdparty_code = trim($this->thirdparty_code);
@@ -1104,10 +1104,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = trim($this->doc_ref);
}
if (isset($this->fk_doc)) {
$this->fk_doc = trim($this->fk_doc);
$this->fk_doc = (int) $this->fk_doc;
}
if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet);
$this->fk_docdet = (int) $this->fk_docdet;
}
if (isset($this->thirdparty_code)) {
$this->thirdparty_code = trim($this->thirdparty_code);
@@ -1308,7 +1308,7 @@ class BookKeeping extends CommonObject
* @param string $importkey Import key
* @return int Result
*/
function deleteByImportkey($importkey)
public function deleteByImportkey($importkey)
{
$this->db->begin();
@@ -1338,7 +1338,7 @@ class BookKeeping extends CommonObject
* @param string $mode Mode
* @return int <0 if KO, >0 if OK
*/
function deleteByYearAndJournal($delyear = '', $journal = '', $mode = '')
public function deleteByYearAndJournal($delyear = '', $journal = '', $mode = '')
{
global $conf;
@@ -1378,7 +1378,7 @@ class BookKeeping extends CommonObject
* @param int $piecenum Piecenum to delete
* @return int Result
*/
function deleteMvtNum($piecenum)
public function deleteMvtNum($piecenum)
{
global $conf;
@@ -1473,8 +1473,8 @@ class BookKeeping extends CommonObject
$this->doc_date = $now;
$this->doc_type = '';
$this->doc_ref = '';
$this->fk_doc = '';
$this->fk_docdet = '';
$this->fk_doc = 0;
$this->fk_docdet = 0;
$this->thirdparty_code = 'CU001';
$this->subledger_account = '41100001';
$this->subledger_label = 'My customer company';
@@ -1565,7 +1565,7 @@ class BookKeeping extends CommonObject
* @param string $mode Mode
* @return int <0 if KO, >0 if OK
*/
function fetchAllPerMvt($piecenum, $mode = '')
public function fetchAllPerMvt($piecenum, $mode = '')
{
global $conf;
@@ -1618,14 +1618,14 @@ class BookKeeping extends CommonObject
return 1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Export bookkeping
*
* @param string $model Model
* @return int Result
*/
function export_bookkeping($model = 'ebp')
public function export_bookkeping($model = 'ebp')
{
// phpcs:enable
global $conf;
@@ -1771,7 +1771,7 @@ class BookKeeping extends CommonObject
*/
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of accounts with label by chart of accounts
*
@@ -1784,7 +1784,7 @@ class BookKeeping extends CommonObject
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
* @return string String with HTML select
*/
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
{
// phpcs:enable
global $conf;
@@ -1843,14 +1843,14 @@ class BookKeeping extends CommonObject
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Description of a root accounting account
*
* @param string $account Accounting account
* @return string Root account
*/
function get_compte_racine($account = null)
public function get_compte_racine($account = null)
{
// phpcs:enable
global $conf;
@@ -1884,15 +1884,15 @@ class BookKeeping extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Description of accounting account
*
* @param string $account Accounting account
* @return string Account desc
*/
function get_compte_desc($account = null)
{
public function get_compte_desc($account = null)
{
// phpcs:enable
global $conf;

View File

@@ -309,7 +309,9 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
print '<td class="liste_titre center nowraponall">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
}
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
$formother->select_year($search_year, 'search_year', 1, 20, 5);
print '</td>';
@@ -323,8 +325,8 @@ if ($result) {
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
print '<td class="liste_titre" align="center">';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
print '<td class="liste_titre center">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print "</td></tr>\n";
@@ -332,17 +334,17 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center ');
$clickpicto=$form->showCheckAddButtons();
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
$facture_static = new Facture($db);
@@ -368,7 +370,7 @@ if ($result) {
// Ref Invoice
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref Product
print '<td>';
@@ -391,7 +393,7 @@ if ($result) {
print '<td>' . $objp->tva_intra . '</td>';
print '<td align="center">';
print '<td class="center">';
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')).'">';
print img_edit();
print '</a>';

View File

@@ -376,7 +376,9 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
print '<td class="liste_titre center nowraponall">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
}
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
$formother->select_year($search_year, 'search_year', 1, 20, 5);
print '</td>';
@@ -392,7 +394,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td align="center" class="liste_titre">';
print '<td class="center liste_titre">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
@@ -401,19 +403,19 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
$facture_static = new Facture($db);
@@ -482,7 +484,7 @@ if ($result) {
// Ref Invoice
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref Product
print '<td>';
@@ -513,7 +515,7 @@ if ($result) {
print '<td>' . $objp->tva_intra . '</td>';
// Current account
print '<td align="center" style="' . $code_sell_p_notset . '">';
print '<td class="center" style="' . $code_sell_p_notset . '">';
print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown"));
if ($objp->product_id > 0)
{
@@ -523,12 +525,12 @@ if ($result) {
print '</td>';
// Suggested accounting account
print '<td align="center">';
print '<td class="center">';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';
// Column with checkbox
print '<td align="center">';
print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>';

View File

@@ -270,7 +270,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
print '<td class="liste_titre right"></td>';
print '<td class="liste_titre right">';
@@ -282,15 +282,15 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre('');
$checkpicto=$form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
$expensereport_static = new ExpenseReport($db);
@@ -309,7 +309,7 @@ if ($result) {
// Ref Invoice
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
print '<td class="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
print '<td class="tdoverflow">' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>';
@@ -321,7 +321,7 @@ if ($result) {
print '<td class="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
print '<td class="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
print '<td>' . $codeCompta . '</td>';

View File

@@ -319,7 +319,7 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td align="center" class="liste_titre">';
print '<td class="center" class="liste_titre">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
@@ -328,16 +328,16 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', $sortfield, $sortorder, 'center ');
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
@@ -362,7 +362,7 @@ if ($result) {
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
// Date
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
print '<td class="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
// Fees label
print '<td>';
@@ -386,16 +386,16 @@ if ($result) {
print '</td>';
// Current account
print '<td align="center">';
print '<td class="center">';
print length_accountg(html_entity_decode($objp->code_buy));
print '</td>';
// Suggested accounting account
print '<td align="center">';
print '<td class="center">';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';
print '<td align="center">';
print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>';

View File

@@ -994,8 +994,8 @@ if (empty($action) || $action == 'view') {
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
print "<td>" . $langs->trans("LabelOperation") . "</td>";
print "<td>" . $langs->trans("PaymentMode") . "</td>";
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
print "<td class='right'>" . $langs->trans("Debit") . "</td>";
print "<td class='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$r = '';
@@ -1044,8 +1044,8 @@ if (empty($action) || $action == 'view') {
print $reflabel;
print "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td class='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td class='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
}
}
@@ -1126,8 +1126,8 @@ if (empty($action) || $action == 'view') {
print "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td class='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td class='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
}
}
@@ -1163,8 +1163,8 @@ if (empty($action) || $action == 'view') {
print "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td class='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td class='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
}
}

View File

@@ -328,8 +328,8 @@ if ($result) {
// print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
print '<td class="liste_titre" align="center">';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
print '<td class="liste_titre center">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
@@ -339,17 +339,17 @@ if ($result) {
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center ');
$checkpicto=$form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
$facturefournisseur_static = new FactureFournisseur($db);
@@ -380,7 +380,7 @@ if ($result) {
print $objp->invoice_label;
print '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref product
print '<td>';
@@ -404,7 +404,7 @@ if ($result) {
print '<td>' . $objp->tva_intra . '</td>';
print '<td align="center">';
print '<td class="center">';
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')) . '">';
print img_edit();
print '</a></td>';

View File

@@ -392,7 +392,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td align="center" class="liste_titre">';
print '<td class="center liste_titre">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
@@ -402,19 +402,19 @@ if ($result) {
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
$facturefourn_static = new FactureFournisseur($db);
@@ -475,7 +475,7 @@ if ($result) {
print $objp->invoice_label;
print '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref product
print '<td>';
@@ -506,7 +506,7 @@ if ($result) {
print '<td>' . $objp->tva_intra . '</td>';
// Current account
print '<td align="center" style="' . $code_buy_p_notset . '">';
print '<td class="center" style="' . $code_buy_p_notset . '">';
print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown"));
if ($objp->product_id > 0)
{
@@ -516,12 +516,12 @@ if ($result) {
print '</td>';
// Suggested accounting account
print '<td align="center">';
print '<td class="center">';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';
// Column with checkbox
print '<td align="center">';
print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>';

View File

@@ -32,15 +32,15 @@ abstract class ActionsAdherentCardCommon
*/
public $db;
var $dirmodule;
var $targetmodule;
var $canvas;
var $card;
public $dirmodule;
public $targetmodule;
public $canvas;
public $card;
//! Template container
var $tpl = array();
public $tpl = array();
//! Object container
var $object;
public $object;
/**
* @var string Error code (or message)
@@ -59,7 +59,7 @@ abstract class ActionsAdherentCardCommon
* @param int $id Object id
* @return object Object loaded
*/
function getObject($id)
public function getObject($id)
{
//$ret = $this->getInstanceDao();
@@ -75,7 +75,7 @@ abstract class ActionsAdherentCardCommon
//}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set content of ->tpl array, to use into template
*
@@ -83,7 +83,7 @@ abstract class ActionsAdherentCardCommon
* @param int $id Id
* @return string HTML output
*/
function assign_values(&$action, $id)
public function assign_values(&$action, $id)
{
// phpcs:enable
global $conf, $langs, $user, $canvas;
@@ -245,23 +245,23 @@ abstract class ActionsAdherentCardCommon
// phpcs:enable
global $langs, $mysoc;
$this->object->old_name = $_POST["old_name"];
$this->object->old_firstname = $_POST["old_firstname"];
$this->object->old_name = $_POST["old_name"];
$this->object->old_firstname = $_POST["old_firstname"];
$this->object->fk_soc = $_POST["fk_soc"];
$this->object->lastname = $_POST["lastname"];
$this->object->firstname = $_POST["firstname"];
$this->object->civility_id = $_POST["civility_id"];
$this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"];
$this->object->note = $_POST["note"];
$this->object->canvas = $_POST["canvas"];
$this->object->fk_soc = $_POST["fk_soc"];
$this->object->lastname = $_POST["lastname"];
$this->object->firstname = $_POST["firstname"];
$this->object->civility_id = $_POST["civility_id"];
$this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"];
$this->object->note = $_POST["note"];
$this->object->canvas = $_POST["canvas"];
// We set country_id, and country_code label of the chosen country
if ($this->object->country_id)
@@ -272,8 +272,8 @@ abstract class ActionsAdherentCardCommon
{
$obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
$this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
}
else
{

View File

@@ -39,7 +39,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
* @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas)
*/
function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{
$this->db = $db;
$this->dirmodule = $dirmodule;
@@ -67,7 +67,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Assign custom values for canvas
*
@@ -75,7 +75,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
* @param int $id Id
* @return void
*/
function assign_values(&$action, $id)
public function assign_values(&$action, $id)
{
// phpcs:enable
global $limit, $offset, $sortfield, $sortorder;
@@ -122,7 +122,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fetch datas list and save into ->list_datas
*
@@ -132,7 +132,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
* @param string $sortorder Sort order ('ASC' or 'DESC')
* @return void
*/
function LoadListDatas($limit, $offset, $sortfield, $sortorder)
public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{
// phpcs:enable
global $conf, $langs;

View File

@@ -223,7 +223,7 @@ class Adherent extends CommonObject
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
$this->statut = -1;
@@ -234,7 +234,7 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function sending an email to the current member with the text supplied in parameter.
*
@@ -251,7 +251,7 @@ class Adherent extends CommonObject
* @param string $moreinheader Add more html headers
* @return int <0 if KO, >0 if OK
*/
function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{
// phpcs:enable
global $conf,$langs;
@@ -296,7 +296,7 @@ class Adherent extends CommonObject
* @param string $text Text to make substitution to
* @return string Value of input text string with substitutions done
*/
function makeSubstitution($text)
public function makeSubstitution($text)
{
global $conf,$langs;
@@ -363,7 +363,7 @@ class Adherent extends CommonObject
* @param string $morphy Nature of the adherent (physical or moral)
* @return string Label
*/
function getmorphylib($morphy = '')
public function getmorphylib($morphy = '')
{
global $langs;
if (! $morphy) { $morphy=$this->morphy; }
@@ -379,7 +379,7 @@ class Adherent extends CommonObject
* @param int $notrigger 1 ne declenche pas les triggers, 0 sinon
* @return int <0 if KO, >0 if OK
*/
function create($user, $notrigger = 0)
public function create($user, $notrigger = 0)
{
global $conf,$langs;
@@ -505,7 +505,7 @@ class Adherent extends CommonObject
* @param string $action Current action for hookmanager
* @return int <0 if KO, >0 if OK
*/
function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = 0, $nosyncthirdparty = 0, $action = 'update')
public function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = 0, $nosyncthirdparty = 0, $action = 'update')
{
global $conf, $langs, $hookmanager;
@@ -760,7 +760,7 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update denormalized last subscription date.
* This function is called when we delete a subscription for example.
@@ -768,7 +768,7 @@ class Adherent extends CommonObject
* @param User $user User making change
* @return int <0 if KO, >0 if OK
*/
function update_end_date($user)
public function update_end_date($user)
{
// phpcs:enable
$this->db->begin();
@@ -825,7 +825,7 @@ class Adherent extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, 0=nothing to do, >0 if OK
*/
function delete($rowid, $user, $notrigger = 0)
public function delete($rowid, $user, $notrigger = 0)
{
global $conf, $langs;
@@ -935,7 +935,7 @@ class Adherent extends CommonObject
* @param int $nosyncuser Do not synchronize linked user
* @return string If OK return clear password, 0 if no change, < 0 if error
*/
function setPassword($user, $password = '', $isencrypted = 0, $notrigger = 0, $nosyncuser = 0)
public function setPassword($user, $password = '', $isencrypted = 0, $notrigger = 0, $nosyncuser = 0)
{
global $conf, $langs;
@@ -1046,7 +1046,7 @@ class Adherent extends CommonObject
* @param int $userid Id of user to link to
* @return int 1=OK, -1=KO
*/
function setUserId($userid)
public function setUserId($userid)
{
global $conf, $langs;
@@ -1080,7 +1080,7 @@ class Adherent extends CommonObject
* @param int $thirdpartyid Id of user to link to
* @return int 1=OK, -1=KO
*/
function setThirdPartyId($thirdpartyid)
public function setThirdPartyId($thirdpartyid)
{
global $conf, $langs;
@@ -1116,14 +1116,14 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Method to load member from its login
*
* @param string $login login of member
* @return void
*/
function fetch_login($login)
public function fetch_login($login)
{
// phpcs:enable
global $conf;
@@ -1147,7 +1147,7 @@ class Adherent extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Method to load member from its name
*
@@ -1155,7 +1155,7 @@ class Adherent extends CommonObject
* @param string $lastname Lastname
* @return void
*/
function fetch_name($firstname, $lastname)
public function fetch_name($firstname, $lastname)
{
// phpcs:enable
global $conf;
@@ -1191,7 +1191,7 @@ class Adherent extends CommonObject
* @param bool $fetch_subscriptions To load member subscriptions
* @return int >0 if OK, 0 if not found, <0 if KO
*/
function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true)
public function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true)
{
global $langs;
@@ -1281,9 +1281,12 @@ class Adherent extends CommonObject
$this->public = $obj->public;
$this->datec = $this->db->jdate($obj->datec);
$this->date_creation = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem);
$this->date_modification= $this->db->jdate($obj->datem);
$this->datefin = $this->db->jdate($obj->datefin);
$this->datevalid = $this->db->jdate($obj->datev);
$this->date_validation = $this->db->jdate($obj->datev);
$this->birth = $this->db->jdate($obj->birthday);
$this->note_private = $obj->note_private;
@@ -1325,7 +1328,7 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to get member subscriptions data
* first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount
@@ -1333,7 +1336,7 @@ class Adherent extends CommonObject
*
* @return int <0 si KO, >0 si OK
*/
function fetch_subscriptions()
public function fetch_subscriptions()
{
// phpcs:enable
global $langs;
@@ -1409,7 +1412,7 @@ class Adherent extends CommonObject
* @param int $datesubend Date end subscription
* @return int rowid of record added, <0 if KO
*/
function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0)
public function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0)
{
global $conf,$langs,$user;
@@ -1495,7 +1498,7 @@ class Adherent extends CommonObject
* @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
* @return int <0 if KO, >0 if OK
*/
function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0)
public function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0)
{
global $conf, $langs, $user, $mysoc;
@@ -1788,7 +1791,7 @@ class Adherent extends CommonObject
* @param User $user user adherent qui valide
* @return int <0 if KO, 0 if nothing done, >0 if OK
*/
function validate($user)
public function validate($user)
{
global $langs,$conf;
@@ -1841,7 +1844,7 @@ class Adherent extends CommonObject
* @param User $user User making change
* @return int <0 if KO, >0 if OK
*/
function resiliate($user)
public function resiliate($user)
{
global $langs,$conf;
@@ -1883,13 +1886,13 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to add member into external tools mailing-list, spip, etc.
*
* @return int <0 if KO, >0 if OK
*/
function add_to_abo()
public function add_to_abo()
{
// phpcs:enable
global $conf,$langs;
@@ -1942,13 +1945,13 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to delete a member from external tools like mailing-list, spip, etc.
*
* @return int <0 if KO, >0 if OK
*/
function del_to_abo()
public function del_to_abo()
{
// phpcs:enable
global $conf,$langs;
@@ -2006,7 +2009,7 @@ class Adherent extends CommonObject
*
* @return string Translated name of civility (translated with transnoentitiesnoconv)
*/
function getCivilityLabel()
public function getCivilityLabel()
{
global $langs;
$langs->load("dict");
@@ -2027,7 +2030,7 @@ class Adherent extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1)
public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1)
{
global $conf, $langs;
@@ -2118,12 +2121,12 @@ class Adherent extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $this->need_subscription, $this->datefin, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -2133,7 +2136,7 @@ class Adherent extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label
*/
function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0)
public function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -2211,13 +2214,13 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 if KO, >0 if OK
*/
function load_state_board()
public function load_state_board()
{
// phpcs:enable
global $conf;
@@ -2247,14 +2250,14 @@ class Adherent extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Objet user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
function load_board($user)
public function load_board($user)
{
// phpcs:enable
global $conf, $langs;
@@ -2346,7 +2349,7 @@ class Adherent extends CommonObject
*
* @return void
*/
function initAsSpecimen()
public function initAsSpecimen()
{
global $user,$langs;
@@ -2400,7 +2403,7 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
@@ -2410,7 +2413,7 @@ class Adherent extends CommonObject
* 2=Return key only (uid=qqq)
* @return string DN
*/
function _load_ldap_dn($info, $mode = 0)
private function _load_ldap_dn($info, $mode = 0)
{
// phpcs:enable
global $conf;
@@ -2422,13 +2425,13 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Initialise tableau info (tableau des attributs LDAP)
*
* @return array Tableau info des attributs
*/
function _load_ldap_info()
private function _load_ldap_info()
{
// phpcs:enable
global $conf,$langs;
@@ -2536,7 +2539,7 @@ class Adherent extends CommonObject
* @param int $id Id of member to load
* @return void
*/
function info($id)
public function info($id)
{
$sql = 'SELECT a.rowid, a.datec as datec,';
$sql.= ' a.datevalid as datev,';
@@ -2592,7 +2595,7 @@ class Adherent extends CommonObject
*
* @return int Number of EMailings
*/
function getNbOfEMailings()
public function getNbOfEMailings()
{
$sql = "SELECT count(mc.email) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
@@ -2774,9 +2777,13 @@ class Adherent extends CommonObject
{
$adherent->fetch_thirdparty();
// Language code to use ($languagecodeformember) is default language of thirdparty, if no thirdparty, the language found from country of member then country of thirdparty, and if still not found we use the language of company.
$languagefromcountrycode = getLanguageCodeFromCountryCode($adherent->country_code ? $adherent->country_code : $adherent->thirdparty->country_code);
$languagecodeformember = (empty($adherent->thirdparty->default_lang) ? ($languagefromcountrycode ? $languagefromcountrycode : $mysoc->default_lang) : $adherent->thirdparty->default_lang);
// Send reminder email
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang);
$outputlangs->setDefaultLang($languagecodeformember);
$outputlangs->loadLangs(array("main", "members"));
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);

View File

@@ -89,7 +89,7 @@ class AdherentType extends CommonObject
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
$this->statut = 1;
@@ -103,7 +103,7 @@ class AdherentType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO
*/
function create($user, $notrigger = 0)
public function create($user, $notrigger = 0)
{
global $conf;
@@ -170,7 +170,7 @@ class AdherentType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO
*/
function update($user, $notrigger = 0)
public function update($user, $notrigger = 0)
{
global $conf, $hookmanager;
@@ -238,7 +238,7 @@ class AdherentType extends CommonObject
*
* @return int > 0 if OK, 0 if not found, < 0 if KO
*/
function delete()
public function delete()
{
global $user;
@@ -272,7 +272,7 @@ class AdherentType extends CommonObject
* @param int $rowid Id of member type to load
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid)
public function fetch($rowid)
{
$sql = "SELECT d.rowid, d.libelle as label, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
@@ -306,13 +306,13 @@ class AdherentType extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of members' type
*
* @return array List of types of members
*/
function liste_array()
public function liste_array()
{
// phpcs:enable
global $conf,$langs;
@@ -356,7 +356,7 @@ class AdherentType extends CommonObject
* 2=Return array of members id only
* @return mixed Array of members or -1 on error
*/
function listMembersForMemberType($excludefilter = '', $mode = 0)
public function listMembersForMemberType($excludefilter = '', $mode = 0)
{
global $conf, $user;
@@ -404,14 +404,14 @@ class AdherentType extends CommonObject
}
/**
* Return clicable name (with picto eventually)
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max label
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max label
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
{
global $langs;
@@ -434,12 +434,12 @@ class AdherentType extends CommonObject
*
* @return string Return status of a type of member
*/
function getLibStatut()
{
return '';
}
public function getLibStatut()
{
return '';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
@@ -449,7 +449,7 @@ class AdherentType extends CommonObject
* 2=Return key only (uid=qqq)
* @return string DN
*/
function _load_ldap_dn($info, $mode = 0)
private function _load_ldap_dn($info, $mode = 0)
{
// phpcs:enable
global $conf;
@@ -461,13 +461,13 @@ class AdherentType extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions
*
* @return array Tableau info des attributs
*/
function _load_ldap_info()
private function _load_ldap_info()
{
// phpcs:enable
global $conf,$langs;
@@ -502,7 +502,7 @@ class AdherentType extends CommonObject
*
* @return void
*/
function initAsSpecimen()
public function initAsSpecimen()
{
global $conf, $user, $langs;
@@ -530,7 +530,7 @@ class AdherentType extends CommonObject
*
* @return string Return mail content of type or empty
*/
function getMailOnValid()
public function getMailOnValid()
{
global $conf;
@@ -547,7 +547,7 @@ class AdherentType extends CommonObject
*
* @return string Return mail content of type or empty
*/
function getMailOnSubscription()
public function getMailOnSubscription()
{
global $conf;
@@ -565,16 +565,16 @@ class AdherentType extends CommonObject
*
* @return string Return mail model content of type or empty
*/
function getMailOnResiliate()
{
global $conf;
public function getMailOnResiliate()
{
global $conf;
// NOTE mail_resiliate not defined so never used
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
{
return $this->mail_resiliate;
}
// NOTE mail_resiliate not defined so never used
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
{
return $this->mail_resiliate;
}
return '';
}
return '';
}
}

View File

@@ -37,12 +37,12 @@ class AdherentStats extends Stats
*/
public $table_element;
var $socid;
var $userid;
public $socid;
public $userid;
var $from;
var $field;
var $where;
public $from;
public $field;
public $where;
/**
@@ -52,7 +52,7 @@ class AdherentStats extends Stats
* @param int $socid Id third party
* @param int $userid Id user for filter
*/
function __construct($db, $socid = 0, $userid = 0)
public function __construct($db, $socid = 0, $userid = 0)
{
global $user, $conf;
@@ -85,7 +85,7 @@ class AdherentStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of nb each month
*/
function getNbByMonth($year, $format = 0)
public function getNbByMonth($year, $format = 0)
{
global $user;
@@ -105,7 +105,7 @@ class AdherentStats extends Stats
*
* @return array Array of nb each year
*/
function getNbByYear()
public function getNbByYear()
{
global $user;
@@ -126,7 +126,7 @@ class AdherentStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of amount each month
*/
function getAmountByMonth($year, $format = 0)
public function getAmountByMonth($year, $format = 0)
{
global $user;
@@ -147,7 +147,7 @@ class AdherentStats extends Stats
* @param int $year Year
* @return array Array of average each month
*/
function getAverageByMonth($year)
public function getAverageByMonth($year)
{
global $user;
@@ -168,7 +168,7 @@ class AdherentStats extends Stats
*
* @return array Array with nb, total amount, average for each year
*/
function getAllByYear()
public function getAllByYear()
{
global $user;

View File

@@ -41,7 +41,7 @@ class Members extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -57,7 +57,7 @@ class Members extends DolibarrApi
*
* @throws RestException
*/
function get($id)
public function get($id)
{
if(! DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
@@ -91,7 +91,7 @@ class Members extends DolibarrApi
*
* @throws RestException
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '')
{
global $db, $conf;
@@ -162,7 +162,7 @@ class Members extends DolibarrApi
* @param array $request_data Request data
* @return int ID of member
*/
function post($request_data = null)
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401);
@@ -187,7 +187,7 @@ class Members extends DolibarrApi
* @param array $request_data Datas
* @return int
*/
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401);
@@ -242,7 +242,7 @@ class Members extends DolibarrApi
* @param int $id member ID
* @return array
*/
function delete($id)
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->adherent->supprimer) {
throw new RestException(401);
@@ -277,7 +277,7 @@ class Members extends DolibarrApi
*
* @throws RestException
*/
function _validate($data)
private function _validate($data)
{
$member = array();
foreach (Members::$FIELDS as $field) {
@@ -288,15 +288,16 @@ class Members extends DolibarrApi
return $member;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
// Remove the subscriptions because they are handled as a subresource.
@@ -328,7 +329,7 @@ class Members extends DolibarrApi
*
* @url GET {id}/subscriptions
*/
function getSubscriptions($id)
public function getSubscriptions($id)
{
$obj_ret = array();
@@ -361,7 +362,7 @@ class Members extends DolibarrApi
*
* @url POST {id}/subscriptions
*/
function createSubscription($id, $start_date, $end_date, $amount, $label = '')
public function createSubscription($id, $start_date, $end_date, $amount, $label = '')
{
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401);
@@ -389,7 +390,7 @@ class Members extends DolibarrApi
*
* @url GET {id}/categories
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);

View File

@@ -37,7 +37,7 @@ class MembersTypes extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -53,7 +53,7 @@ class MembersTypes extends DolibarrApi
*
* @throws RestException
*/
function get($id)
public function get($id)
{
if(! DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
@@ -86,7 +86,7 @@ class MembersTypes extends DolibarrApi
*
* @throws RestException
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -154,7 +154,7 @@ class MembersTypes extends DolibarrApi
* @param array $request_data Request data
* @return int ID of member type
*/
function post($request_data = null)
public function post($request_data = null)
{
if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401);
@@ -179,7 +179,7 @@ class MembersTypes extends DolibarrApi
* @param array $request_data Datas
* @return int
*/
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401);
@@ -220,7 +220,7 @@ class MembersTypes extends DolibarrApi
* @param int $id member type ID
* @return array
*/
function delete($id)
public function delete($id)
{
if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401);
@@ -255,7 +255,7 @@ class MembersTypes extends DolibarrApi
*
* @throws RestException
*/
function _validate($data)
private function _validate($data)
{
$membertype = array();
foreach (MembersTypes::$FIELDS as $field) {
@@ -266,15 +266,16 @@ class MembersTypes extends DolibarrApi
return $membertype;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->array_options);

View File

@@ -40,7 +40,7 @@ class Subscriptions extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -56,7 +56,7 @@ class Subscriptions extends DolibarrApi
*
* @throws RestException
*/
function get($id)
public function get($id)
{
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401);
@@ -85,7 +85,7 @@ class Subscriptions extends DolibarrApi
*
* @throws RestException
*/
function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -151,7 +151,7 @@ class Subscriptions extends DolibarrApi
* @param array $request_data Request data
* @return int ID of subscription
*/
function post($request_data = null)
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401);
@@ -176,7 +176,7 @@ class Subscriptions extends DolibarrApi
* @param array $request_data Datas
* @return int
*/
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401);
@@ -209,7 +209,7 @@ class Subscriptions extends DolibarrApi
* @param int $id ID of subscription to delete
* @return array
*/
function delete($id)
public function delete($id)
{
// The right to delete a subscription comes with the right to create one.
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
@@ -241,7 +241,7 @@ class Subscriptions extends DolibarrApi
*
* @throws RestException
*/
function _validate($data)
private function _validate($data)
{
$subscription = array();
foreach (Subscriptions::$FIELDS as $field) {

View File

@@ -32,78 +32,78 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/
class Subscription extends CommonObject
{
/**
* @var string ID to identify managed object
*/
public $element='subscription';
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element='subscription';
/**
* @var string ID to identify managed object
*/
public $element='subscription';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='payment';
* @var string Name of table without prefix where object is stored
*/
public $table_element='subscription';
public $datec; // Date creation
public $datem; // Date modification
public $dateh; // Subscription start date (date subscription)
public $datef; // Subscription end date
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto='payment';
/**
public $datec; // Date creation
public $datem; // Date modification
public $dateh; // Subscription start date (date subscription)
public $datef; // Subscription end date
/**
* @var int ID
*/
public $fk_type;
public $fk_adherent;
public $fk_type;
public $fk_adherent;
public $amount;
public $amount;
/**
/**
* @var int ID
*/
public $fk_bank;
public $fk_bank;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
}
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
/**
* Function who permitted cretaion of the subscription
*
* @param User $user User that create
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id subscription created if OK
*/
function create($user, $notrigger = false)
{
global $langs;
/**
* Function who permitted cretaion of the subscription
*
* @param User $user User that create
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id subscription created if OK
*/
public function create($user, $notrigger = false)
{
global $langs;
$error = 0;
$error = 0;
$now=dol_now();
$now=dol_now();
// Check parameters
if ($this->datef <= $this->dateh)
{
$this->error=$langs->trans("ErrorBadValueForDate");
return -1;
}
if (empty($this->datec)) $this->datec = $now;
// Check parameters
if ($this->datef <= $this->dateh)
{
$this->error=$langs->trans("ErrorBadValueForDate");
return -1;
}
if (empty($this->datec)) $this->datec = $now;
$this->db->begin();
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
if ($this->fk_type == null) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
@@ -113,338 +113,338 @@ class Subscription extends CommonObject
} else {
$type=$this->fk_type;
}
$sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->dateh)."',";
$sql.= " '".$this->db->idate($this->datef)."',";
$sql.= " ".$this->amount.",";
$sql.= " '".$this->db->escape($this->note_public?$this->note_public:$this->note)."')";
$sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->dateh)."',";
$sql.= " '".$this->db->idate($this->datef)."',";
$sql.= " ".$this->amount.",";
$sql.= " '".$this->db->escape($this->note_public?$this->note_public:$this->note)."')";
$resql = $this->db->query($sql);
if (! $resql) {
$error++;
$this->errors[] = $this->db->lasterror();
}
$resql = $this->db->query($sql);
if (! $resql) {
$error++;
$this->errors[] = $this->db->lasterror();
}
if (! $error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
}
if (! $error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
}
if (! $error && ! $notrigger)
{
// Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
if (! $error && ! $notrigger)
{
// Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return $this->id;
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return $this->id;
}
}
/**
* Method to load a subscription
*
* @param int $rowid Id subscription
* @return int <0 if KO, =0 if not found, >0 if OK
*/
function fetch($rowid)
{
/**
* Method to load a subscription
*
* @param int $rowid Id subscription
* @return int <0 if KO, =0 if not found, >0 if OK
*/
public function fetch($rowid)
{
$sql ="SELECT rowid, fk_type, fk_adherent, datec,";
$sql.=" tms,";
$sql.=" dateadh as dateh,";
$sql.=" datef,";
$sql.=" subscription, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."subscription";
$sql.=" WHERE rowid=".$rowid;
$sql.=" tms,";
$sql.=" dateadh as dateh,";
$sql.=" datef,";
$sql.=" subscription, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."subscription";
$sql.=" WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->fk_type = $obj->fk_type;
$this->fk_adherent = $obj->fk_adherent;
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->tms);
$this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->subscription;
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
return 1;
}
else
{
return 0;
}
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
}
$this->fk_type = $obj->fk_type;
$this->fk_adherent = $obj->fk_adherent;
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->tms);
$this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->subscription;
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
return 1;
}
else
{
return 0;
}
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
}
/**
* Update subscription
*
* @param User $user User who updated
* @param int $notrigger 0=Disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user, $notrigger = 0)
{
$error = 0;
/**
* Update subscription
*
* @param User $user User who updated
* @param int $notrigger 0=Disable triggers
* @return int <0 if KO, >0 if OK
*/
public function update($user, $notrigger = 0)
{
$error = 0;
$this->db->begin();
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".$this->fk_type.",";
$sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
$sql .= " subscription = '".price2num($this->amount)."',";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',";
$sql .= " datec='".$this->db->idate($this->datec)."',";
$sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null');
$sql .= " WHERE rowid = ".$this->id;
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".$this->fk_type.",";
$sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
$sql .= " subscription = '".price2num($this->amount)."',";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',";
$sql .= " datec='".$this->db->idate($this->datec)."',";
$sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null');
$sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user);
if (! $error && ! $notrigger) {
// Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user);
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
// End call triggers
}
}
else
{
$error++;
$this->error=$this->db->lasterror();
}
if (! $error && ! $notrigger) {
// Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user);
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
// End call triggers
}
}
else
{
$error++;
$this->error=$this->db->lasterror();
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return $this->id;
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return $this->id;
}
}
/**
* Delete a subscription
*
* @param User $user User that delete
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, 0 if not found, >0 if OK
*/
function delete($user, $notrigger = false)
{
$error = 0;
/**
* Delete a subscription
*
* @param User $user User that delete
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function delete($user, $notrigger = false)
{
$error = 0;
// It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline=new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank);
}
// It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline=new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank);
}
$this->db->begin();
$this->db->begin();
if (! $error) {
if (! $notrigger) {
// Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user);
if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
// End call triggers
}
}
if (! $error) {
if (! $notrigger) {
// Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user);
if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
// End call triggers
}
}
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$num=$this->db->affected_rows($resql);
if ($num)
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user);
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$num=$this->db->affected_rows($resql);
if ($num)
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user);
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
{
$result=$accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0)
{
$this->db->commit();
return 1;
}
else
{
$this->error=$accountline->error;
$this->db->rollback();
return -1;
}
}
else
{
$this->db->commit();
return 1;
}
}
else
{
$this->db->commit();
return 0;
}
}
else
{
$error++;
$this->error=$this->db->lasterror();
}
}
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
{
$result=$accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0)
{
$this->db->commit();
return 1;
}
else
{
$this->error=$accountline->error;
$this->db->rollback();
return -1;
}
}
else
{
$this->db->commit();
return 1;
}
}
else
{
$this->db->commit();
return 0;
}
}
else
{
$error++;
$this->error=$this->db->lasterror();
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return 1;
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return 1;
}
}
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $notooltip 1=Disable tooltip
* @param string $option Page for link ('', 'nolink', ...)
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1)
{
global $langs;
* @param string $option Page for link ('', 'nolink', ...)
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1)
{
global $langs;
$result='';
$result='';
$langs->load("members");
$langs->load("members");
$label=$langs->trans("ShowSubscription").': '.$this->ref;
$url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>';
$linkend = '</a>';
$picto='payment';
$picto='payment';
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
return $result;
}
return $result;
}
/**
* Retourne le libelle du statut d'une adhesion
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label
*/
function getLibStatut($mode = 0)
{
return '';
}
/**
* Retourne le libelle du statut d'une adhesion
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label
*/
public function getLibStatut($mode = 0)
{
return '';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @return string Label
*/
function LibStatut($statut)
{
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @return string Label
*/
public function LibStatut($statut)
{
// phpcs:enable
global $langs;
$langs->load("members");
return '';
}
global $langs;
$langs->load("members");
return '';
}
/**
* Load information of the subscription object
*
*
* @param int $id Id subscription
* @return void
*/
function info($id)
{
$sql = 'SELECT c.rowid, c.datec,';
$sql.= ' c.tms as datem';
$sql.= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql.= ' WHERE c.rowid = '.$id;
public function info($id)
{
$sql = 'SELECT c.rowid, c.datec,';
$sql.= ' c.tms as datem';
$sql.= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql.= ' WHERE c.rowid = '.$id;
$result=$this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
{
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$result=$this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
{
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
}
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
}
$this->db->free($result);
}
else
{
dol_print_error($this->db);
}
}
$this->db->free($result);
}
else
{
dol_print_error($this->db);
}
}
}

View File

@@ -511,7 +511,7 @@ if (! empty($arrayfields['state.nom']['checked']))
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100');
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>';
}
// Phone pro

560
htdocs/admin/bom.php Normal file
View File

@@ -0,0 +1,560 @@
<?php
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/bom.php
* \ingroup bom
* \brief Setup page of module BOM
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'errors', 'mrp', 'other'));
if (! $user->admin) accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'bom';
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask')
{
$maskconstbom=GETPOST('maskconstBom', 'alpha');
$maskbom=GETPOST('maskBom', 'alpha');
if ($maskconstbom) $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
elseif ($action == 'specimen')
{
$modele=GETPOST('module', 'alpha');
$bom = new BOM($db);
$bom->initAsSpecimen();
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db);
if ($module->write_file($bom, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bom&file=SPECIMEN.pdf");
return;
}
else
{
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
}
else
{
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
elseif ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
elseif ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->BOM_ADDON_PDF == "$value") dolibarr_del_const($db, 'BOM_ADDON_PDF', $conf->entity);
}
}
// Set default model
elseif ($action == 'setdoc')
{
if (dolibarr_set_const($db, "BOM_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->BOM_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
elseif ($action == 'setmod')
{
// TODO Check if numbering module chosen can be activated
// by calling method canBeActivated
dolibarr_set_const($db, "BOM_ADDON", $value, 'chaine', 0, '', $conf->entity);
}
elseif ($action == 'set_BOM_DRAFT_WATERMARK')
{
$draft = GETPOST("BOM_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
elseif ($action == 'set_BOM_FREE_TEXT')
{
$freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action=="setshippableiconinlist") {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_BOM_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
$form=new Form($db);
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader("", $langs->trans("BOMsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BOMsSetup"), $linkback, 'title_setup');
$head = bomAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("BOMs"), -1, 'bom');
/*
* BOMs Numbering model
*/
print load_fiche_titre($langs->trans("BOMsNumberingModules"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/bom/");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 8) == 'mod_bom_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once $dir.$file.'.php';
$module = new $file($db);
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->BOM_ADDON == $file)
{
print img_picto($langs->trans("Activated"), 'switch_on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
$bom=new BOM($db);
$bom->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$bom->type=0;
$nextval=$module->getNextValue($mysoc, $bom);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>';
} else {
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print "</tr>\n";
}
}
}
closedir($handle);
}
}
}
print "</table><br>\n";
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
/*
* Document templates generators
*/
print load_fiche_titre($langs->trans("BOMsModelModule"), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
$i = 0;
$num_rows=$db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
}
else
{
dol_print_error($db);
}
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
if (is_dir($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
$filelist[]=$file;
}
closedir($handle);
arsort($filelist);
foreach($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
}
else
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->BOM_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
print "<br>";
/*
* Other options
*/
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BOM_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='BOM_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
//Use draft Watermark
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_BOM_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftBOMs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="BOM_DRAFT_WATERMARK" value="'.$conf->global->BOM_DRAFT_WATERMARK.'">';
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
print '</table>';
print '<br>';
}
/*
* Notifications
*/
/*
print load_fiche_titre($langs->trans("Notifications"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr class="oddeven"><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td class="right">';
print "</td></tr>\n";
print '</table>';
*/
// End of page
llxFooter();
$db->close();

View File

@@ -300,7 +300,7 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled())
{
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print '</td>';

View File

@@ -69,7 +69,7 @@ class PrestaShopWebservice
* @param string $key Authentification key
* @param mixed $debug Debug mode Activated (true) or deactivated (false)
*/
function __construct($url, $key, $debug = true)
public function __construct($url, $key, $debug = true)
{
if (!extension_loaded('curl'))
throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library');
@@ -77,7 +77,7 @@ class PrestaShopWebservice
$this->key = $key;
$this->debug = $debug;
$this->version = 'unknown';
}
}
/**
* Take the status code and throw an exception if the server didn't return 200 or 201 code

View File

@@ -54,7 +54,7 @@ class Dolistore
*
* @param boolean $debug Enable debug of request on screen
*/
function __construct($debug = false)
public function __construct($debug = false)
{
global $conf, $langs;
@@ -77,7 +77,7 @@ class Dolistore
* @param array $options Options
* @return void
*/
function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
public function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
{
global $conf, $langs;
@@ -163,14 +163,14 @@ class Dolistore
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return tree of Dolistore categories. $this->categories must have been loaded before.
*
* @param int $parent Id of parent category
* @return string
*/
function get_categories($parent = 0)
public function get_categories($parent = 0)
{
// phpcs:enable
if (!isset($this->categories)) die('not possible');
@@ -212,13 +212,13 @@ class Dolistore
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of product formated for output
*
* @return string HTML output
*/
function get_products()
public function get_products()
{
// phpcs:enable
global $langs, $conf;
@@ -291,44 +291,44 @@ class Dolistore
</td>
<td class="margeCote">'.$download_link.'</td>
</tr>';
}
return $html;
}
}
return $html;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get previous link
*
* @param string $text symbol previous
* @return string html previous link
*/
function get_previous_link($text = '<<')
public function get_previous_link($text = '<<')
{
// phpcs:enable
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get next link
*
* @param string $text symbol next
* @return string html next link
*/
function get_next_link($text = '>>')
public function get_next_link($text = '>>')
{
// phpcs:enable
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get previous url
*
* @return string previous url
*/
function get_previous_url()
{
public function get_previous_url()
{
// phpcs:enable
$param_array = array();
if ($this->start < $this->per_page) {
@@ -343,15 +343,15 @@ class Dolistore
}
$param = http_build_query($param_array);
return $this->url."&".$param;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get next url
*
* @return string next url
*/
function get_next_url()
public function get_next_url()
{
// phpcs:enable
$param_array = array();
@@ -369,7 +369,7 @@ class Dolistore
return $this->url."&".$param;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* version compare
*
@@ -377,7 +377,7 @@ class Dolistore
* @param string $v2 version 2
* @return int result of compare
*/
function version_compare($v1, $v2)
public function version_compare($v1, $v2)
{
// phpcs:enable
$v1 = explode('.', $v1);

View File

@@ -457,10 +457,10 @@ if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouM
print load_fiche_titre($langs->trans("ModulesSetup"), $moreinfo, 'title_setup');
// Start to show page
if ($mode=='common') print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n";
if ($mode=='marketplace') print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
if ($mode=='deploy') print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";
if ($mode=='develop') print '<span class="opacitymedium">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n";
if ($mode=='common') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDesc")."</span><br>\n";
if ($mode=='marketplace') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
if ($mode=='deploy') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";
if ($mode=='develop') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n";
$head = modules_prepare_head();

View File

@@ -81,7 +81,7 @@ if ($action == 'addprinter' && $user->admin) {
}
if (! $error) {
$result= $printer->AddPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
$result= $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
if ($result > 0) $error++;
if (! $error)
@@ -107,7 +107,7 @@ if ($action == 'deleteprinter' && $user->admin) {
}
if (! $error) {
$result= $printer->DeletePrinter($printerid);
$result= $printer->deletePrinter($printerid);
if ($result > 0) $error++;
if (! $error)
@@ -133,7 +133,7 @@ if ($action == 'updateprinter' && $user->admin) {
}
if (! $error) {
$result= $printer->UpdatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
$result= $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
if ($result > 0) $error++;
if (! $error) {
@@ -156,7 +156,7 @@ if ($action == 'testprinter' && $user->admin) {
if (! $error) {
// test
$ret = $printer->SendTestToPrinter($printerid);
$ret = $printer->sendTestToPrinter($printerid);
if ($ret == 0) {
setEventMessages($langs->trans("TestSentToPrinter", $printername), null);
} else {
@@ -176,7 +176,7 @@ if ($action == 'updatetemplate' && $user->admin) {
}
if (! $error) {
$result= $printer->UpdateTemplate($templatename, $template, $templateid);
$result= $printer->updateTemplate($templatename, $template, $templateid);
if ($result > 0) $error++;
if (! $error) {

View File

@@ -212,7 +212,7 @@ if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i', $file, $reg))
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php$/i', $file, $reg))
{
// Charging the numbering class
$classname = $reg[1];
@@ -398,7 +398,6 @@ print '<td align="center">'.$langs->trans("Action").'</td>';
print '</tr>';
// Disable clear password in database
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>';
print '<td align="center" width="60">';
@@ -413,6 +412,8 @@ if (! $conf->global->DATABASE_PWD_ENCRYPTED)
print '<a href="security.php?action=activate_encrypt">'.$langs->trans("Activate").'</a>';
print "</td>";
}
// Database conf file encryption
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
{
print '<td align="center" width="100">';
@@ -494,9 +495,21 @@ print '</tr>';
print '</table>';
print '</form>';
print '<br>';
//print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
if (GETPOST('info', 'int') > 0)
{
if (function_exists('password_hash'))
{
print $langs->trans("Note: The function password_hash exists on your PHP")."<br>\n";
}
else
{
print $langs->trans("Note: The function password_hash does not exists on your PHP")."<br>\n";
}
print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."<br>\n";
print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT."<br>\n";
}
print '</div>';

View File

@@ -19,7 +19,7 @@
/**
* \file admin/ticket.php
* \ingroup ticket
* \brief This file is a module setup page
* \brief Page to setup module ticket
*/
require '../main.inc.php';
@@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
// Load translation files required by the page
$langs->load("ticket");
$langs->loadLangs(array("admin", "ticket"));
// Access control
if (!$user->admin) {
@@ -91,16 +91,6 @@ if ($action == 'updateMask') {
$error++;
}
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha');
if (!empty($mail_new_ticket)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
if (!empty($mail_intro)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
@@ -121,36 +111,6 @@ if ($action == 'updateMask') {
$error++;
}
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
if (!empty($text_help)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
@@ -163,26 +123,14 @@ if ($action == 'updateMask') {
}
if ($action == 'setvarother') {
$param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_disable_email = GETPOST('TICKET_DISABLE_ALL_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_ALL_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_activate_log_by_email = GETPOST('TICKET_ACTIVATE_LOG_BY_EMAIL', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ACTIVATE_LOG_BY_EMAIL', $param_activate_log_by_email, 'chaine', 0, '', $conf->entity);
$param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
@@ -242,9 +190,7 @@ $head = ticketAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket");
print $langs->trans("TicketSetupDictionaries") . ' : <a href="' . dol_buildpath('/admin/dict.php', 1) . '" >' . dol_buildpath('/admin/dict.php', 2) . '</a><br>';
print $langs->trans("TicketPublicAccess") . ' : <a href="' . dol_buildpath('/public/ticket/index.php', 1) . '" target="_blank" >' . dol_buildpath('/public/ticket/index.php', 2) . '</a>';
print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries") . '</span> : <a href="' . dol_buildpath('/admin/dict.php', 1) . '" >' . dol_buildpath('/admin/dict.php', 2) . '</a><br>';
dol_fiche_end();
@@ -353,80 +299,19 @@ if (!$conf->use_javascript_ajax) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvarother">';
}
print load_fiche_titre($langs->trans("TicketParamPublicInterface"));
print '<table class="noborder" width="100%">';
// Activate public interface
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsActivatePublicInterface") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_ENABLE_PUBLIC_INTERFACE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_ENABLE_PUBLIC_INTERFACE", $arrval, $conf->global->TICKET_ENABLE_PUBLIC_INTERFACE);
}
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketsActivatePublicInterfaceHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Check if email exists
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailMustExist") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
print '</td>';
print '</tr>';
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
// Show logo for module
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowModuleLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
}*/
// Show logo for company
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowCompanyLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '</table><br>';
print load_fiche_titre($langs->trans("TicketParams"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("Parameter") . '</td>';
print '<td></td>';
print '<td></td>';
print "</tr>\n";
// Activate email notifications
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsDisableEmail") . '</td>';
/*
print '<tr class="pair"><td>' . $langs->trans("TicketsDisableEmail") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_DISABLE_ALL_MAILS');
@@ -441,7 +326,7 @@ print '</td>';
print '</tr>';
// Activate log by email
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLogEnableEmail") . '</td>';
print '<tr class="pair"><td>' . $langs->trans("TicketsLogEnableEmail") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
@@ -454,11 +339,12 @@ print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help');
print '</td>';
print '</tr>';
*/
// Also send to main email address
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
@@ -474,7 +360,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
}
// Limiter la vue des tickets à ceux assignés à l'utilisateur
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLimitViewAssignedOnly") . '</td>';
/*
print '<tr class="pair"><td>' . $langs->trans("TicketsLimitViewAssignedOnly") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_LIMIT_VIEW_ASSIGNED_ONLY');
@@ -487,14 +374,15 @@ print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsLimitViewAssignedOnlyHelp"), 1, 'help');
print '</td>';
print '</tr>';
*/
if (!$conf->use_javascript_ajax) {
/*if (!$conf->use_javascript_ajax) {
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
}
}*/
// Auto assign ticket at user who created it
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
@@ -515,7 +403,7 @@ if (!$conf->use_javascript_ajax) {
}
// Admin var of module
print load_fiche_titre($langs->trans("TicketParamMail"));
print load_fiche_titre($langs->trans("Notification"));
print '<table class="noborder" width="100%">';
@@ -533,17 +421,26 @@ if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
print "</tr>\n";
}
// Email d'envoi des notifications
print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationFrom") . '</td>';
// Activate log by email
/*print '<tr class="pair"><td>' . $langs->trans("TicketsLogEnableEmail") . '</td>';
print '<td class="left">';
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '" size="20" ></td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help');
print '</td>';
print '</tr>';
*/
// @TODO Use module notification instead...
// Email de réception des notifications
print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationTo") . '</td>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketEmailNotificationTo") . '</td>';
print '<td class="left">';
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="' . (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : $conf->global->TICKET_NOTIFICATION_EMAIL_FROM) . '" size="20" ></td>';
print '<td align="center">';
@@ -551,21 +448,18 @@ print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1
print '</td>';
print '</tr>';
// Texte de création d'un ticket
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
print '<tr><td>' . $langs->trans("TicketNewEmailBodyLabel") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
$doleditor->Create();
print '</td>';
// Email d'envoi des notifications
print '<tr class="oddeven"><td>' . $langs->trans("TicketEmailNotificationFrom") . '</td>';
print '<td class="left">';
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '" size="20" ></td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
print '</td></tr>';
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Texte d'introduction
$mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
print '<tr><td>' . $langs->trans("TicketMessageMailIntroLabelAdmin") . '</label>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketMessageMailIntroLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
@@ -577,7 +471,7 @@ print '</td></tr>';
// Texte de signature
$mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText');
print '<tr><td>' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . '</label>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
@@ -587,58 +481,12 @@ print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
print '</td></tr>';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans("PublicInterface") . '</td>';
print "</tr>\n";
print '</table>';
// Url public interface
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
print '</td></tr>';
print '<div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '</div>';
// Interface topic
$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="' . $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
print '</td></tr>';
// Texte d'accueil homepage
$public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
print '</td></tr>';
// Texte d'aide à la saisie du message
$public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
print '</td></tr>';
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
print '</table><br>';
print '</form>';
// End of page

View File

@@ -0,0 +1,453 @@
<?php
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file admin/ticket_public.php
* \ingroup ticket
* \brief Page to public interface of module Ticket
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
// Load translation files required by the page
$langs->loadLangs(array("admin", "ticket"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters
$value = GETPOST('value', 'alpha');
$action = GETPOST('action', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'ticket';
if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE')
{
if (GETPOST('value')) dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
else dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
}
if ($action == 'setvar') {
include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
$notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
if (!empty($notification_email)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
// altairis : differentiate notification email FROM and TO
$notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
if (!empty($notification_email_to)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha');
if (!empty($mail_new_ticket)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
if (!empty($mail_intro)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
if (!empty($text_help)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
}
if ($action == 'setvarother') {
$param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
/*
* View
*/
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$form = new Form($db);
$help_url = "FR:Module_Ticket";
$page_name = "TicketSetup";
llxHeader('', $langs->trans($page_name), $help_url);
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
// Configuration header
$head = ticketAdminPrepareHead();
dol_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess") . '</span> : <a href="' . dol_buildpath('/public/ticket/index.php', 1) . '" target="_blank" >' . dol_buildpath('/public/ticket/index.php', 2) . '</a>';
dol_fiche_end();
$enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
// Button off, click to enable
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
$enabledisablehtml.=img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml.='</a>';
}
else
{
// Button on, click to disable
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
$enabledisablehtml.=img_picto($langs->trans("Activated"), 'switch_on');
$enabledisablehtml.='</a>';
}
print $enabledisablehtml;
print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)?0:1).'">';
print '<br><br>';
if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
if (!$conf->use_javascript_ajax) {
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvarother">';
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>' . $langs->trans("Parameters") . '</td>';
print '<td class="left">';
print '</td>';
print '<td class="center">';
print '</td>';
print '</tr>';
// Check if email exists
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailMustExist") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
print '</td>';
print '</tr>';
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
// Show logo for module
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowModuleLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
}*/
// Show logo for company
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowCompanyLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Also send to main email address
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
print '</td>';
print '</tr>';
}
if (!$conf->use_javascript_ajax) {
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
}
// Auto assign ticket at user who created it
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '</table><br>';
if (!$conf->use_javascript_ajax) {
print '</form>';
}
// Admin var of module
print load_fiche_titre($langs->trans("TicketParamMail"));
print '<table class="noborder" width="100%">';
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvar">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans("Parameter") . '</td>';
print "</tr>\n";
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
print '<tr>';
print '<td colspan="3"><div class="info">' . $langs->trans("TicketCkEditorEmailNotActivated") . '</div></td>';
print "</tr>\n";
}
// Url public interface
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
print '</td></tr>';
// Interface topic
$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="' . $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
print '</td></tr>';
// Texte d'accueil homepage
$public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
print '</td></tr>';
// Texte d'aide à la saisie du message
$public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
print '</td></tr>';
// Activate email creation to user
print '<tr class="pair"><td>' . $langs->trans("TicketsDisableCustomerEmail") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Texte de création d'un ticket
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
print '<tr><td>' . $langs->trans("TicketNewEmailBodyLabel") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
print '</td></tr>';
print '</table>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></div>';
print '</form>';
}
// End of page
llxFooter();
$db->close();

View File

@@ -37,7 +37,7 @@ class DolibarrApi
/**
* @var Restler $r Restler object
*/
var $r;
public $r;
/**
* Constructor
@@ -46,7 +46,7 @@ class DolibarrApi
* @param string $cachedir Cache dir
* @param boolean $refreshCache Update cache
*/
function __construct($db, $cachedir = '', $refreshCache = false)
public function __construct($db, $cachedir = '', $refreshCache = false)
{
global $conf, $dolibarr_main_url_root;
@@ -87,16 +87,16 @@ class DolibarrApi
);
}*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
// Remove $db object property for object
unset($object->db);
unset($object->isextrafieldmanaged);
@@ -208,6 +208,7 @@ class DolibarrApi
return $object;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Check user access to a resource
*
@@ -222,9 +223,9 @@ class DolibarrApi
* @return bool
* @throws RestException
*/
static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
protected static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
{
// phpcs:enable
// Features/modules to check
$featuresarray = array($resource);
if (preg_match('/&/', $resource)) {
@@ -240,16 +241,18 @@ class DolibarrApi
}
return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray, $resource_id, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Return if a $sqlfilters parameter is valid
*
* @param string $sqlfilters sqlfilter string
* @return boolean True if valid, False if not valid
*/
function _checkFilters($sqlfilters)
protected function _checkFilters($sqlfilters)
{
// phpcs:enable
//$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
$tmp=$sqlfilters;
@@ -271,14 +274,15 @@ class DolibarrApi
return true;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Function to forge a SQL criteria
*
* @param array $matches Array of found string by regex search
* @return string Forged criteria. Example: "t.field like 'abc%'"
*/
static function _forge_criteria_callback($matches)
protected static function _forge_criteria_callback($matches)
{
// phpcs:enable
global $db;

View File

@@ -173,20 +173,20 @@ class DolibarrApiAccess implements iAuthenticate
* @example Digest
* @example OAuth
*/
public function __getWWWAuthenticateString()
public function __getWWWAuthenticateString()
{
// phpcs:enable
return '';
}
/**
* Verify access
*
* @param array $m Properties of method
*
* @access private
* @return bool
*/
/**
* Verify access
*
* @param array $m Properties of method
*
* @access private
* @return bool
*/
public static function verifyAccess(array $m)
{
$requires = isset($m['class']['DolibarrApiAccess']['properties']['requires'])

View File

@@ -43,7 +43,7 @@ class Documents extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db;
$this->db = $db;
@@ -67,7 +67,7 @@ class Documents extends DolibarrApi
*
* @url GET /download
*/
public function index($module_part, $original_file='')
public function index($module_part, $original_file = '')
{
global $conf, $langs;
@@ -82,12 +82,11 @@ class Documents extends DolibarrApi
$entity=$conf->entity;
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
$accessallowed = $check_access['accessallowed'];
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];
$original_file = $check_access['original_file'];
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
{
if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
throw new RestException(401);
}
if (!$accessallowed) {
@@ -127,7 +126,7 @@ class Documents extends DolibarrApi
*
* @url PUT /builddoc
*/
public function builddoc($module_part, $original_file='', $doctemplate='', $langcode='')
public function builddoc($module_part, $original_file = '', $doctemplate = '', $langcode = '')
{
global $conf, $langs;
@@ -153,7 +152,7 @@ class Documents extends DolibarrApi
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file)) {
if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
throw new RestException(401);
}
if (!$accessallowed) {
@@ -245,7 +244,7 @@ class Documents extends DolibarrApi
*
* @url GET /
*/
function getDocumentsListByElement($modulepart, $id=0, $ref='', $sortfield='', $sortorder='')
public function getDocumentsListByElement($modulepart, $id = 0, $ref = '', $sortfield = '', $sortorder = '')
{
global $conf;
@@ -275,7 +274,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id;
}
else if ($modulepart == 'adherent' || $modulepart == 'member')
elseif ($modulepart == 'adherent' || $modulepart == 'member')
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@@ -291,7 +290,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member');
}
else if ($modulepart == 'propal' || $modulepart == 'proposal')
elseif ($modulepart == 'propal' || $modulepart == 'proposal')
{
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
@@ -307,7 +306,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal');
}
else if ($modulepart == 'commande' || $modulepart == 'order')
elseif ($modulepart == 'commande' || $modulepart == 'order')
{
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@@ -323,7 +322,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande');
}
else if ($modulepart == 'shipment' || $modulepart == 'expedition')
elseif ($modulepart == 'shipment' || $modulepart == 'expedition')
{
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
@@ -339,7 +338,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment');
}
else if ($modulepart == 'facture' || $modulepart == 'invoice')
elseif ($modulepart == 'facture' || $modulepart == 'invoice')
{
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@@ -355,7 +354,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
}
else if ($modulepart == 'produit' || $modulepart == 'product')
elseif ($modulepart == 'produit' || $modulepart == 'product')
{
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -371,7 +370,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product');
}
else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@@ -392,7 +391,7 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
}
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
if (empty($filearray)) {
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(! empty($object->Ref)?' or Ref '.$object->ref:'').' does not return any document.');
}
@@ -428,6 +427,7 @@ class Documents extends DolibarrApi
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64) {@example '' or 'base64'}
* @param int $overwriteifexists Overwrite file if exists (1 by default)
* @return string
*
* @throws 200
* @throws 400
@@ -437,7 +437,7 @@ class Documents extends DolibarrApi
*
* @url POST /upload
*/
public function post($filename, $modulepart, $ref='', $subdir='', $filecontent='', $fileencoding='', $overwriteifexists=0)
public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0)
{
global $db, $conf;
@@ -517,7 +517,7 @@ class Documents extends DolibarrApi
if($result == 0)
{
throw new RestException(404, "Object with ref '".$ref."' was not found.");
}
}
elseif ($result < 0)
{
throw new RestException(500, 'Error while fetching object.');
@@ -592,6 +592,7 @@ class Documents extends DolibarrApi
return dol_basename($destfile);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName
/**
* Validate fields before create or update object
*
@@ -599,7 +600,9 @@ class Documents extends DolibarrApi
* @return array
* @throws RestException
*/
function _validate_file($data) {
private function _validate_file($data)
{
// phpcs:enable
$result = array();
foreach (Documents::$DOCUMENT_FIELDS as $field) {
if (!isset($data[$field]))

View File

@@ -29,11 +29,11 @@ class Login
/**
* Constructor of the class
*/
function __construct()
public function __construct()
{
global $db;
$this->db = $db;
}
global $db;
$this->db = $db;
}
/**
* Login
@@ -136,5 +136,5 @@ class Login
'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
)
);
}
}
}

View File

@@ -38,7 +38,7 @@ class Setup extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db;
$this->db = $db;
@@ -61,7 +61,7 @@ class Setup extends DolibarrApi
* @throws 400 RestException
* @throws 200 OK
*/
function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
public function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
@@ -76,7 +76,7 @@ class Setup extends DolibarrApi
{
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@@ -128,7 +128,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getListOfCountries($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '')
public function getListOfCountries($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '')
{
$list = array();
@@ -195,7 +195,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getCountryByID($id, $lang = '')
public function getCountryByID($id, $lang = '')
{
$country = new Ccountry($this->db);
@@ -228,7 +228,7 @@ class Setup extends DolibarrApi
* @throws 400 RestException
* @throws 200 OK
*/
function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
public function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
@@ -273,14 +273,16 @@ class Setup extends DolibarrApi
return $list;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->error);
@@ -334,7 +336,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getListOfEventTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '')
public function getListOfEventTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '')
{
$list = array();
@@ -397,7 +399,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '')
public function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '')
{
$list = array();
@@ -442,7 +444,7 @@ class Setup extends DolibarrApi
return $list;
}
/**
* Get the list of currencies.
*
@@ -458,10 +460,10 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getListOfCurrencies($sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
public function getListOfCurrencies($sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
//TODO link with multicurrency module
//TODO link with multicurrency module
$sql = "SELECT t.code_iso, t.label, t.unicode";
$sql.= " FROM ".MAIN_DB_PREFIX."c_currencies as t";
$sql.= " WHERE t.active = ".$active;
@@ -516,7 +518,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getListOfExtrafields($sortfield = "t.pos", $sortorder = 'ASC', $type = '', $sqlfilters = '')
public function getListOfExtrafields($sortfield = "t.pos", $sortorder = 'ASC', $type = '', $sqlfilters = '')
{
$list = array();
@@ -595,7 +597,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getListOfTowns($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $active = 1, $sqlfilters = '')
public function getListOfTowns($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $active = 1, $sqlfilters = '')
{
$list = array();
@@ -659,7 +661,7 @@ class Setup extends DolibarrApi
* @throws 400 RestException
* @throws 200 OK
*/
function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
@@ -720,7 +722,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
public function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
@@ -780,13 +782,13 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
public function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
$sql = "SELECT rowid, code, pos, label, use_default, color, description";
$sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_severity as t";
$sql.= " WHERE t.active = ".$active;
$sql.= " WHERE t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
@@ -840,13 +842,13 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
$sql = "SELECT rowid, code, pos, label, use_default, description";
$sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_type as t";
$sql.= " WHERE t.active = ".$active;
$sql.= " WHERE t.active = ".$active;
if ($type) $sql.=" AND t.type LIKE '%" . $this->db->escape($type) . "%'";
if ($module) $sql.=" AND t.module LIKE '%" . $this->db->escape($module) . "%'";
// Add sql filters
@@ -898,7 +900,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
function getCheckIntegrity($target)
public function getCheckIntegrity($target)
{
global $langs, $conf;

View File

@@ -31,7 +31,7 @@ class Status
*
* @return array
*/
function index()
public function index()
{
global $conf;

View File

@@ -23,8 +23,6 @@
*/
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/**
* Class for Asset
@@ -312,7 +310,7 @@ class Asset extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -369,12 +367,12 @@ class Asset extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return the status
*
@@ -382,7 +380,7 @@ class Asset extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
static function LibStatut($status, $mode = 0)
public static function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -425,7 +423,7 @@ class Asset extends CommonObject
* @param int $id Id of order
* @return void
*/
function info($id)
public function info($id)
{
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
$sql.= ' fk_user_creat, fk_user_modif';

View File

@@ -76,7 +76,7 @@ class AssetType extends CommonObject
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
}
@@ -89,8 +89,8 @@ class AssetType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO
*/
function create($user, $notrigger = 0)
{
public function create($user, $notrigger = 0)
{
global $conf;
$error=0;
@@ -157,7 +157,7 @@ class AssetType extends CommonObject
$this->db->rollback();
return -1;
}
}
}
/**
* Met a jour en base donnees du type
@@ -166,7 +166,7 @@ class AssetType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO
*/
function update($user, $notrigger = 0)
public function update($user, $notrigger = 0)
{
global $conf, $hookmanager;
@@ -233,7 +233,7 @@ class AssetType extends CommonObject
*
* @return int >0 if OK, 0 if not found, < 0 if KO
*/
function delete()
public function delete()
{
global $user;
@@ -267,7 +267,7 @@ class AssetType extends CommonObject
* @param int $rowid Id of member type to load
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid)
public function fetch($rowid)
{
$sql = "SELECT d.rowid, d.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note";
$sql .= " FROM ".MAIN_DB_PREFIX."asset_type as d";
@@ -282,13 +282,13 @@ class AssetType extends CommonObject
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->label = $obj->label;
$this->accountancy_code_asset = $obj->accountancy_code_asset;
$this->accountancy_code_depreciation_asset = $obj->accountancy_code_depreciation_asset;
$this->accountancy_code_depreciation_expense = $obj->accountancy_code_depreciation_expense;
$this->note = $obj->note;
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->label = $obj->label;
$this->accountancy_code_asset = $obj->accountancy_code_asset;
$this->accountancy_code_depreciation_asset = $obj->accountancy_code_depreciation_asset;
$this->accountancy_code_depreciation_expense = $obj->accountancy_code_depreciation_expense;
$this->note = $obj->note;
}
return 1;
@@ -300,13 +300,13 @@ class AssetType extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of asset's type
*
* @return array List of types of members
*/
function liste_array()
public function liste_array()
{
// phpcs:enable
global $conf,$langs;
@@ -350,7 +350,7 @@ class AssetType extends CommonObject
* 2=Return array of asset id only
* @return mixed Array of asset or -1 on error
*/
function listAssetForAssetType($excludefilter = '', $mode = 0)
public function listAssetForAssetType($excludefilter = '', $mode = 0)
{
global $conf, $user;
@@ -405,7 +405,7 @@ class AssetType extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
{
global $langs;
@@ -430,8 +430,8 @@ class AssetType extends CommonObject
*
* @return void
*/
function initAsSpecimen()
{
public function initAsSpecimen()
{
global $conf, $user, $langs;
// Initialize parameters
@@ -446,15 +446,15 @@ class AssetType extends CommonObject
$this->asset=array(
$user->id => $user
);
}
}
/**
* getLibStatut
*
* @return string Return status of a type of asset
*/
function getLibStatut()
{
return '';
}
/**
* getLibStatut
*
* @return string Return status of a type of asset
*/
public function getLibStatut()
{
return '';
}
}

View File

@@ -53,7 +53,7 @@ class BlockedLogAuthority
public function __construct($db)
{
$this->db = $db;
}
}
/**
* Get the blockchain
@@ -76,7 +76,7 @@ class BlockedLogAuthority
}
return $this->blockchain;
}
}
/**
* Get hash of the block chain to check
@@ -87,7 +87,7 @@ class BlockedLogAuthority
{
return md5($this->signature.$this->blockchain);
}
}
/**
* Get hash of the block chain to check
@@ -99,7 +99,7 @@ class BlockedLogAuthority
{
return ($hash === $this->getBlockchainHash() );
}
}
/**
* Add a new block to the chain
@@ -111,7 +111,7 @@ class BlockedLogAuthority
{
$this->blockchain.=$block;
}
}
/**
* hash already exist into chain ?
@@ -132,7 +132,7 @@ class BlockedLogAuthority
else{
return false;
}
}
}
/**
@@ -191,7 +191,7 @@ class BlockedLogAuthority
$this->error=$this->db->error();
return -1;
}
}
}
/**
* Create authority in database.
@@ -245,7 +245,7 @@ class BlockedLogAuthority
$this->db->rollback();
return -1;
}
}
}
/**
* Create authority in database.
@@ -283,7 +283,7 @@ class BlockedLogAuthority
$this->db->rollback();
return -1;
}
}
}
/**
* For cron to sync to authority.
@@ -326,6 +326,6 @@ class BlockedLogAuthority
}
}
return 1;
}
return 1;
}
}

View File

@@ -291,8 +291,7 @@ class BlockedLog
}
elseif ($this->action == 'MODULE_RESET')
{
if ($this->signature == '0000000000')
{
if ($this->signature == '0000000000') {
return '<i class="opacitymedium">System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken.</i>';
}
else
@@ -387,14 +386,15 @@ class BlockedLog
$arrayoffieldstoexclude = array(
'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','last_main_doc','civility_id','contact','contact_id',
'table_element_line','ismultientitymanaged','isextrafieldmanaged',
'linkedObjectsIds','linkedObjects','fk_delivery_address',
'linkedObjectsIds',
'linkedObjects',
'fk_delivery_address',
'context',
'projet' // There is already ->fk_project
);
// Add more fields to exclude depending on object type
if ($this->element == 'cashcontrol')
{
$arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array(
if ($this->element == 'cashcontrol') {
$arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array(
'name','lastname','firstname','region','region_id','region_code','state','state_id','state_code','country','country_id','country_code',
'total_ht','total_tva','total_ttc','total_localtax1','total_localtax2',
'barcode_type','barcode_type_code','barcode_type_label','barcode_type_coder','mode_reglement_id','cond_reglement_id','mode_reglement','cond_reglement','shipping_method_id',
@@ -727,15 +727,12 @@ class BlockedLog
*/
public function dolDecodeBlockedData($data, $mode = 0)
{
try
{
try {
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$aaa = unserialize($data);
//$aaa = unserialize($data);
}
catch(Exception $e)
{
} catch(Exception $e) {
//print $e->getErrs);
}
return $aaa;
@@ -1064,14 +1061,14 @@ class BlockedLog
}
/**
* Check if module was already used or not for at least one recording.
*
* @param int $ignoresystem Ignore system events for the test
* @return bool
*/
function alreadyUsed($ignoresystem = 0)
{
/**
* Check if module was already used or not for at least one recording.
*
* @param int $ignoresystem Ignore system events for the test
* @return bool
*/
public function alreadyUsed($ignoresystem = 0)
{
global $conf;
$result = false;
@@ -1092,5 +1089,5 @@ class BlockedLog
dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".$result);
return $result;
}
}
}

View File

@@ -44,7 +44,7 @@ require_once '../lib/bom.lib.php';
//require_once "../class/myclass.class.php";
// Translations
$langs->loadLangs(array("admin", "bom@bom"));
$langs->loadLangs(array("admin", "mrp"));
// Access control
if (! $user->admin) accessforbidden();
@@ -78,11 +78,11 @@ llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom@bom');
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom');
// Configuration header
$head = bomAdminPrepareHead();
dol_fiche_head($head, 'settings', '', -1, "bom@bom");
dol_fiche_head($head, 'settings', '', -1, "bom");
// Setup page goes here
echo $langs->trans("BomSetupPage").'<br><br>';

View File

@@ -63,7 +63,7 @@ dol_include_once('/bom/class/bom.class.php');
dol_include_once('/bom/lib/bom_bom.lib.php');
// Load translation files required by the page
$langs->loadLangs(array("bom@bom","other"));
$langs->loadLangs(array("mrp","other"));
// Get parameters
$id = GETPOST('id', 'int');
@@ -88,7 +88,7 @@ $search_all=trim(GETPOST("search_all", 'alpha'));
$search=array();
foreach($object->fields as $key => $val)
{
if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
}
if (empty($action) && empty($id) && empty($ref)) $action='view';
@@ -115,15 +115,15 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
$error=0;
$error=0;
$permissiontoadd = $user->rights->bom->write;
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
$permissiontoadd = $user->rights->bom->write;
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = dol_buildpath('/bom/bom_list.php', 1);
if (empty($backtopage)) {
if (empty($id)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/bom/bom_card.php', 1).($id > 0 ? $id : '__ID__');
}
if (empty($backtopage)) {
if (empty($id)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/bom/bom_card.php', 1).($id > 0 ? $id : '__ID__');
}
$triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, delete or clone
@@ -154,7 +154,7 @@ if (empty($reshook))
$form=new Form($db);
$formfile=new FormFile($db);
llxHeader('', 'BillOfMaterials', '');
llxHeader('', 'NewBOM', '');
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
@@ -175,7 +175,7 @@ jQuery(document).ready(function() {
// Part to create
if ($action == 'create')
{
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("BillOfMaterials")));
print load_fiche_titre($langs->trans("NewBOM"));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -243,7 +243,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$res = $object->fetch_optionals();
$head = bomPrepareHead($object);
dol_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom@bom');
dol_fiche_head($head, 'card', $langs->trans("NewBOM"), -1, 'bom');
$formconfirm = '';

View File

@@ -45,7 +45,7 @@ dol_include_once('/bom/class/bom.class.php');
dol_include_once('/bom/lib/bom_bom.lib.php');
// Load translation files required by the page
$langs->loadLangs(array("bom@bom","companies","other","mails"));
$langs->loadLangs(array("mrp","companies","other","mails"));
$action=GETPOST('action', 'aZ09');
@@ -110,7 +110,7 @@ if ($object->id)
*/
$head = bomPrepareHead($object);
dol_fiche_head($head, 'document', $langs->trans("BillOfMaterials"), -1, 'bom@bom');
dol_fiche_head($head, 'document', $langs->trans("BillOfMaterials"), -1, 'bom');
// Build file list

View File

@@ -62,7 +62,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
dol_include_once('/bom/class/bom.class.php');
// Load translation files required by the page
$langs->loadLangs(array("bom@bom", "other"));
$langs->loadLangs(array("mrp", "other"));
$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
@@ -199,7 +199,7 @@ $now=dol_now();
//$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials";
$help_url='';
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("BillOfMaterialss"));
$title = $langs->trans('ListOfBOMs');
// Build and execute select
@@ -478,19 +478,19 @@ while ($i < min($num, $limit))
if (isset($obj->$key)) $object->$key = $obj->$key;
}
// Show here line of result
print '<tr class="oddeven">';
foreach($object->fields as $key => $val)
{
// Show here line of result
print '<tr class="oddeven">';
foreach($object->fields as $key => $val)
{
$cssforfield='';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
if (! empty($arrayfields['t.'.$key]['checked']))
{
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td';
if ($cssforfield || $val['css']) print ' class="';
print $cssforfield;
@@ -506,8 +506,8 @@ while ($i < min($num, $limit))
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
$totalarray['val']['t.'.$key] += $obj->$key;
}
}
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook

View File

@@ -41,7 +41,7 @@ dol_include_once('/bom/class/bom.class.php');
dol_include_once('/bom/lib/bom_bom.lib.php');
// Load translation files required by the page
$langs->loadLangs(array("bom@bom","companies"));
$langs->loadLangs(array("mrp","companies"));
// Get parameters
$id = GETPOST('id', 'int');
@@ -95,7 +95,7 @@ if ($id > 0 || ! empty($ref))
$head = bomPrepareHead($object);
dol_fiche_head($head, 'note', $langs->trans("BillOfMaterials"), -1, 'bom@bom');
dol_fiche_head($head, 'note', $langs->trans("BillOfMaterials"), -1, 'bom');
// Object card
// ------------------------------------------------------------

View File

@@ -56,7 +56,7 @@ class BillOfMaterialsApi extends DolibarrApi
* @url GET /
*
*/
function __construct()
public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -74,7 +74,7 @@ class BillOfMaterialsApi extends DolibarrApi
* @url GET boms/{id}
* @throws RestException
*/
function get($id)
public function get($id)
{
if(! DolibarrApiAccess::$user->rights->bom->read) {
throw new RestException(401);
@@ -109,7 +109,7 @@ class BillOfMaterialsApi extends DolibarrApi
*
* @url GET /boms/
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -196,7 +196,7 @@ class BillOfMaterialsApi extends DolibarrApi
*
* @url POST boms/
*/
function post($request_data = null)
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->bom->create) {
throw new RestException(401);
@@ -222,7 +222,7 @@ class BillOfMaterialsApi extends DolibarrApi
*
* @url PUT boms/{id}
*/
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->bom->create) {
throw new RestException(401);
@@ -255,7 +255,7 @@ class BillOfMaterialsApi extends DolibarrApi
*
* @url DELETE bom/{id}
*/
function delete($id)
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->bom->delete) {
throw new RestException(401);
@@ -283,14 +283,16 @@ class BillOfMaterialsApi extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
/*unset($object->note);
@@ -311,7 +313,7 @@ class BillOfMaterialsApi extends DolibarrApi
*
* @throws RestException
*/
function _validate($data)
private function _validate($data)
{
$bom = array();
foreach (BillOfMaterialsApi::$FIELDS as $field) {

View File

@@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@@ -19,7 +18,7 @@
/**
* \file class/bom.class.php
* \ingroup bom
* \brief This file is a CRUD class file for BillOfMaterials (Create/Read/Update/Delete)
* \brief This file is a CRUD class file for BOM (Create/Read/Update/Delete)
*/
// Put here all includes required by your class file
@@ -28,9 +27,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/**
* Class for BillOfMaterials
* Class for BOM
*/
class BillOfMaterials extends CommonObject
class BOM extends CommonObject
{
/**
* @var string ID to identify managed object
@@ -45,7 +44,7 @@ class BillOfMaterials extends CommonObject
/**
* @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 0;
public $ismultientitymanaged = 1;
/**
* @var int Does bom support extrafields ? 0=No, 1=Yes
@@ -55,7 +54,10 @@ class BillOfMaterials extends CommonObject
/**
* @var string String with name of icon for bom. Must be the part after the 'object_' into object_bom.png
*/
public $picto = 'bom@bom';
public $picto = 'bom';
public $table_element_line = 'bom_bomline';
/**
@@ -83,8 +85,8 @@ class BillOfMaterials extends CommonObject
*/
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text", 'showoncombobox'=>'1',),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,),
@@ -93,9 +95,9 @@ class BillOfMaterials extends CommonObject
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Actif', '-1'=>'Inactif')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1,),
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'isameasure'=>'1',),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1',),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Enabled', '-1'=>'Disabled')),
);
public $rowid;
public $ref;
@@ -398,7 +400,7 @@ class BillOfMaterials extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -487,7 +489,7 @@ class BillOfMaterials extends CommonObject
if (empty($this->labelstatus))
{
global $langs;
//$langs->load("bom");
//$langs->load("mrp");
$this->labelstatus[1] = $langs->trans('Enabled');
$this->labelstatus[0] = $langs->trans('Disabled');
}
@@ -588,7 +590,8 @@ class BillOfMaterials extends CommonObject
*/
public function initAsSpecimen()
{
$this->initAsSpecimenCommon();
$this->initAsSpecimenCommon();
$this->date = $this->date_creation;
}
@@ -979,11 +982,11 @@ class BillOfMaterialsLine extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs, $hookmanager;
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
@@ -1043,7 +1046,7 @@ class BillOfMaterialsLine extends CommonObject
else $result .= $hookmanager->resPrint;
return $result;
}
}
/**
* Return label of the status
@@ -1070,7 +1073,7 @@ class BillOfMaterialsLine extends CommonObject
if (empty($this->labelstatus))
{
global $langs;
//$langs->load("bom");
//$langs->load("mrp");
$this->labelstatus[1] = $langs->trans('Enabled');
$this->labelstatus[0] = $langs->trans('Disabled');
}
@@ -1179,7 +1182,7 @@ class BillOfMaterialsLine extends CommonObject
* Action executed by scheduler
* CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters'
*
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/
//public function doScheduledJob($param1, $param2, ...)
public function doScheduledJob()

View File

@@ -30,12 +30,12 @@ function bomAdminPrepareHead()
{
global $langs, $conf;
$langs->load("bom@bom");
$langs->load("mrp");
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/bom/admin/setup.php", 1);
$head[$h][0] = DOL_URL_ROOT."/admin/bom.php";
$head[$h][1] = $langs->trans("Settings");
$head[$h][2] = 'settings';
$h++;
@@ -72,7 +72,7 @@ function bomPrepareHead($object)
{
global $db, $langs, $conf;
$langs->load("bom@bom");
$langs->load("mrp");
$h = 0;
$head = array();
@@ -118,7 +118,7 @@ function bomPrepareHead($object)
//$this->tabs = array(
// 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__'
//); // to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@bom');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom');
return $head;
}

View File

@@ -82,7 +82,7 @@ class Bookmark extends CommonObject
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
}
@@ -93,7 +93,7 @@ class Bookmark extends CommonObject
* @param int $id Bookmark Id Loader
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
public function fetch($id)
{
global $conf;
@@ -135,7 +135,7 @@ class Bookmark extends CommonObject
*
* @return int <0 si ko, rowid du bookmark cree si ok
*/
function create()
public function create()
{
global $conf;
@@ -192,7 +192,7 @@ class Bookmark extends CommonObject
*
* @return int <0 if KO, > if OK
*/
function update()
public function update()
{
// Clean parameters
$this->url=trim($this->url);
@@ -227,7 +227,7 @@ class Bookmark extends CommonObject
* @param int $id Id removed bookmark
* @return int <0 si ko, >0 si ok
*/
function remove($id)
public function remove($id)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE rowid = ".$id;
@@ -268,7 +268,7 @@ class Bookmark extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status
*/
function getLibStatut($mode)
public function getLibStatut($mode)
{
return '';
}

View File

@@ -60,7 +60,7 @@ class Auth
* @param string $aPasswd Password
* @return void
*/
function passwd($aPasswd)
public function passwd($aPasswd)
{
$this->passwd = $aPasswd;
}

View File

@@ -53,7 +53,7 @@ class Categories extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -70,7 +70,7 @@ class Categories extends DolibarrApi
*
* @throws RestException
*/
function get($id)
public function get($id)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
@@ -103,7 +103,7 @@ class Categories extends DolibarrApi
*
* @throws RestException
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '')
{
global $db, $conf;
@@ -173,7 +173,7 @@ class Categories extends DolibarrApi
* @param array $request_data Request data
* @return int ID of category
*/
function post($request_data = null)
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401);
@@ -198,7 +198,7 @@ class Categories extends DolibarrApi
* @param array $request_data Datas
* @return int
*/
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401);
@@ -234,7 +234,7 @@ class Categories extends DolibarrApi
* @param int $id Category ID
* @return array
*/
function delete($id)
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->categorie->supprimer) {
throw new RestException(401);
@@ -261,15 +261,16 @@ class Categories extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param Categorie $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
// Remove fields not relevent to categories
@@ -324,7 +325,7 @@ class Categories extends DolibarrApi
*
* @throws RestException
*/
function _validate($data)
private function _validate($data)
{
$category = array();
foreach (Categories::$FIELDS as $field) {

View File

@@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.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
@@ -107,7 +107,7 @@ class Categorie extends CommonObject
'account' => 'account', // old for bank_account
'bank_account' => 'account',
'project' => 'project',
);
);
/**
* @var array Category tables mapping from type string
@@ -221,7 +221,7 @@ class Categorie extends CommonObject
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
}
@@ -234,7 +234,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('product', '...') or (0, 1, ...)
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $label = '', $type = null)
public function fetch($id, $label = '', $type = null)
{
global $conf;
@@ -297,15 +297,15 @@ class Categorie extends CommonObject
}
/**
* Add category into database
* Add category into database
*
* @param User $user Object user
* @return int -1 : SQL error
* @param User $user Object user
* @return int -1 : SQL error
* -2 : new ID unknown
* -3 : Invalid category
* -4 : category already exists
*/
function create($user)
public function create($user)
{
global $conf,$langs,$hookmanager;
$langs->load('categories');
@@ -426,7 +426,7 @@ class Categorie extends CommonObject
* -1 : SQL error
* -2 : invalid category
*/
function update(User $user)
public function update(User $user)
{
global $conf, $langs,$hookmanager;
@@ -501,7 +501,7 @@ class Categorie extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 KO >0 OK
*/
function delete($user, $notrigger = 0)
public function delete($user, $notrigger = 0)
{
global $conf,$langs;
@@ -580,7 +580,7 @@ class Categorie extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Link an object to the category
*
@@ -588,7 +588,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('product', ...)
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked
*/
function add_type($obj, $type)
public function add_type($obj, $type)
{
// phpcs:enable
global $user,$langs,$conf;
@@ -682,7 +682,7 @@ class Categorie extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Delete object from category
*
@@ -691,7 +691,7 @@ class Categorie extends CommonObject
*
* @return int 1 if OK, -1 if KO
*/
function del_type($obj, $type)
public function del_type($obj, $type)
{
// phpcs:enable
global $user,$langs,$conf;
@@ -749,7 +749,7 @@ class Categorie extends CommonObject
* @return array|int -1 if KO, array of instance of object if OK
* @see containsObject
*/
function getObjectsInCateg($type, $onlyids = 0)
public function getObjectsInCateg($type, $onlyids = 0)
{
$objs = array();
@@ -796,7 +796,7 @@ class Categorie extends CommonObject
* @return int Number of occurrences
* @see getObjectsInCateg
*/
function containsObject($type, $object_id)
public function containsObject($type, $object_id)
{
$sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type];
$sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $object_id;
@@ -821,7 +821,7 @@ class Categorie extends CommonObject
* @param int $page Page number
* @return array|int Array of categories, 0 if no cat, -1 on error
*/
function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
global $conf;
@@ -907,13 +907,13 @@ class Categorie extends CommonObject
return $categories;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return childs of a category
*
* @return array|int <0 KO, array ok
*/
function get_filles()
public function get_filles()
{
// phpcs:enable
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
@@ -974,7 +974,7 @@ class Categorie extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Rebuilding the category tree as an array
* Return an array of table('id','id_mere',...) trie selon arbre et avec:
@@ -990,7 +990,7 @@ class Categorie extends CommonObject
*
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
*/
function get_full_arbo($type, $markafterid = 0)
public function get_full_arbo($type, $markafterid = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -1068,7 +1068,7 @@ class Categorie extends CommonObject
return $this->cats;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel
*
@@ -1076,10 +1076,10 @@ class Categorie extends CommonObject
* @param int $protection Deep counter to avoid infinite loop
* @return void
*/
function build_path_from_id_categ($id_categ, $protection = 1000)
{
public function build_path_from_id_categ($id_categ, $protection = 1000)
{
// phpcs:enable
dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
if (! empty($this->cats[$id_categ]['fullpath']))
{
@@ -1109,16 +1109,16 @@ class Categorie extends CommonObject
// We count number of _ to have level
$this->cats[$id_categ]['level']=dol_strlen(preg_replace('/[^_]/i', '', $this->cats[$id_categ]['fullpath']));
return;
}
return;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Display content of $this->cats
*
* @return void
*/
function debug_cats()
public function debug_cats()
{
// phpcs:enable
// Display $this->cats
@@ -1135,7 +1135,7 @@ class Categorie extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns all categories
*
@@ -1143,7 +1143,7 @@ class Categorie extends CommonObject
* @param boolean $parent Just parent categories if true
* @return array|int Table of Object Category, -1 on error
*/
function get_all_categories($type = null, $parent = false)
public function get_all_categories($type = null, $parent = false)
{
// phpcs:enable
if (! is_numeric($type)) $type = $this->MAP_ID[$type];
@@ -1174,13 +1174,13 @@ class Categorie extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Check if no category with same label already exists for this cat's parent or root and for this cat's type
*
* @return integer 1 if already exist, 0 otherwise, -1 if error
*/
function already_exists()
public function already_exists()
{
// phpcs:enable
$type=$this->type;
@@ -1225,20 +1225,20 @@ class Categorie extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the top level categories (which are not girls)
*
* @param int $type Type of category (0, 1, ...)
* @return array
*/
function get_main_categories($type = null)
public function get_main_categories($type = null)
{
// phpcs:enable
return $this->get_all_categories($type, true);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the path of the category, with the names of the categories
* separated by $sep (" >> " by default)
@@ -1248,7 +1248,7 @@ class Categorie extends CommonObject
* @param int $nocolor 0
* @return array
*/
function print_all_ways($sep = " &gt;&gt; ", $url = '', $nocolor = 0)
public function print_all_ways($sep = " &gt;&gt; ", $url = '', $nocolor = 0)
{
// phpcs:enable
$ways = array();
@@ -1297,13 +1297,13 @@ class Categorie extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns an array containing the list of parent categories
*
* @return int|array <0 KO, array OK
*/
function get_meres()
public function get_meres()
{
// phpcs:enable
$parents = array();
@@ -1333,14 +1333,14 @@ class Categorie extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns in a table all possible paths to get to the category
* starting with the major categories represented by Tables of categories
*
* @return array
*/
function get_all_ways()
public function get_all_ways()
{
// phpcs:enable
$ways = array();
@@ -1374,9 +1374,9 @@ class Categorie extends CommonObject
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels, 'id'= Get array of category IDs
* @return array|int Array of category objects or < 0 if KO
* @return Categorie[]|int Array of category objects or < 0 if KO
*/
function containing($id, $type, $mode = 'object')
public function containing($id, $type, $mode = 'object')
{
$cats = array();
@@ -1456,9 +1456,9 @@ class Categorie extends CommonObject
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated.
* @param boolean $exact Exact string search (true/false)
* @param boolean $case Case sensitive (true/false)
* @return array|int Array of category id, -1 if error
* @return Categorie[]|int Array of Categorie, -1 if error
*/
function rechercher($id, $nom, $type, $exact = false, $case = false)
public function rechercher($id, $nom, $type, $exact = false, $case = false)
{
// Deprecation warning
if (is_numeric($type)) {
@@ -1467,15 +1467,15 @@ class Categorie extends CommonObject
$cats = array();
// For backward compatibility
if (is_numeric($type)) {
// We want to reverse lookup
$map_type = array_flip($this->MAP_ID);
$type = $map_type[$type];
// For backward compatibility
if (is_numeric($type)) {
// We want to reverse lookup
$map_type = array_flip($this->MAP_ID);
$type = $map_type[$type];
dol_syslog(get_class($this) . "::rechercher(): numeric types are deprecated, please use string instead", LOG_WARNING);
}
}
// Generation requete recherche
// Generation requete recherche
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "categorie";
$sql .= " WHERE type = " . $this->MAP_ID[$type];
$sql .= " AND entity IN (" . getEntity('category') . ")";
@@ -1521,7 +1521,7 @@ class Categorie extends CommonObject
* @param int $maxlength Max length of text
* @return string Chaine avec URL
*/
function getNomUrl($withpicto = 0, $option = '', $maxlength = 0)
public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0)
{
global $langs;
@@ -1548,7 +1548,7 @@ class Categorie extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Deplace fichier uploade sous le nom $files dans le repertoire sdir
*
@@ -1556,7 +1556,7 @@ class Categorie extends CommonObject
* @param string $file Nom du fichier uploade
* @return void
*/
function add_photo($sdir, $file)
public function add_photo($sdir, $file)
{
// phpcs:enable
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -1599,7 +1599,7 @@ class Categorie extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return tableau de toutes les photos de la categorie
*
@@ -1607,7 +1607,7 @@ class Categorie extends CommonObject
* @param int $nbmax Nombre maximum de photos (0=pas de max)
* @return array Tableau de photos
*/
function liste_photos($dir, $nbmax = 0)
public function liste_photos($dir, $nbmax = 0)
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
@@ -1656,14 +1656,14 @@ class Categorie extends CommonObject
return $tabobj;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Efface la photo de la categorie et sa vignette
*
* @param string $file Path to file
* @return void
*/
function delete_photo($file)
public function delete_photo($file)
{
// phpcs:enable
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -1686,14 +1686,14 @@ class Categorie extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load size of image file
*
* @param string $file Path to file
* @return void
*/
function get_image_size($file)
public function get_image_size($file)
{
// phpcs:enable
$infoImg = getimagesize($file); // Recuperation des infos de l'image
@@ -1708,7 +1708,7 @@ class Categorie extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
function setMultiLangs($user)
public function setMultiLangs($user)
{
global $langs;
@@ -1789,7 +1789,7 @@ class Categorie extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
function getMultiLangs()
public function getMultiLangs()
{
global $langs;
@@ -1828,7 +1828,7 @@ class Categorie extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status
*/
function getLibStatut($mode)
public function getLibStatut($mode)
{
return '';
}
@@ -1841,7 +1841,7 @@ class Categorie extends CommonObject
*
* @return void
*/
function initAsSpecimen()
public function initAsSpecimen()
{
dol_syslog(get_class($this)."::initAsSpecimen");
@@ -1855,20 +1855,20 @@ class Categorie extends CommonObject
$this->type = self::TYPE_PRODUCT;
}
/**
* Function used to replace a thirdparty id with another one.
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
{
$tables = array(
'categorie_societe'
);
/**
* Function used to replace a thirdparty id with another one.
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
{
$tables = array(
'categorie_societe'
);
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1);
}
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1);
}
}

View File

@@ -682,7 +682,7 @@ if ($action == 'create')
dol_fiche_head();
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
// Type of event
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
@@ -849,7 +849,7 @@ if ($action == 'create')
print '<br><hr><br>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
if ($conf->societe->enabled)
{
@@ -1078,7 +1078,7 @@ if ($id > 0)
dol_fiche_head($head, 'card', $langs->trans("Action"), 0, 'action');
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
// Ref
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
@@ -1259,7 +1259,7 @@ if ($id > 0)
print '<br><hr><br>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
if ($conf->societe->enabled)
{
@@ -1455,7 +1455,7 @@ if ($id > 0)
print '<div class="underbanner clearboth"></div>';
// Affichage fiche action en mode visu
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
// Type
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
@@ -1558,7 +1558,7 @@ if ($id > 0)
print '<br>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
if ($conf->societe->enabled)
{

View File

@@ -480,13 +480,13 @@ class ActionComm extends CommonObject
}
/**
* Load an object from its id and create a new one in database
* Load an object from its id and create a new one in database
*
* @param user $fuser Object user making action
* @param int $socid Id of thirdparty
* @return int New id of clone
* @param user $fuser Object user making action
* @param int $socid Id of thirdparty
* @return int New id of clone
*/
function createFromClone($fuser, $socid)
public function createFromClone($fuser, $socid)
{
global $db, $user, $langs, $conf, $hookmanager;
@@ -502,7 +502,7 @@ class ActionComm extends CommonObject
// fetch optionals attributes and labels
$this->fetch_optionals();
// $this->fetch_userassigned();
//$this->fetch_userassigned();
$this->fetchResources();
$this->id=0;
@@ -559,14 +559,14 @@ class ActionComm extends CommonObject
}
/**
* Load object from database
* Load object from database
*
* @param int $id Id of action to get
* @param string $ref Ref of action to get
* @param string $ref_ext Ref ext to get
* @return int <0 if KO, >0 if OK
* @param int $id Id of action to get
* @param string $ref Ref of action to get
* @param string $ref_ext Ref ext to get
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $ref = '', $ref_ext = '')
public function fetch($id, $ref = '', $ref_ext = '')
{
global $langs;
@@ -637,11 +637,11 @@ class ActionComm extends CommonObject
$this->usermodid = $obj->fk_user_mod;
if (!is_object($this->author)) $this->author = new stdClass(); // To avoid warning
$this->author->id = $obj->fk_user_author; // deprecated
$this->author->firstname = $obj->firstname; // deprecated
$this->author->lastname = $obj->lastname; // deprecated
$this->author->id = $obj->fk_user_author; // deprecated
$this->author->firstname = $obj->firstname; // deprecated
$this->author->lastname = $obj->lastname; // deprecated
if (!is_object($this->usermod)) $this->usermod = new stdClass(); // To avoid warning
$this->usermod->id = $obj->fk_user_mod; // deprecated
$this->usermod->id = $obj->fk_user_mod; // deprecated
$this->userownerid = $obj->fk_user_action;
$this->userdoneid = $obj->fk_user_done;
@@ -675,13 +675,13 @@ class ActionComm extends CommonObject
return $num;
}
/**
/**
* Initialize $this->userassigned & this->socpeopleassigned array with list of id of user and contact assigned to event
*
* @return int <0 if KO, >0 if OK
* @return int <0 if KO, >0 if OK
*/
function fetchResources()
{
public function fetchResources()
{
$sql ='SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
$sql.=' FROM '.MAIN_DB_PREFIX.'actioncomm_resources';
$sql.=' WHERE fk_actioncomm = '.$this->id;
@@ -720,13 +720,13 @@ class ActionComm extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Initialize this->userassigned array with list of id of user assigned to event
*
* @return int <0 if KO, >0 if OK
*/
function fetch_userassigned()
public function fetch_userassigned()
{
// phpcs:enable
$sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency";
@@ -761,7 +761,7 @@ class ActionComm extends CommonObject
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($notrigger = 0)
public function delete($notrigger = 0)
{
global $user,$langs,$conf;
@@ -780,15 +780,15 @@ class ActionComm extends CommonObject
}
if (! $error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources";
$sql.= " WHERE fk_actioncomm=".$this->id;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources";
$sql.= " WHERE fk_actioncomm=".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$res=$this->db->query($sql);
if ($res < 0) {
$this->error=$this->db->lasterror();
$error++;
}
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$res=$this->db->query($sql);
if ($res < 0) {
$this->error=$this->db->lasterror();
$error++;
}
}
// Removed extrafields
@@ -838,7 +838,7 @@ class ActionComm extends CommonObject
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user, $notrigger = 0)
public function update($user, $notrigger = 0)
{
global $langs,$conf,$hookmanager;
@@ -986,20 +986,20 @@ class ActionComm extends CommonObject
}
/**
* Load all objects with filters.
* WARNING: This make a fetch on all records instead of making one request with a join.
* Load all objects with filters.
* WARNING: This make a fetch on all records instead of making one request with a join.
*
* @param DoliDb $db Database handler
* @param int $socid Filter by thirdparty
* @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to
* @param string $filter Other filter
* @param string $sortfield Sort on this field
* @param string $sortorder ASC or DESC
* @param string $limit Limit number of answers
* @return array or string Error string if KO, array with actions if OK
* @param DoliDb $db Database handler
* @param int $socid Filter by thirdparty
* @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to
* @param string $filter Other filter
* @param string $sortfield Sort on this field
* @param string $sortorder ASC or DESC
* @param string $limit Limit number of answers
* @return array or string Error string if KO, array with actions if OK
*/
static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
public static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
{
global $conf, $langs;
@@ -1043,7 +1043,7 @@ class ActionComm extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
@@ -1051,7 +1051,7 @@ class ActionComm extends CommonObject
* @param int $load_state_board Charge indicateurs this->nb de tableau de bord
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
function load_board($user, $load_state_board = 0)
public function load_board($user, $load_state_board = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -1107,12 +1107,12 @@ class ActionComm extends CommonObject
/**
* Charge les informations d'ordre info dans l'objet facture
* Charge les informations d'ordre info dans l'objet facture
*
* @param int $id Id de la facture a charger
* @return void
* @param int $id Id de la facture a charger
* @return void
*/
function info($id)
public function info($id)
{
$sql = 'SELECT ';
$sql.= ' a.id,';
@@ -1157,38 +1157,38 @@ class ActionComm extends CommonObject
/**
* Return label of status
* Return label of status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
* @return string String with status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
* @return string String with status
*/
function getLibStatut($mode, $hidenastatus = 0)
public function getLibStatut($mode, $hidenastatus = 0)
{
return $this->LibStatut($this->percentage, $mode, $hidenastatus, $this->datep);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of action status
* Return label of action status
*
* @param int $percent Percent
* @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
* @param int $datestart Date start of event
* @return string Label
* @param int $percent Percent
* @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
* @param int $datestart Date start of event
* @return string Label
*/
function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '')
public function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '')
{
// phpcs:enable
global $langs;
if ($mode == 0)
{
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%)';
elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)';
elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)';
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%)';
elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)';
elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)';
}
elseif ($mode == 1)
{
@@ -1244,28 +1244,28 @@ class ActionComm extends CommonObject
}
/**
* Return URL of event
* Use $this->id, $this->type_code, $this->label and $this->type_label
* Return URL of event
* Use $this->id, $this->type_code, $this->label and $this->type_label
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
* @param string $classname Force style class on a link
* @param string $option ''=Link to action, 'birthday'=Link to contact
* @param int $overwritepicto 1=Overwrite picto
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
* @param string $classname Force style class on a link
* @param string $option ''=Link to action, 'birthday'=Link to contact
* @param int $overwritepicto 1=Overwrite picto
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
{
global $conf, $langs, $user, $hookmanager, $action;
global $conf, $langs, $user, $hookmanager, $action;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id))
$option = 'nolink';
if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id))
$option = 'nolink';
$label = $this->label;
$label = $this->label;
if (empty($label)) $label=$this->libelle; // For backward compatibility
$result='';
@@ -1379,7 +1379,7 @@ class ActionComm extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Export events from database into a cal file.
*
@@ -1390,7 +1390,7 @@ class ActionComm extends CommonObject
* @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
* @return int <0 if error, nb of events in new file if ok
*/
function build_exportfile($format, $type, $cachedelay, $filename, $filters)
public function build_exportfile($format, $type, $cachedelay, $filename, $filters)
{
// phpcs:enable
global $conf,$langs,$dolibarr_main_url_root,$mysoc;
@@ -1614,11 +1614,11 @@ class ActionComm extends CommonObject
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
public function initAsSpecimen()
{
global $user;
@@ -1651,12 +1651,12 @@ class ActionComm extends CommonObject
}
/**
* Function used to replace a thirdparty id with another one.
* Function used to replace a thirdparty id with another one.
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
{
@@ -1668,9 +1668,9 @@ class ActionComm extends CommonObject
}
/**
* Is the action delayed?
* Is the action delayed?
*
* @return bool
* @return bool
*/
public function hasDelay()
{
@@ -1683,10 +1683,10 @@ class ActionComm extends CommonObject
/**
* Send reminders by emails
* CAN BE A CRON TASK
* Send reminders by emails
* CAN BE A CRON TASK
*
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/
public function sendEmailsReminder()
{
@@ -1715,14 +1715,14 @@ class ActionComm extends CommonObject
$this->db->begin();
// TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done
// TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done
// Delete also very old past events (we do not keep more than 1 month record in past)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'";
$this->db->query($sql);
// Delete also very old past events (we do not keep more than 1 month record in past)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'";
$this->db->query($sql);
$this->db->commit();
$this->db->commit();
return $error;
return $error;
}
}

View File

@@ -178,20 +178,20 @@ class ActionCommReminder extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return the status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
static function LibStatut($status, $mode = 0)
public static function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;

View File

@@ -44,7 +44,7 @@ class AgendaEvents extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -61,7 +61,7 @@ class AgendaEvents extends DolibarrApi
*
* @throws RestException
*/
function get($id)
public function get($id)
{
if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) {
throw new RestException(401, "Insuffisant rights to read an event");
@@ -76,11 +76,11 @@ class AgendaEvents extends DolibarrApi
throw new RestException(401, "Insuffisant rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
}
if ( ! DolibarrApi::_checkAccessToResource('agenda', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ( ! DolibarrApi::_checkAccessToResource('agenda', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->actioncomm->fetch_optionals();
$result = $this->actioncomm->fetch_optionals();
$this->actioncomm->fetchObjectLinked();
return $this->_cleanObjectDatas($this->actioncomm);
@@ -99,7 +99,7 @@ class AgendaEvents extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.datec:<:'20160101')"
* @return array Array of Agenda Events objects
*/
function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '')
{
global $db, $conf;
@@ -120,13 +120,13 @@ class AgendaEvents extends DolibarrApi
$sql = "SELECT t.id as rowid";
if (! empty($conf->societe->enabled))
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t";
if (! empty($conf->societe->enabled))
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ' WHERE t.entity IN ('.getEntity('agenda').')';
if (! empty($conf->societe->enabled))
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($user_ids) $sql.=" AND t.fk_user_action IN (".$user_ids.")";
if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid;
// Insert sale filter
@@ -141,7 +141,7 @@ class AgendaEvents extends DolibarrApi
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@@ -188,7 +188,7 @@ class AgendaEvents extends DolibarrApi
* @param array $request_data Request data
* @return int ID of Agenda Event
*/
function post($request_data = null)
public function post($request_data = null)
{
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
throw new RestException(401, "Insuffisant rights to create your Agenda Event");
@@ -227,7 +227,7 @@ class AgendaEvents extends DolibarrApi
* @return int
*/
/*
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
throw new RestException(401, "Insuffisant rights to create your Agenda Event");
@@ -263,25 +263,25 @@ class AgendaEvents extends DolibarrApi
*
* @return array
*/
function delete($id)
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) {
throw new RestException(401, "Insuffisant rights to delete your Agenda Event");
}
$result = $this->actioncomm->fetch($id);
$result = $this->actioncomm->fetch($id);
if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) {
throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
}
}
if( ! $result ) {
if( ! $result ) {
throw new RestException(404, 'Agenda Event not found');
}
if( ! DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! $this->actioncomm->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete Agenda Event : '.$this->actioncomm->error);
@@ -302,7 +302,7 @@ class AgendaEvents extends DolibarrApi
* @return array
* @throws RestException
*/
function _validate($data)
private function _validate($data)
{
$event = array();
foreach (AgendaEvents::$FIELDS as $field) {
@@ -313,57 +313,58 @@ class AgendaEvents extends DolibarrApi
return $event;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
$object = parent::_cleanObjectDatas($object);
unset($object->usermod);
unset($object->libelle);
unset($object->context);
unset($object->canvas);
unset($object->contact);
unset($object->contact_id);
unset($object->thirdparty);
unset($object->user);
unset($object->origin);
unset($object->origin_id);
unset($object->ref_ext);
unset($object->statut);
unset($object->country);
unset($object->country_id);
unset($object->country_code);
unset($object->barcode_type);
unset($object->barcode_type_code);
unset($object->barcode_type_label);
unset($object->barcode_type_coder);
unset($object->mode_reglement_id);
unset($object->cond_reglement_id);
unset($object->cond_reglement);
unset($object->fk_delivery_address);
unset($object->shipping_method_id);
unset($object->fk_account);
unset($object->total_ht);
unset($object->total_tva);
unset($object->total_localtax1);
unset($object->total_localtax2);
unset($object->total_ttc);
unset($object->fk_incoterms);
unset($object->libelle_incoterms);
unset($object->location_incoterms);
unset($object->name);
unset($object->lastname);
unset($object->firstname);
unset($object->civility_id);
unset($object->contact);
unset($object->societe);
unset($object->usermod);
unset($object->libelle);
unset($object->context);
unset($object->canvas);
unset($object->contact);
unset($object->contact_id);
unset($object->thirdparty);
unset($object->user);
unset($object->origin);
unset($object->origin_id);
unset($object->ref_ext);
unset($object->statut);
unset($object->country);
unset($object->country_id);
unset($object->country_code);
unset($object->barcode_type);
unset($object->barcode_type_code);
unset($object->barcode_type_label);
unset($object->barcode_type_coder);
unset($object->mode_reglement_id);
unset($object->cond_reglement_id);
unset($object->cond_reglement);
unset($object->fk_delivery_address);
unset($object->shipping_method_id);
unset($object->fk_account);
unset($object->total_ht);
unset($object->total_tva);
unset($object->total_localtax1);
unset($object->total_localtax2);
unset($object->total_ttc);
unset($object->fk_incoterms);
unset($object->libelle_incoterms);
unset($object->location_incoterms);
unset($object->name);
unset($object->lastname);
unset($object->firstname);
unset($object->civility_id);
unset($object->contact);
unset($object->societe);
return $object;
return $object;
}
}

View File

@@ -68,7 +68,7 @@ class CActionComm
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
}
@@ -76,10 +76,10 @@ class CActionComm
/**
* Load action type from database
*
* @param int $id id or code of action type to read
* @return int 1=ok, 0=not found, -1=error
* @param int $id id or code of action type to read
* @return int 1=ok, 0=not found, -1=error
*/
function fetch($id)
public function fetch($id)
{
$sql = "SELECT id, code, type, libelle as label, color, active, picto";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
@@ -118,19 +118,19 @@ class CActionComm
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of event types: array(id=>label) or array(code=>label)
*
* @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
* @param string $idorcode 'id' or 'code'
* @param string $excludetype Type to exclude ('system' or 'systemauto')
* @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
* @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
* @param string $idorcode 'id' or 'code'
* @param string $excludetype Type to exclude ('system' or 'systemauto')
* @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
* @param string $morefilter Add more SQL filter
* @param int $shortlabel 1=Get short label instead of long label
* @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode.
* @param int $shortlabel 1=Get short label instead of long label
* @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode.
*/
function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0)
public function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0)
{
// phpcs:enable
global $langs,$conf;
@@ -176,7 +176,7 @@ class CActionComm
if ($qualified)
{
$keyfortrans='';
$keyfortrans='';
$transcode='';
$code=$obj->code;
if ($onlyautoornot > 0 && $code == 'AC_OTH') $code='AC_MANUAL';
@@ -223,7 +223,7 @@ class CActionComm
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Picto only
* @return string Label of action type
*/
function getNomUrl($withpicto = 0)
public function getNomUrl($withpicto = 0)
{
global $langs;

View File

@@ -32,12 +32,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/xcal.lib.php';
*/
class ICal
{
var $file_text; // Text in file
var $cal; // Array to save iCalendar parse data
var $event_count; // Number of Events
var $todo_count; // Number of Todos
var $freebusy_count; // Number of Freebusy
var $last_key; //Help variable save last key (multiline string)
// Text in file
public $file_text;
public $cal; // Array to save iCalendar parse data
public $event_count; // Number of Events
public $todo_count; // Number of Todos
public $freebusy_count; // Number of Freebusy
public $last_key; //Help variable save last key (multiline string)
/**
@@ -47,14 +48,14 @@ class ICal
{
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Read text file, icalender text file
* Read text file, icalender text file
*
* @param string $file File
* @return string
* @param string $file File
* @return string
*/
function read_file($file)
public function read_file($file)
{
// phpcs:enable
$this->file = $file;
@@ -63,31 +64,31 @@ class ICal
$tmparray=file($file);
if (is_array($tmparray))
{
$file_text = join("", $tmparray); //load file
$file_text = preg_replace("/[\r\n]{1,} /", "", $file_text);
$file_text = join("", $tmparray); //load file
$file_text = preg_replace("/[\r\n]{1,} /", "", $file_text);
}
return $file_text; // return all text
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the number of calendar events
*
* @return int
*/
function get_event_count()
public function get_event_count()
{
// phpcs:enable
return $this->event_count;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the number of to do
*
* @return int
*/
function get_todo_count()
public function get_todo_count()
{
// phpcs:enable
return $this->todo_count;
@@ -99,7 +100,7 @@ class ICal
* @param string $uri Url
* @return array|string
*/
function parse($uri)
public function parse($uri)
{
$this->cal = array(); // new empty array
@@ -122,7 +123,7 @@ class ICal
{
// get Key and Value VCALENDAR:Begin -> Key = VCALENDAR, Value = begin
list($key, $value) = $this->retun_key_value($text);
//var_dump($text.' -> '.$key.' - '.$value);
//var_dump($text.' -> '.$key.' - '.$value);
switch ($text) // search special string
{
@@ -201,7 +202,7 @@ class ICal
return $this->cal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add to $this->ical array one value and key.
*
@@ -210,7 +211,7 @@ class ICal
* @param string $value Value
* @return void
*/
function add_to_array($type, $key, $value)
public function add_to_array($type, $key, $value)
{
// phpcs:enable
@@ -263,14 +264,14 @@ class ICal
$this->last_key = $key;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value");
*
* @param string $text Text
* @return array
*/
function retun_key_value($text)
public function retun_key_value($text)
{
// phpcs:enable
/*
@@ -288,14 +289,14 @@ class ICal
return explode(':', $text, 2);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Parse RRULE return array
*
* @param string $value string
* @return array
*/
function ical_rrule($value)
public function ical_rrule($value)
{
// phpcs:enable
$result = array();
@@ -308,14 +309,14 @@ class ICal
return $result;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return Unix time from ical date time fomrat (YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS)
*
* @param string $ical_date String date
* @return int
*/
function ical_date_to_unix($ical_date)
public function ical_date_to_unix($ical_date)
{
// phpcs:enable
$ical_date = str_replace('T', '', $ical_date);
@@ -331,7 +332,7 @@ class ICal
return $ntime; // ntime is a GTM time
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return unix date from iCal date format
*
@@ -339,7 +340,7 @@ class ICal
* @param string $value Value
* @return array
*/
function ical_dt_date($key, $value)
public function ical_dt_date($key, $value)
{
// phpcs:enable
$return_value = array();
@@ -362,13 +363,13 @@ class ICal
return array($key,$return_value);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return sorted eventlist as array or false if calendar is empty
*
* @return array|false
*/
function get_sort_event_list()
public function get_sort_event_list()
{
// phpcs:enable
$temp = $this->get_event_list();
@@ -383,7 +384,7 @@ class ICal
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Compare two unix timestamp
*
@@ -391,67 +392,67 @@ class ICal
* @param array $b Operand b
* @return integer
*/
function ical_dtstart_compare($a, $b)
public function ical_dtstart_compare($a, $b)
{
// phpcs:enable
return strnatcasecmp($a['DTSTART']['unixtime'], $b['DTSTART']['unixtime']);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return eventlist array (not sorted eventlist array)
*
* @return array
*/
function get_event_list()
public function get_event_list()
{
// phpcs:enable
return (! empty($this->cal['VEVENT'])?$this->cal['VEVENT']:'');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return eventlist array (not sort eventlist array)
*
* @return array
*/
function get_freebusy_list()
public function get_freebusy_list()
{
// phpcs:enable
return $this->cal['VFREEBUSY'];
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return to do array (not sorted todo array)
*
* @return array
*/
function get_todo_list()
public function get_todo_list()
{
// phpcs:enable
return $this->cal['VTODO'];
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return base calendar data
*
* @return array
*/
function get_calender_data()
public function get_calender_data()
{
// phpcs:enable
return $this->cal['VCALENDAR'];
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return array with all data
*
* @return array
*/
function get_all_data()
public function get_all_data()
{
// phpcs:enable
return $this->cal;

View File

@@ -166,7 +166,7 @@ if ($object->id > 0)
print '<div class="underbanner clearboth"></div>';
// Affichage fiche action en mode visu
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
// Type
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
@@ -237,7 +237,7 @@ if ($object->id > 0)
print '</table>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
// Build file list
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);

View File

@@ -378,38 +378,43 @@ if ($object->id > 0)
print '</tr>';
}
// Relative discounts (Discounts-Drawbacks-Rebates)
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans("CustomerRelativeDiscountShort");
print '<td><td class="right">';
if ($user->rights->societe->creer && !$user->societe_id > 0)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td><td>'.($object->remise_percent?'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>':'').'</td>';
print '</tr>';
$isCustomer = ($object->client == 1 || $object->client == 3);
// Absolute discounts (Discounts-Drawbacks-Rebates)
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding">';
print '<tr><td class="nowrap">';
print $langs->trans("CustomerAbsoluteDiscountShort");
print '<td><td class="right">';
if ($user->rights->societe->creer && !$user->societe_id > 0)
// Relative discounts (Discounts-Drawbacks-Rebates)
if ($isCustomer)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans("CustomerRelativeDiscountShort");
print '<td><td align="right">';
if ($user->rights->societe->creer && !$user->societe_id > 0)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td><td>'.($object->remise_percent?'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>':'').'</td>';
print '</tr>';
// Absolute discounts (Discounts-Drawbacks-Rebates)
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding">';
print '<tr><td class="nowrap">';
print $langs->trans("CustomerAbsoluteDiscountShort");
print '<td><td align="right">';
if ($user->rights->societe->creer && !$user->societe_id > 0)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td>';
print '<td>';
$amount_discount=$object->getAvailableDiscounts();
if ($amount_discount < 0) dol_print_error($db, $object->error);
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
//else print $langs->trans("DiscountNone");
print '</td>';
print '</tr>';
}
print '</td></tr></table>';
print '</td>';
print '<td>';
$amount_discount=$object->getAvailableDiscounts();
if ($amount_discount < 0) dol_print_error($db, $object->error);
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
//else print $langs->trans("DiscountNone");
print '</td>';
print '</tr>';
// Max outstanding bill
if ($object->client)

View File

@@ -58,20 +58,20 @@ class AdvanceTargetingMailing extends CommonObject
*/
public $id;
var $name;
var $entity;
var $fk_element;
var $type_element;
var $filtervalue;
var $fk_user_author;
var $datec='';
var $fk_user_mod;
var $tms='';
public $name;
public $entity;
public $fk_element;
public $type_element;
public $filtervalue;
public $fk_user_author;
public $datec='';
public $fk_user_mod;
public $tms='';
var $select_target_type = array();
var $type_statuscommprospect=array();
var $thirdparty_lines;
var $contact_lines;
public $select_target_type = array();
public $type_statuscommprospect=array();
public $thirdparty_lines;
public $contact_lines;
/**
@@ -79,7 +79,7 @@ class AdvanceTargetingMailing extends CommonObject
*
* @param DoliDb $db Database handler
*/
function __construct($db)
public function __construct($db)
{
global $langs;
$langs->load('customers');
@@ -108,7 +108,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
function create($user, $notrigger = 0)
public function create($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -202,7 +202,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
public function fetch($id)
{
global $langs;
$sql = "SELECT";
@@ -253,14 +253,14 @@ class AdvanceTargetingMailing extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load object in memory from the database
*
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
function fetch_by_mailing($id = 0)
public function fetch_by_mailing($id = 0)
{
// phpcs:enable
global $langs;
@@ -319,7 +319,7 @@ class AdvanceTargetingMailing extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load object in memory from the database
*
@@ -327,7 +327,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param string $type_element Type target
* @return int <0 if KO, >0 if OK
*/
function fetch_by_element($id = 0, $type_element = 'mailing')
public function fetch_by_element($id = 0, $type_element = 'mailing')
{
// phpcs:enable
global $langs;
@@ -390,7 +390,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user, $notrigger = 0)
public function update($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -469,7 +469,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger = 0)
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
@@ -528,7 +528,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param array $arrayquery All element to Query
* @return int <0 if KO, >0 if OK
*/
function savequery($user, $arrayquery)
public function savequery($user, $arrayquery)
{
global $langs,$conf;
@@ -548,14 +548,14 @@ class AdvanceTargetingMailing extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load object in memory from database
*
* @param array $arrayquery All element to Query
* @return int <0 if KO, >0 if OK
*/
function query_thirdparty($arrayquery)
public function query_thirdparty($arrayquery)
{
// phpcs:enable
global $langs,$conf;
@@ -699,7 +699,7 @@ class AdvanceTargetingMailing extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load object in memory from database
*
@@ -707,7 +707,7 @@ class AdvanceTargetingMailing extends CommonObject
* @param int $withThirdpartyFilter add contact with tridparty filter
* @return int <0 if KO, >0 if OK
*/
function query_contact($arrayquery, $withThirdpartyFilter = 0)
public function query_contact($arrayquery, $withThirdpartyFilter = 0)
{
// phpcs:enable
global $langs,$conf;

View File

@@ -42,7 +42,7 @@ class FormAdvTargetEmailing extends Form
*
* @param DoliDB $db handler
*/
function __construct($db)
public function __construct($db)
{
global $langs;
@@ -56,7 +56,7 @@ class FormAdvTargetEmailing extends Form
* @param string $htmlname select field
* @return string select field
*/
function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status')
public function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status')
{
global $conf, $langs;
$options_array = array();
@@ -93,7 +93,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array or Code or Label of preselected country
* @return string HTML string with select
*/
function multiselectCountry($htmlname = 'country_id', $selected_array = array())
public function multiselectCountry($htmlname = 'country_id', $selected_array = array())
{
global $conf, $langs;
@@ -154,7 +154,7 @@ class FormAdvTargetEmailing extends Form
* @param User $user User action
* @return string combo list code
*/
function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user)
public function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user)
{
global $conf;
@@ -195,7 +195,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array selected array
* @return string combo list code
*/
function multiselectselectLanguage($htmlname = '', $selected_array = array())
public function multiselectselectLanguage($htmlname = '', $selected_array = array())
{
global $conf,$langs;
@@ -222,7 +222,7 @@ class FormAdvTargetEmailing extends Form
*
* @return string HTML combo
*/
function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array())
public function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array())
{
$options_array=array();
@@ -291,7 +291,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array Array
* @return string HTML combo
*/
function multiselectCivility($htmlname = 'civilite_id', $selected_array = array())
public function multiselectCivility($htmlname = 'civilite_id', $selected_array = array())
{
global $conf,$langs,$user;
$langs->load("dict");
@@ -341,7 +341,7 @@ class FormAdvTargetEmailing extends Form
* @param int $showempty show empty
* @return string HTML combo
*/
function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0)
public function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0)
{
global $conf, $langs;
@@ -357,7 +357,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array value selected
* @return string HTML combo
*/
function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array())
public function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array())
{
return $this->multiselectCategories($htmlname, $selected_array, 2);
}
@@ -369,7 +369,7 @@ class FormAdvTargetEmailing extends Form
* @param array $selected_array value selected
* @return string HTML combo
*/
function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array())
public function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array())
{
return $this->multiselectCategories($htmlname, $selected_array, 4);
}

View File

@@ -80,9 +80,9 @@ class Mailing extends CommonObject
* Constructor
*
* @param DoliDb $db Database handler
*/
function __construct($db)
{
*/
public function __construct($db)
{
$this->db = $db;
// List of language codes for status
@@ -96,7 +96,7 @@ class Mailing extends CommonObject
$this->statut_dest[1] = 'MailingStatusSent';
$this->statut_dest[2] = 'MailingStatusRead';
$this->statut_dest[3] = 'MailingStatusReadAndUnsubscribe'; // Read but ask to not be contacted anymore
}
}
/**
* Create an EMailing
@@ -104,7 +104,7 @@ class Mailing extends CommonObject
* @param User $user Object of user making creation
* @return int -1 if error, Id of created object if OK
*/
function create($user)
public function create($user)
{
global $conf, $langs;
@@ -163,7 +163,7 @@ class Mailing extends CommonObject
* @param User $user Object of user making change
* @return int < 0 if KO, > 0 if OK
*/
function update($user)
public function update($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
$sql .= " SET titre = '".$this->db->escape($this->titre)."'";
@@ -195,7 +195,7 @@ class Mailing extends CommonObject
* @param int $rowid Id of emailing
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid)
public function fetch($rowid)
{
global $conf;
@@ -218,34 +218,34 @@ class Mailing extends CommonObject
{
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->statut = $obj->statut;
$this->nbemail = $obj->nbemail;
$this->titre = $obj->titre;
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->statut = $obj->statut;
$this->nbemail = $obj->nbemail;
$this->titre = $obj->titre;
$this->sujet = $obj->sujet;
$this->sujet = $obj->sujet;
if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401))) {
$this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401);
$this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401);
}else {
$this->body = $obj->body;
$this->body = $obj->body;
}
$this->bgcolor = $obj->bgcolor;
$this->bgimage = $obj->bgimage;
$this->bgcolor = $obj->bgcolor;
$this->bgimage = $obj->bgimage;
$this->email_from = $obj->email_from;
$this->email_replyto = $obj->email_replyto;
$this->email_errorsto = $obj->email_errorsto;
$this->email_from = $obj->email_from;
$this->email_replyto = $obj->email_replyto;
$this->email_errorsto = $obj->email_errorsto;
$this->user_creat = $obj->fk_user_creat;
$this->user_valid = $obj->fk_user_valid;
$this->user_creat = $obj->fk_user_creat;
$this->user_valid = $obj->fk_user_valid;
$this->date_creat = $this->db->jdate($obj->date_creat);
$this->date_valid = $this->db->jdate($obj->date_valid);
$this->date_envoi = $this->db->jdate($obj->date_envoi);
$this->date_creat = $this->db->jdate($obj->date_creat);
$this->date_valid = $this->db->jdate($obj->date_valid);
$this->date_envoi = $this->db->jdate($obj->date_envoi);
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->extraparams = (array) json_decode($obj->extraparams, true);
return 1;
}
@@ -271,7 +271,7 @@ class Mailing extends CommonObject
* @param int $option2 Not used
* @return int New id of clone
*/
function createFromClone($fromid, $option1, $option2)
public function createFromClone($fromid, $option1, $option2)
{
global $user,$langs;
@@ -394,7 +394,7 @@ class Mailing extends CommonObject
* @param User $user Objet user qui valide
* @return int <0 if KO, >0 if OK
*/
function valid($user)
public function valid($user)
{
$now=dol_now();
@@ -421,7 +421,7 @@ class Mailing extends CommonObject
* @param int $rowid id du mailing a supprimer
* @return int 1 en cas de succes
*/
function delete($rowid)
public function delete($rowid)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing";
$sql.= " WHERE rowid = ".$rowid;
@@ -439,13 +439,13 @@ class Mailing extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Delete targets emailing
*
* @return int 1 if OK, 0 if error
*/
function delete_targets()
public function delete_targets()
{
// phpcs:enable
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
@@ -465,14 +465,14 @@ class Mailing extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Change status of each recipient
*
* @param User $user Objet user qui valide
* @return int <0 if KO, >0 if OK
*/
function reset_targets_status($user)
public function reset_targets_status($user)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
@@ -499,7 +499,7 @@ class Mailing extends CommonObject
* @param string $mode Mode ('alreadysent' = Sent success or error, 'alreadysentok' = Sent success, 'alreadysentko' = Sent error)
* @return int Nb of target with status
*/
function countNbOfTargets($mode)
public function countNbOfTargets($mode)
{
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql.= " WHERE fk_mailing = ".$this->id;
@@ -537,7 +537,7 @@ class Mailing extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -608,12 +608,12 @@ class Mailing extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Label
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -621,7 +621,7 @@ class Mailing extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label
*/
function LibStatut($statut, $mode = 0)
public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -634,30 +634,30 @@ class Mailing extends CommonObject
elseif ($mode == 2)
{
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
}
elseif ($mode == 3)
{
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1');
if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3');
if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1');
elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3');
elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
}
elseif ($mode == 4)
{
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
}
elseif ($mode == 5)
{
if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
if ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1');
if ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3');
if ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
elseif ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1');
elseif ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3');
elseif ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
}
}
@@ -687,37 +687,37 @@ class Mailing extends CommonObject
elseif ($mode == 2)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
}
elseif ($mode == 3)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
}
elseif ($mode == 4)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
}
elseif ($mode == 5)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
}
elseif ($mode == 6)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
}
}
}

View File

@@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
*/
class Proposals extends DolibarrApi
{
/**
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
@@ -45,7 +44,7 @@ class Proposals extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db, $conf;
$this->db = $db;
@@ -63,7 +62,7 @@ class Proposals extends DolibarrApi
*
* @throws RestException
*/
function get($id, $contact_list = 1)
public function get($id, $contact_list = 1)
{
if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401);
@@ -97,7 +96,7 @@ class Proposals extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
* @return array Array of order objects
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf;
@@ -182,8 +181,8 @@ class Proposals extends DolibarrApi
* @param array $request_data Request data
* @return int ID of proposal
*/
function post($request_data = null)
{
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401, "Insuffisant rights");
}
@@ -205,7 +204,7 @@ class Proposals extends DolibarrApi
}
return $this->propal->id;
}
}
/**
* Get lines of a commercial proposal
@@ -216,7 +215,7 @@ class Proposals extends DolibarrApi
*
* @return int
*/
function getLines($id)
public function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401);
@@ -248,9 +247,9 @@ class Proposals extends DolibarrApi
*
* @return int
*/
function postLine($id, $request_data = null)
public function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
if (! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
@@ -259,12 +258,11 @@ class Proposals extends DolibarrApi
throw new RestException(404, 'Commercial Proposal not found');
}
if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id))
{
if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
$request_data = (object) $request_data;
$updateRes = $this->propal->addline(
$request_data->desc,
@@ -313,7 +311,7 @@ class Proposals extends DolibarrApi
*
* @return object
*/
function putLine($id, $lineid, $request_data = null)
public function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
@@ -336,30 +334,30 @@ class Proposals extends DolibarrApi
throw new RestException(404, 'Proposal line not found');
}
$updateRes = $this->propal->updateline(
$lineid,
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
isset($request_data->qty)?$request_data->qty:$propalline->qty,
isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent,
isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx,
isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
isset($request_data->desc)?$request_data->desc:$propalline->desc,
'HT',
isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits,
isset($request_data->special_code)?$request_data->special_code:$propalline->special_code,
isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
0,
isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice,
isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht,
isset($request_data->label)?$request_data->label:$propalline->label,
isset($request_data->product_type)?$request_data->product_type:$propalline->product_type,
isset($request_data->date_start)?$request_data->date_start:$propalline->date_start,
isset($request_data->date_end)?$request_data->date_end:$propalline->date_end,
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
);
$updateRes = $this->propal->updateline(
$lineid,
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
isset($request_data->qty)?$request_data->qty:$propalline->qty,
isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent,
isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx,
isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
isset($request_data->desc)?$request_data->desc:$propalline->desc,
'HT',
isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits,
isset($request_data->special_code)?$request_data->special_code:$propalline->special_code,
isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
0,
isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice,
isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht,
isset($request_data->label)?$request_data->label:$propalline->label,
isset($request_data->product_type)?$request_data->product_type:$propalline->product_type,
isset($request_data->date_start)?$request_data->date_start:$propalline->date_start,
isset($request_data->date_end)?$request_data->date_end:$propalline->date_end,
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
);
if ($updateRes > 0) {
$result = $this->get($id);
@@ -382,7 +380,7 @@ class Proposals extends DolibarrApi
* @throws 401
* @throws 404
*/
function deleteLine($id, $lineid)
public function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
@@ -422,7 +420,7 @@ class Proposals extends DolibarrApi
* @throws 401
* @throws 404
*/
function postContact($id, $contactid, $type)
public function postContact($id, $contactid, $type)
{
if(!DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
@@ -464,7 +462,7 @@ class Proposals extends DolibarrApi
* @throws 404
* @throws 500
*/
function deleteContact($id, $rowid)
public function deleteContact($id, $rowid)
{
if(!DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
@@ -497,21 +495,21 @@ class Proposals extends DolibarrApi
*
* @return int
*/
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
if (! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
if ( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
if ( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
foreach ($request_data as $field => $value) {
if ($field == 'id') continue;
$this->propal->$field = $value;
}
@@ -546,7 +544,7 @@ class Proposals extends DolibarrApi
*
* @return array
*/
function delete($id)
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->propal->supprimer) {
throw new RestException(401);
@@ -581,7 +579,7 @@ class Proposals extends DolibarrApi
*
* @return array
*/
function settodraft($id)
public function settodraft($id)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
@@ -637,9 +635,9 @@ class Proposals extends DolibarrApi
* @throws 500
*
* @return array
*/
function validate($id, $notrigger = 0)
{
*/
public function validate($id, $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
@@ -672,7 +670,7 @@ class Proposals extends DolibarrApi
$this->propal->fetchObjectLinked();
return $this->_cleanObjectDatas($this->propal);
}
}
/**
* Close (Accept or refuse) a quote / commercial proposal
@@ -686,7 +684,7 @@ class Proposals extends DolibarrApi
*
* @return array
*/
function close($id, $status, $note_private = '', $notrigger = 0)
public function close($id, $status, $note_private = '', $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
@@ -731,7 +729,7 @@ class Proposals extends DolibarrApi
*
* @return array
*/
function setinvoiced($id)
public function setinvoiced($id)
{
if (! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
@@ -772,7 +770,7 @@ class Proposals extends DolibarrApi
* @return array
* @throws RestException
*/
function _validate($data)
private function _validate($data)
{
$propal = array();
foreach (Proposals::$FIELDS as $field) {
@@ -784,15 +782,16 @@ class Proposals extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->note);

View File

@@ -239,7 +239,7 @@ class Propal extends CommonObject
* @param int $socid Id third party
* @param int $propalid Id proposal
*/
function __construct($db, $socid = "", $propalid = 0)
public function __construct($db, $socid = "", $propalid = 0)
{
global $conf,$langs;
@@ -254,7 +254,7 @@ class Propal extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add line into array products
* $this->thirdparty should be loaded
@@ -267,7 +267,7 @@ class Propal extends CommonObject
* TODO Replace calls to this function by generation objet Ligne
* inserted into table $this->products
*/
function add_product($idproduct, $qty, $remise_percent = 0)
public function add_product($idproduct, $qty, $remise_percent = 0)
{
// phpcs:enable
global $conf, $mysoc;
@@ -316,14 +316,14 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adding line of fixed discount in the proposal in DB
*
* @param int $idremise Id of fixed discount
* @return int >0 if OK, <0 if KO
*/
function insert_discount($idremise)
public function insert_discount($idremise)
{
// phpcs:enable
global $langs;
@@ -434,7 +434,7 @@ class Propal extends CommonObject
* @return int >0 if OK, <0 if KO
* @see add_product
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0)
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0)
{
global $mysoc, $conf, $langs;
@@ -663,11 +663,11 @@ class Propal extends CommonObject
* @param int $notrigger disable line update trigger
* @return int 0 if OK, <0 if KO
*/
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
{
global $mysoc;
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@@ -827,7 +827,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $lineid Id of line to delete
* @return int >0 if OK, <0 if KO
*/
function deleteline($lineid)
public function deleteline($lineid)
{
global $user;
@@ -869,7 +869,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >=0 if OK
*/
function create($user, $notrigger = 0)
public function create($user, $notrigger = 0)
{
global $conf,$hookmanager;
$error=0;
@@ -1193,7 +1193,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Insert into DB a proposal object completely defined by its data members (ex, results from copy).
*
@@ -1201,7 +1201,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @return int Id of the new object if ok, <0 if ko
* @see create
*/
function create_from($user)
public function create_from($user)
{
// phpcs:enable
// i love this function because $this->products is not used in create function...
@@ -1216,7 +1216,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $socid Id of thirdparty
* @return int New id of clone
*/
function createFromClone($socid = 0)
public function createFromClone($socid = 0)
{
global $user,$conf,$hookmanager;
@@ -1345,7 +1345,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param string $ref Ref of proposal
* @return int >0 if OK, <0 if KO
*/
function fetch($rowid, $ref = '')
public function fetch($rowid, $ref = '')
{
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
@@ -1509,7 +1509,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update(User $user, $notrigger = 0)
public function update(User $user, $notrigger = 0)
{
global $conf;
@@ -1597,14 +1597,14 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load array lines
*
* @param int $only_product Return only physical products
* @return int <0 if KO, >0 if OK
*/
function fetch_lines($only_product = 0)
public function fetch_lines($only_product = 0)
{
// phpcs:enable
$this->lines=array();
@@ -1723,7 +1723,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0=execute triggers
* @return int <0 if KO, 0=Nothing done, >=0 if OK
*/
function valid($user, $notrigger = 0)
public function valid($user, $notrigger = 0)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -1838,7 +1838,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define proposal date
*
@@ -1847,7 +1847,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function set_date($user, $date, $notrigger = 0)
public function set_date($user, $date, $notrigger = 0)
{
// phpcs:enable
if (empty($date))
@@ -1907,7 +1907,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define end validity date
*
@@ -1916,7 +1916,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function set_echeance($user, $date_fin_validite, $notrigger = 0)
public function set_echeance($user, $date_fin_validite, $notrigger = 0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer))
@@ -1969,7 +1969,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set delivery date
*
@@ -1978,7 +1978,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
function set_date_livraison($user, $date_livraison, $notrigger = 0)
public function set_date_livraison($user, $date_livraison, $notrigger = 0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer))
@@ -2031,7 +2031,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set delivery
*
@@ -2040,7 +2040,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function set_availability($user, $id, $notrigger = 0)
public function set_availability($user, $id, $notrigger = 0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
@@ -2102,7 +2102,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set source of demand
*
@@ -2111,7 +2111,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function set_demand_reason($user, $id, $notrigger = 0)
public function set_demand_reason($user, $id, $notrigger = 0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
@@ -2175,7 +2175,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set customer reference number
*
@@ -2184,7 +2184,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
function set_ref_client($user, $ref_client, $notrigger = 0)
public function set_ref_client($user, $ref_client, $notrigger = 0)
{
// phpcs:enable
if (! empty($user->rights->propal->creer))
@@ -2240,7 +2240,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set an overall discount on the proposal
*
@@ -2249,7 +2249,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
function set_remise_percent($user, $remise, $notrigger = 0)
public function set_remise_percent($user, $remise, $notrigger = 0)
{
// phpcs:enable
$remise=trim($remise)?trim($remise):0;
@@ -2307,7 +2307,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set an absolute overall discount on the proposal
*
@@ -2316,7 +2316,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
function set_remise_absolue($user, $remise, $notrigger = 0)
public function set_remise_absolue($user, $remise, $notrigger = 0)
{
// phpcs:enable
$remise=trim($remise)?trim($remise):0;
@@ -2385,7 +2385,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function reopen($user, $statut, $note = '', $notrigger = 0)
public function reopen($user, $statut, $note = '', $notrigger = 0)
{
$this->statut = $statut;
@@ -2446,7 +2446,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK
*/
function cloture($user, $statut, $note = "", $notrigger = 0)
public function cloture($user, $statut, $note = "", $notrigger = 0)
{
global $langs,$conf;
@@ -2549,7 +2549,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 si ko, >0 si ok
*/
function classifyBilled(User $user, $notrigger = 0)
public function classifyBilled(User $user, $notrigger = 0)
{
$error=0;
@@ -2597,7 +2597,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set draft status
*
@@ -2605,7 +2605,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function set_draft($user, $notrigger = 0)
public function set_draft($user, $notrigger = 0)
{
// phpcs:enable
$error=0;
@@ -2656,7 +2656,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of proposal (eventually filtered on user) into an array
*
@@ -2670,7 +2670,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param string $sortorder Sort order
* @return int -1 if KO, array with result if OK
*/
function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC')
public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC')
{
// phpcs:enable
global $user;
@@ -2739,19 +2739,19 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
*
* @return array Array of invoices
*/
function getInvoiceArrayList()
public function getInvoiceArrayList()
{
return $this->InvoiceArrayList($this->id);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns an array with id and ref of related invoices
*
* @param int $id Id propal
* @return array Array of invoices id
*/
function InvoiceArrayList($id)
public function InvoiceArrayList($id)
{
// phpcs:enable
$ga = array();
@@ -2838,7 +2838,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int 1 if ok, otherwise if error
*/
function delete($user, $notrigger = 0)
public function delete($user, $notrigger = 0)
{
global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -2962,7 +2962,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @return int >0 if OK, <0 if KO
* @deprecated use set_availability
*/
function availability($availability_id, $notrigger = 0)
public function availability($availability_id, $notrigger = 0)
{
global $user;
@@ -3024,7 +3024,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Change source demand
*
@@ -3033,7 +3033,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @return int >0 si ok, <0 si ko
* @deprecated use set_demand_reason
*/
function demand_reason($demand_reason_id, $notrigger = 0)
public function demand_reason($demand_reason_id, $notrigger = 0)
{
// phpcs:enable
global $user;
@@ -3103,7 +3103,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $id Proposal id
* @return void
*/
function info($id)
public function info($id)
{
$sql = "SELECT c.rowid, ";
$sql.= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
@@ -3158,12 +3158,12 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of a status (draft, validated, ...)
*
@@ -3171,7 +3171,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label
*/
function LibStatut($statut, $mode = 1)
public function LibStatut($statut, $mode = 1)
{
// phpcs:enable
global $conf;
@@ -3210,7 +3210,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
@@ -3218,7 +3218,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $mode "opened" for proposal to close, "signed" for proposal to invoice
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
function load_board($user, $mode)
public function load_board($user, $mode)
{
// phpcs:enable
global $conf, $langs;
@@ -3300,7 +3300,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
*
* @return void
*/
function initAsSpecimen()
public function initAsSpecimen()
{
global $langs;
@@ -3386,13 +3386,13 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 if ko, >0 if ok
*/
function load_state_board()
public function load_state_board()
{
// phpcs:enable
global $user;
@@ -3438,7 +3438,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param Societe $soc Object thirdparty
* @return string Reference libre pour la propale
*/
function getNextNumRef($soc)
public function getNextNumRef($soc)
{
global $conf,$langs;
$langs->load("propal");
@@ -3500,7 +3500,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1)
{
global $langs, $conf, $user;
@@ -3574,7 +3574,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
*
* @return int >0 if OK, <0 if KO
*/
function getLinesArray()
public function getLinesArray()
{
return $this->fetch_lines();
}
@@ -3754,7 +3754,7 @@ class PropaleLigne extends CommonObjectLine
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db= $db;
}
@@ -3765,7 +3765,7 @@ class PropaleLigne extends CommonObjectLine
* @param int $rowid Propal line id
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid)
public function fetch($rowid)
{
$sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.vat_src_code, pd.tva_tx,';
$sql.= ' pd.remise, pd.remise_percent, pd.fk_remise_except, pd.subprice,';
@@ -3859,7 +3859,7 @@ class PropaleLigne extends CommonObjectLine
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function insert($notrigger = 0)
public function insert($notrigger = 0)
{
global $conf,$user;
@@ -4002,7 +4002,7 @@ class PropaleLigne extends CommonObjectLine
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
function delete(User $user, $notrigger = 0)
public function delete(User $user, $notrigger = 0)
{
global $conf;
@@ -4056,7 +4056,7 @@ class PropaleLigne extends CommonObjectLine
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
function update($notrigger = 0)
public function update($notrigger = 0)
{
global $conf,$user;
@@ -4178,14 +4178,14 @@ class PropaleLigne extends CommonObjectLine
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update DB line fields total_xxx
* Used by migration
*
* @return int <0 if KO, >0 if OK
*/
function update_total()
public function update_total()
{
// phpcs:enable
$this->db->begin();

View File

@@ -40,12 +40,12 @@ class PropaleStats extends Stats
*/
public $table_element;
var $socid;
var $userid;
public $socid;
public $userid;
var $from;
var $field;
var $where;
public $from;
public $field;
public $where;
/**
@@ -56,7 +56,7 @@ class PropaleStats extends Stats
* @param int $userid Id user for filter (creation user)
* @param string $mode Option ('customer', 'supplier')
*/
function __construct($db, $socid = 0, $userid = 0, $mode = 'customer')
public function __construct($db, $socid = 0, $userid = 0, $mode = 'customer')
{
global $user, $conf;
@@ -106,7 +106,7 @@ class PropaleStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month
*/
function getNbByMonth($year, $format = 0)
public function getNbByMonth($year, $format = 0)
{
global $user;
@@ -128,7 +128,7 @@ class PropaleStats extends Stats
* @return array Array with number by year
*
*/
function getNbByYear()
public function getNbByYear()
{
global $user;
@@ -149,7 +149,7 @@ class PropaleStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
function getAmountByMonth($year, $format)
public function getAmountByMonth($year, $format)
{
global $user;
@@ -171,7 +171,7 @@ class PropaleStats extends Stats
* @param int $year year for stats
* @return array array with number by month
*/
function getAverageByMonth($year)
public function getAverageByMonth($year)
{
global $user;
@@ -191,7 +191,7 @@ class PropaleStats extends Stats
*
* @return array Array of values
*/
function getAllByYear()
public function getAllByYear()
{
global $user;
@@ -213,7 +213,7 @@ class PropaleStats extends Stats
* @param int $year Year to scan
* @return array Array of values
*/
function getAllByProduct($year)
public function getAllByProduct($year)
{
global $user;

View File

@@ -564,7 +564,7 @@ if ($resql)
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100');
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>';
}
// Company type

View File

@@ -106,7 +106,7 @@ if ($socid > 0)
$head = societe_prepare_head($object);
$isCustomer = $object->client == 1 || $object->client == 3;
$isCustomer = ($object->client == 1 || $object->client == 3);
$isSupplier = $object->fournisseur == 1;
print '<form method="POST" action="remise.php?id='.$object->id.'">';
@@ -122,7 +122,7 @@ if ($socid > 0)
print '<div class="underbanner clearboth"></div>';
if(! $isCustomer && ! $isSupplier) {
if (! $isCustomer && ! $isSupplier) {
print '<p class="opacitymedium">'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'</p>';
dol_fiche_end();
@@ -137,13 +137,13 @@ if ($socid > 0)
print '<table class="border centpercent">';
if($isCustomer) {
if ($isCustomer) {
// Customer discount
print '<tr><td class="titlefield">';
print $langs->trans("CustomerRelativeDiscount").'</td><td>'.price2num($object->remise_percent)."%</td></tr>";
}
if($isSupplier) {
if ($isSupplier) {
// Supplier discount
print '<tr><td class="titlefield">';
print $langs->trans("SupplierRelativeDiscount").'</td><td>'.price2num($object->remise_supplier_percent)."%</td></tr>";
@@ -156,21 +156,28 @@ if ($socid > 0)
print '<div class="underbanner clearboth"></div>';
if($isCustomer && ! $isSupplier) {
print '<input type="hidden" name="discount_type" value="0" />';
}
if(! $isCustomer && $isSupplier) {
print '<input type="hidden" name="discount_type" value="1" />';
}
/*if (! ($isCustomer && $isSupplier))
{
if ($isCustomer && ! $isSupplier) {
print '<input type="hidden" name="discount_type" value="0" />';
}
if (! $isCustomer && $isSupplier) {
print '<input type="hidden" name="discount_type" value="1" />';
}
}*/
print '<table class="border centpercent">';
if($isCustomer && $isSupplier) {
if ($isCustomer || $isSupplier)
{
// Discount type
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>';
print '<td><input type="radio" name="discount_type" id="discount_type_0" selected value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
print ' <input type="radio" name="discount_type" id="discount_type_1" selected value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td><td>';
if ($isCustomer) {
print '<input type="radio" name="discount_type" id="discount_type_0" checked value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
}
if ($isSupplier) {
print ' <input type="radio" name="discount_type" id="discount_type_1"'.($isCustomer?'':' checked').' value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
}
print '</td></tr>';
}

View File

@@ -44,10 +44,10 @@ class Orders extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db, $conf;
$this->db = $db;
global $db, $conf;
$this->db = $db;
$this->commande = new Commande($this->db);
}
@@ -62,7 +62,7 @@ class Orders extends DolibarrApi
*
* @throws RestException
*/
function get($id, $contact_list = 1)
public function get($id, $contact_list = 1)
{
if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401);
@@ -100,7 +100,7 @@ class Orders extends DolibarrApi
*
* @throws RestException
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
{
global $db, $conf;
@@ -185,11 +185,11 @@ class Orders extends DolibarrApi
* @param array $request_data Request data
* @return int ID of order
*/
function post($request_data = null)
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401, "Insuffisant rights");
}
}
// Check mandatory fields
$result = $this->_validate($request_data);
@@ -220,7 +220,7 @@ class Orders extends DolibarrApi
*
* @return int
*/
function getLines($id)
public function getLines($id)
{
if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401);
@@ -252,7 +252,7 @@ class Orders extends DolibarrApi
*
* @return int
*/
function postLine($id, $request_data = null)
public function postLine($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
@@ -299,7 +299,7 @@ class Orders extends DolibarrApi
if ($updateRes > 0) {
return $updateRes;
} else {
throw new RestException(400, $this->commande->error);
throw new RestException(400, $this->commande->error);
}
}
@@ -314,7 +314,7 @@ class Orders extends DolibarrApi
*
* @return object
*/
function putLine($id, $lineid, $request_data = null)
public function putLine($id, $lineid, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
@@ -375,7 +375,7 @@ class Orders extends DolibarrApi
* @throws 401
* @throws 404
*/
function deleteLine($id, $lineid)
public function deleteLine($id, $lineid)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
@@ -399,7 +399,7 @@ class Orders extends DolibarrApi
throw new RestException(405, $this->commande->error);
}
}
/**
* Add a contact type of given order
*
@@ -413,7 +413,7 @@ class Orders extends DolibarrApi
* @throws 401
* @throws 404
*/
function postContact($id, $contactid, $type)
public function postContact($id, $contactid, $type)
{
if(!DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
@@ -455,7 +455,7 @@ class Orders extends DolibarrApi
* @throws 404
* @throws 500
*/
function deleteContact($id, $rowid)
public function deleteContact($id, $rowid)
{
if(!DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
@@ -488,7 +488,7 @@ class Orders extends DolibarrApi
*
* @return int
*/
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
@@ -529,7 +529,7 @@ class Orders extends DolibarrApi
* @param int $id Order ID
* @return array
*/
function delete($id)
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->commande->supprimer) {
throw new RestException(401);
@@ -577,7 +577,7 @@ class Orders extends DolibarrApi
*
* @return array
*/
function validate($id, $idwarehouse = 0, $notrigger = 0)
public function validate($id, $idwarehouse = 0, $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
@@ -629,7 +629,7 @@ class Orders extends DolibarrApi
* @throws 404
* @throws 405
*/
function reopen($id)
public function reopen($id)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
@@ -667,7 +667,7 @@ class Orders extends DolibarrApi
* @throws 404
* @throws 405
*/
function setinvoiced($id)
public function setinvoiced($id)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
@@ -710,7 +710,7 @@ class Orders extends DolibarrApi
*
* @return int
*/
function close($id, $notrigger = 0)
public function close($id, $notrigger = 0)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
@@ -756,7 +756,7 @@ class Orders extends DolibarrApi
*
* @return array
*/
function settodraft($id, $idwarehouse = -1)
public function settodraft($id, $idwarehouse = -1)
{
if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
@@ -807,7 +807,7 @@ class Orders extends DolibarrApi
* @throws 404
* @throws 405
*/
function createOrderFromProposal($proposalid)
public function createOrderFromProposal($proposalid)
{
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
@@ -838,15 +838,16 @@ class Orders extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->note);
@@ -866,7 +867,7 @@ class Orders extends DolibarrApi
* @return array
* @throws RestException
*/
function _validate($data)
private function _validate($data)
{
$commande = array();
foreach (Orders::$FIELDS as $field) {

View File

@@ -203,12 +203,12 @@ class Commande extends CommonOrder
public $multicurrency_total_ttc;
public $oldcopy;
//! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...)
public $module_source;
//! key of pos source ('0', '1', ...)
public $pos_source;
/**
* ERR Not enough stock
*/
@@ -243,7 +243,7 @@ class Commande extends CommonOrder
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
@@ -260,7 +260,7 @@ class Commande extends CommonOrder
* @param Societe $soc Object thirdparty
* @return string Order free reference
*/
function getNextNumRef($soc)
public function getNextNumRef($soc)
{
global $langs, $conf;
$langs->load("order");
@@ -318,7 +318,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <=0 if OK, 0=Nothing done, >0 if KO
*/
function valid($user, $idwarehouse = 0, $notrigger = 0)
public function valid($user, $idwarehouse = 0, $notrigger = 0)
{
global $conf,$langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -471,7 +471,7 @@ class Commande extends CommonOrder
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set draft status
*
@@ -479,8 +479,8 @@ class Commande extends CommonOrder
* @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on)
* @return int <0 if KO, >0 if OK
*/
function set_draft($user, $idwarehouse = -1)
{
public function set_draft($user, $idwarehouse = -1)
{
//phpcs:enable
global $conf,$langs;
@@ -551,10 +551,10 @@ class Commande extends CommonOrder
$this->db->rollback();
return -1;
}
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Tag the order as validated (opened)
* Function used when order is reopend after being closed.
@@ -562,7 +562,7 @@ class Commande extends CommonOrder
* @param User $user Object user that change status
* @return int <0 if KO, 0 if nothing is done, >0 if OK
*/
function set_reopen($user)
public function set_reopen($user)
{
// phpcs:enable
$error=0;
@@ -622,7 +622,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK
*/
function cloture($user, $notrigger = 0)
public function cloture($user, $notrigger = 0)
{
global $conf;
@@ -682,7 +682,7 @@ class Commande extends CommonOrder
* @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK
*/
function cancel($idwarehouse = -1)
public function cancel($idwarehouse = -1)
{
global $conf,$user,$langs;
@@ -763,7 +763,7 @@ class Commande extends CommonOrder
* @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
*/
function create($user, $notrigger = 0)
public function create($user, $notrigger = 0)
{
global $conf,$langs;
$error=0;
@@ -892,7 +892,7 @@ class Commande extends CommonOrder
$vatrate = $line->tva_tx;
if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')';
$result = $this->addline(
$result = $this->addline(
$line->desc,
$line->subprice,
$line->qty,
@@ -1067,7 +1067,7 @@ class Commande extends CommonOrder
* @param int $socid Id of thirdparty
* @return int New id of clone
*/
function createFromClone($socid = 0)
public function createFromClone($socid = 0)
{
global $user,$hookmanager;
@@ -1152,7 +1152,7 @@ class Commande extends CommonOrder
* @param User $user User making creation
* @return int <0 if KO, 0 if nothing done, 1 if OK
*/
function createFromProposal($object, User $user)
public function createFromProposal($object, User $user)
{
global $conf, $hookmanager;
@@ -1309,7 +1309,7 @@ class Commande extends CommonOrder
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0)
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0)
{
global $mysoc, $conf, $langs, $user;
@@ -1523,22 +1523,22 @@ class Commande extends CommonOrder
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add line into array
* $this->client must be loaded
*
* @param int $idproduct Product Id
* @param float $qty Quantity
* @param float $remise_percent Product discount relative
* @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @return void
* @param int $idproduct Product Id
* @param float $qty Quantity
* @param float $remise_percent Product discount relative
* @param int $date_start Start date of the line
* @param int $date_end End date of the line
* @return void
*
* TODO Remplacer les appels a cette fonction par generation objet Ligne
* insere dans tableau $this->products
*/
function add_product($idproduct, $qty, $remise_percent = 0.0, $date_start = '', $date_end = '')
public function add_product($idproduct, $qty, $remise_percent = 0.0, $date_start = '', $date_end = '')
{
// phpcs:enable
global $conf, $mysoc;
@@ -1583,7 +1583,6 @@ class Commande extends CommonOrder
$line->product_desc=$prod->description;
$line->fk_unit=$prod->fk_unit;
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
// Save the start and end date of the line in the object
if ($date_start) { $line->date_start = $date_start; }
if ($date_end) { $line->date_end = $date_end; }
@@ -1623,7 +1622,7 @@ class Commande extends CommonOrder
* @param string $ref_int Internal reference of other object
* @return int >0 if OK, <0 if KO, 0 if not found
*/
function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
{
// Check parameters
@@ -1719,7 +1718,7 @@ class Commande extends CommonOrder
$this->fk_delivery_address = $obj->fk_delivery_address;
$this->module_source = $obj->module_source;
$this->pos_source = $obj->pos_source;
//Incoterms
$this->fk_incoterms = $obj->fk_incoterms;
$this->location_incoterms = $obj->location_incoterms;
@@ -1769,14 +1768,14 @@ class Commande extends CommonOrder
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adding line of fixed discount in the order in DB
*
* @param int $idremise Id de la remise fixe
* @return int >0 si ok, <0 si ko
*/
function insert_discount($idremise)
public function insert_discount($idremise)
{
// phpcs:enable
global $langs;
@@ -1848,14 +1847,14 @@ class Commande extends CommonOrder
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load array lines
*
* @param int $only_product Return only physical products
* @return int <0 if KO, >0 if OK
*/
function fetch_lines($only_product = 0)
public function fetch_lines($only_product = 0)
{
// phpcs:enable
$this->lines=array();
@@ -1971,7 +1970,7 @@ class Commande extends CommonOrder
*
* @return int <0 if KO, Nbr of product lines if OK
*/
function getNbOfProductsLines()
public function getNbOfProductsLines()
{
$nb=0;
foreach($this->lines as $line)
@@ -1986,7 +1985,7 @@ class Commande extends CommonOrder
*
* @return int <0 if KO, Nbr of service lines if OK
*/
function getNbOfServicesLines()
public function getNbOfServicesLines()
{
$nb=0;
foreach($this->lines as $line)
@@ -1997,11 +1996,11 @@ class Commande extends CommonOrder
}
/**
* Count numbe rof shipments for this order
* Count number of shipments for this order
*
* @return int <0 if KO, Nb of shipment found if OK
*/
function getNbOfShipments()
public function getNbOfShipments()
{
$nb = 0;
@@ -2037,7 +2036,7 @@ class Commande extends CommonOrder
* @param int $filtre_statut Filter on shipment status
* @return int <0 if KO, Nb of lines found if OK
*/
function loadExpeditions($filtre_statut = -1)
public function loadExpeditions($filtre_statut = -1)
{
$this->expeditions = array();
@@ -2077,7 +2076,7 @@ class Commande extends CommonOrder
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns a array with expeditions lines number
*
@@ -2085,7 +2084,7 @@ class Commande extends CommonOrder
*
* TODO deprecate, move to Shipping class
*/
function nb_expedition()
public function nb_expedition()
{
// phpcs:enable
$sql = 'SELECT count(*)';
@@ -2104,7 +2103,7 @@ class Commande extends CommonOrder
else dol_print_error($this->db);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a array with the pending stock by product
*
@@ -2113,7 +2112,7 @@ class Commande extends CommonOrder
*
* TODO FONCTION NON FINIE A FINIR
*/
function stock_array($filtre_statut = self::STATUS_CANCELED)
public function stock_array($filtre_statut = self::STATUS_CANCELED)
{
// phpcs:enable
$this->stocks = array();
@@ -2153,7 +2152,7 @@ class Commande extends CommonOrder
* @param int $lineid Id of line to delete
* @return int >0 if OK, 0 if nothing to do, <0 if KO
*/
function deleteline($user = null, $lineid = 0)
public function deleteline($user = null, $lineid = 0)
{
if ($this->statut == self::STATUS_DRAFT)
{
@@ -2222,7 +2221,7 @@ class Commande extends CommonOrder
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Applique une remise relative
*
@@ -2231,7 +2230,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function set_remise($user, $remise, $notrigger = 0)
public function set_remise($user, $remise, $notrigger = 0)
{
// phpcs:enable
$remise=trim($remise)?trim($remise):0;
@@ -2290,7 +2289,7 @@ class Commande extends CommonOrder
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Applique une remise absolue
*
@@ -2299,7 +2298,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function set_remise_absolue($user, $remise, $notrigger = 0)
public function set_remise_absolue($user, $remise, $notrigger = 0)
{
// phpcs:enable
$remise=trim($remise)?trim($remise):0;
@@ -2358,7 +2357,7 @@ class Commande extends CommonOrder
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set the order date
*
@@ -2367,7 +2366,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function set_date($user, $date, $notrigger = 0)
public function set_date($user, $date, $notrigger = 0)
{
// phpcs:enable
if ($user->rights->commande->creer)
@@ -2424,7 +2423,7 @@ class Commande extends CommonOrder
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set the planned delivery date
*
@@ -2433,7 +2432,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 si ko, >0 si ok
*/
function set_date_livraison($user, $date_livraison, $notrigger = 0)
public function set_date_livraison($user, $date_livraison, $notrigger = 0)
{
// phpcs:enable
if ($user->rights->commande->creer)
@@ -2490,7 +2489,7 @@ class Commande extends CommonOrder
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of orders (eventuelly filtered on a user) into an array
*
@@ -2504,7 +2503,7 @@ class Commande extends CommonOrder
* @param string $sortorder Sort order
* @return int -1 if KO, array with result if OK
*/
function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC')
public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC')
{
// phpcs:enable
global $user;
@@ -2572,7 +2571,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int >0 if OK, <0 if KO
*/
function availability($availability_id, $notrigger = 0)
public function availability($availability_id, $notrigger = 0)
{
global $user;
@@ -2635,7 +2634,7 @@ class Commande extends CommonOrder
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update order demand_reason
*
@@ -2643,7 +2642,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int >0 if ok, <0 if ko
*/
function demand_reason($demand_reason_id, $notrigger = 0)
public function demand_reason($demand_reason_id, $notrigger = 0)
{
// phpcs:enable
global $user;
@@ -2707,7 +2706,7 @@ class Commande extends CommonOrder
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set customer ref
*
@@ -2716,7 +2715,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function set_ref_client($user, $ref_client, $notrigger = 0)
public function set_ref_client($user, $ref_client, $notrigger = 0)
{
// phpcs:enable
if ($user->rights->commande->creer)
@@ -2779,7 +2778,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function classifyBilled(User $user, $notrigger = 0)
public function classifyBilled(User $user, $notrigger = 0)
{
$error = 0;
@@ -2835,7 +2834,7 @@ class Commande extends CommonOrder
*
* @return int <0 if ko, >0 if ok
*/
function classifyUnBilled()
public function classifyUnBilled()
{
global $conf, $user, $langs;
$error = 0;
@@ -2914,7 +2913,7 @@ class Commande extends CommonOrder
* @param int $notrigger disable line update trigger
* @return int < 0 if KO, > 0 if OK
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
{
global $conf, $mysoc, $langs, $user;
@@ -3104,7 +3103,7 @@ class Commande extends CommonOrder
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update(User $user, $notrigger = 0)
public function update(User $user, $notrigger = 0)
{
global $conf;
@@ -3199,7 +3198,7 @@ class Commande extends CommonOrder
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <=0 if KO, >0 if OK
*/
function delete($user, $notrigger = 0)
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -3321,14 +3320,14 @@ class Commande extends CommonOrder
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Object user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
function load_board($user)
public function load_board($user)
{
// phpcs:enable
global $conf, $langs;
@@ -3387,7 +3386,7 @@ class Commande extends CommonOrder
*
* @return string Label
*/
function getLabelSource()
public function getLabelSource()
{
global $langs;
@@ -3403,12 +3402,12 @@ class Commande extends CommonOrder
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
function getLibStatut($mode)
public function getLibStatut($mode)
{
return $this->LibStatut($this->statut, $this->billed, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of status
*
@@ -3418,7 +3417,7 @@ class Commande extends CommonOrder
* @param int $donotshowbilled Do not show billed status after order status
* @return string Label of status
*/
function LibStatut($statut, $billed, $mode, $donotshowbilled = 0)
public function LibStatut($statut, $billed, $mode, $donotshowbilled = 0)
{
// phpcs:enable
global $langs, $conf;
@@ -3430,72 +3429,72 @@ class Commande extends CommonOrder
if ($mode == 0)
{
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled');
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft');
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext;
if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
elseif ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft');
elseif ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext;
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
}
elseif ($mode == 1)
{
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort');
if ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort');
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext;
if ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
elseif ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort');
elseif ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext;
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
}
elseif ($mode == 2)
{
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5').' '.$langs->trans('StatusOrderCanceledShort');
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraftShort');
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'), 'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext;
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'), 'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext;
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBillShort');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDeliveredShort');
elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraftShort');
elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'), 'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext;
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'), 'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBillShort');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDeliveredShort');
}
elseif ($mode == 3)
{
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0');
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0');
elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3');
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
}
elseif ($mode == 4)
{
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5').' '.$langs->trans('StatusOrderCanceled');
if ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraft');
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext;
if ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3').' '.$langs->trans('StatusOrderSent').$billedtext;
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBill');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDelivered');
elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraft');
elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext;
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3').' '.$langs->trans('StatusOrderSent').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBill');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDelivered');
}
elseif ($mode == 5)
{
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceledShort').' </span>'.img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
if ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
if ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
if ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDeliveredShort').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
elseif ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
elseif ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDeliveredShort').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
}
elseif ($mode == 6)
{
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceled').' </span>'.img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
if ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraft').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
if ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidated').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
if ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSent').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBill').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4');
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessed').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDelivered').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
elseif ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraft').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
elseif ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidated').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSent').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBill').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessed').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDelivered').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
}
}
@@ -3511,7 +3510,7 @@ class Commande extends CommonOrder
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
{
global $conf, $langs, $user;
@@ -3588,7 +3587,7 @@ class Commande extends CommonOrder
* @param int $id Id of order
* @return void
*/
function info($id)
public function info($id)
{
$sql = 'SELECT c.rowid, date_creation as datec, tms as datem,';
$sql.= ' date_valid as datev,';
@@ -3646,7 +3645,7 @@ class Commande extends CommonOrder
*
* @return void
*/
function initAsSpecimen()
public function initAsSpecimen()
{
global $langs;
@@ -3728,13 +3727,13 @@ class Commande extends CommonOrder
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 si ko, >0 si ok
*/
function load_state_board()
public function load_state_board()
{
// phpcs:enable
global $user;
@@ -3776,7 +3775,7 @@ class Commande extends CommonOrder
*
* @return int >0 if OK, <0 if KO
*/
function getLinesArray()
public function getLinesArray()
{
return $this->fetch_lines();
}
@@ -3880,7 +3879,7 @@ class OrderLine extends CommonOrderLine
public $table_element='commandedet';
var $oldline;
public $oldline;
/**
* Id of parent order
@@ -3897,38 +3896,37 @@ class OrderLine extends CommonOrderLine
public $commande_id;
// From llx_commandedet
var $fk_parent_line;
var $fk_facture;
public $fk_parent_line;
public $fk_facture;
/**
* @var string Order lines label
*/
public $label;
var $fk_remise_except;
var $rang = 0;
var $fk_fournprice;
public $fk_remise_except;
public $rang = 0;
public $fk_fournprice;
/**
* Buy price without taxes
* @var float
*/
var $pa_ht;
var $marge_tx;
var $marque_tx;
public $pa_ht;
public $marge_tx;
public $marque_tx;
/**
* @deprecated
* @see remise_percent, fk_remise_except
*/
var $remise;
public $remise;
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
// Start and end date of the line
var $date_start;
var $date_end;
public $date_start;
public $date_end;
var $skip_update_total; // Skip update price total for special lines
public $skip_update_total; // Skip update price total for special lines
/**
@@ -3936,10 +3934,10 @@ class OrderLine extends CommonOrderLine
*
* @param DoliDB $db handler d'acces base de donnee
*/
function __construct($db)
{
$this->db= $db;
}
public function __construct($db)
{
$this->db= $db;
}
/**
* Load line order
@@ -3947,7 +3945,7 @@ class OrderLine extends CommonOrderLine
* @param int $rowid Id line order
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid)
public function fetch($rowid)
{
$sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_parent_line, cd.fk_product, cd.product_type, cd.label as custom_label, cd.description, cd.price, cd.qty, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx,';
$sql.= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,';
@@ -4032,7 +4030,7 @@ class OrderLine extends CommonOrderLine
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 si ko, >0 si ok
*/
function delete(User $user, $notrigger = 0)
public function delete(User $user, $notrigger = 0)
{
global $conf, $langs;
@@ -4093,7 +4091,7 @@ class OrderLine extends CommonOrderLine
* @param int $notrigger 1 = disable triggers
* @return int <0 if KO, >0 if OK
*/
function insert($user = null, $notrigger = 0)
public function insert($user = null, $notrigger = 0)
{
global $langs, $conf;
@@ -4238,7 +4236,7 @@ class OrderLine extends CommonOrderLine
* @param int $notrigger 1 = disable triggers
* @return int <0 si ko, >0 si ok
*/
function update(User $user, $notrigger = 0)
public function update(User $user, $notrigger = 0)
{
global $conf,$langs;
@@ -4365,14 +4363,14 @@ class OrderLine extends CommonOrderLine
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update DB line fields total_xxx
* Used by migration
*
* @return int <0 if KO, >0 if OK
*/
function update_total()
public function update_total()
{
// phpcs:enable
$this->db->begin();

View File

@@ -34,17 +34,17 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
*/
class CommandeStats extends Stats
{
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element;
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element;
var $socid;
var $userid;
public $socid;
public $userid;
var $from;
var $field;
var $where;
public $from;
public $field;
public $where;
/**
@@ -55,7 +55,7 @@ class CommandeStats extends Stats
* @param string $mode Option ('customer', 'supplier')
* @param int $userid Id user for filter (creation user)
*/
function __construct($db, $socid, $mode, $userid = 0)
public function __construct($db, $socid, $mode, $userid = 0)
{
global $user, $conf;
@@ -74,7 +74,7 @@ class CommandeStats extends Stats
$this->field_line='total_ht';
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled
}
if ($mode == 'supplier')
elseif ($mode == 'supplier')
{
$object=new CommandeFournisseur($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
@@ -101,7 +101,7 @@ class CommandeStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month
*/
function getNbByMonth($year, $format = 0)
public function getNbByMonth($year, $format = 0)
{
global $user;
@@ -123,7 +123,7 @@ class CommandeStats extends Stats
* @return array Array with number by year
*
*/
function getNbByYear()
public function getNbByYear()
{
global $user;
@@ -144,7 +144,7 @@ class CommandeStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
function getAmountByMonth($year, $format = 0)
public function getAmountByMonth($year, $format = 0)
{
global $user;
@@ -166,7 +166,7 @@ class CommandeStats extends Stats
* @param int $year year for stats
* @return array array with number by month
*/
function getAverageByMonth($year)
public function getAverageByMonth($year)
{
global $user;
@@ -186,7 +186,7 @@ class CommandeStats extends Stats
*
* @return array Array of values
*/
function getAllByYear()
public function getAllByYear()
{
global $user;
@@ -206,7 +206,7 @@ class CommandeStats extends Stats
* @param int $year Year to scan
* @return array Array of values
*/
function getAllByProduct($year)
public function getAllByProduct($year)
{
global $user;

View File

@@ -622,7 +622,7 @@ if ($resql)
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100');
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>';
}
// Company type

View File

@@ -235,7 +235,7 @@ class Account extends CommonObject
*
* @param DoliDB $db Database handler
*/
function __construct(DoliDB $db)
public function __construct(DoliDB $db)
{
global $langs;
@@ -290,7 +290,7 @@ class Account extends CommonObject
*
* @return int 1 if need to be concialiated, < 0 otherwise.
*/
function canBeConciliated()
public function canBeConciliated()
{
global $conf;
@@ -301,7 +301,7 @@ class Account extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add a link between bank line record and its source
*
@@ -312,7 +312,7 @@ class Account extends CommonObject
* @param string $type Type of link ('payment', 'company', 'member', ...)
* @return int <0 if KO, id line if OK
*/
function add_url_line($line_id, $url_id, $url, $label, $type)
public function add_url_line($line_id, $url_id, $url, $label, $type)
{
// phpcs:enable
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url (";
@@ -342,7 +342,7 @@ class Account extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* TODO Move this into AccountLine
* Return array with links from llx_bank_url
@@ -352,7 +352,7 @@ class Account extends CommonObject
* @param string $type To search using type
* @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error
*/
function get_url($fk_bank = '', $url_id = '', $type = '')
public function get_url($fk_bank = '', $url_id = '', $type = '')
{
// phpcs:enable
$lines = array();
@@ -417,7 +417,7 @@ class Account extends CommonObject
* @param int $datev Date value
* @return int Rowid of added entry, <0 if KO
*/
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null)
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null)
{
// Deprecation warning
if (is_numeric($oper)) {
@@ -525,7 +525,7 @@ class Account extends CommonObject
* @param int $notrigger 1=Disable triggers
* @return int < 0 if KO, > 0 if OK
*/
function create(User $user, $notrigger = 0)
public function create(User $user, $notrigger = 0)
{
global $langs,$conf, $hookmanager;
@@ -690,7 +690,7 @@ class Account extends CommonObject
* @param int $notrigger 1=Disable triggers
* @return int <0 if KO, >0 if OK
*/
function update(User $user, $notrigger = 0)
public function update(User $user, $notrigger = 0)
{
global $langs,$conf, $hookmanager;
@@ -793,14 +793,14 @@ class Account extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update BBAN (RIB) account fields
*
* @param User $user Object user making update
* @return int <0 if KO, >0 if OK
*/
function update_bban(User $user = null)
public function update_bban(User $user = null)
{
// phpcs:enable
global $conf,$langs;
@@ -860,7 +860,7 @@ class Account extends CommonObject
* @param string $ref Ref of bank account to get
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $ref = '')
public function fetch($id, $ref = '')
{
global $conf;
@@ -1008,7 +1008,7 @@ class Account extends CommonObject
* @param User $user User deleting
* @return int <0 if KO, >0 if OK
*/
function delete(User $user = null)
public function delete(User $user = null)
{
global $conf;
@@ -1076,12 +1076,12 @@ class Account extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @return string Label
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->clos, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of given object status
*
@@ -1089,7 +1089,7 @@ class Account extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @return string Label
*/
function LibStatut($statut, $mode = 0)
public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -1120,13 +1120,13 @@ class Account extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi si un compte peut etre supprimer ou non (sans mouvements)
*
* @return boolean vrai si peut etre supprime, faux sinon
*/
function can_be_deleted()
public function can_be_deleted()
{
// phpcs:enable
$can_be_deleted=false;
@@ -1152,7 +1152,7 @@ class Account extends CommonObject
*
* @return string Error string
*/
function error()
public function error()
{
return $this->error;
}
@@ -1163,7 +1163,7 @@ class Account extends CommonObject
* @param int $option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold)
* @return int Current sold (value date <= today)
*/
function solde($option = 0)
public function solde($option = 0)
{
$solde=0;
@@ -1189,7 +1189,7 @@ class Account extends CommonObject
return price2num($solde, 'MU');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
@@ -1197,7 +1197,7 @@ class Account extends CommonObject
* @param int $filteraccountid To get info for a particular account id
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
function load_board(User $user, $filteraccountid = 0)
public function load_board(User $user, $filteraccountid = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -1246,13 +1246,13 @@ class Account extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb de tableau de bord
* @param int $filteraccountid To get info for a particular account id
* @return int <0 if ko, >0 if ok
*/
function load_state_board($filteraccountid = 0)
public function load_state_board($filteraccountid = 0)
{
// phpcs:enable
global $user;
@@ -1329,7 +1329,7 @@ class Account extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL
*/
function getNomUrl($withpicto = 0, $mode = '', $option = '', $save_lastsearch_value = -1, $notooltip = 0)
public function getNomUrl($withpicto = 0, $mode = '', $option = '', $save_lastsearch_value = -1, $notooltip = 0)
{
global $conf, $langs, $user;
@@ -1396,7 +1396,7 @@ class Account extends CommonObject
*
* @return int 1 if correct, <=0 if wrong
*/
function verif()
public function verif()
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
@@ -1430,7 +1430,7 @@ class Account extends CommonObject
*
* @return string country code
*/
function getCountryCode()
public function getCountryCode()
{
global $mysoc;
@@ -1467,7 +1467,7 @@ class Account extends CommonObject
* 1=Need 2 fields for bank code: Bank, Desk (France, Spain, ...) + Account number and key
* 2=Need 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number
*/
function useDetailedBBAN()
public function useDetailedBBAN()
{
$country_code=$this->getCountryCode();
@@ -1481,7 +1481,7 @@ class Account extends CommonObject
*
* @return int 1 = mandatory / 0 = Not mandatory
*/
function needIBAN()
public function needIBAN()
{
$country_code=$this->getCountryCode();
@@ -1531,7 +1531,7 @@ class Account extends CommonObject
* @param int $id Id of object to load
* @return void
*/
function info($id)
public function info($id)
{
}
@@ -1631,7 +1631,7 @@ class Account extends CommonObject
*
* @return void
*/
function initAsSpecimen()
public function initAsSpecimen()
{
$this->specimen = 1;
$this->ref = 'MBA';
@@ -1752,7 +1752,7 @@ class AccountLine extends CommonObject
*
* @param DoliDB $db Database handler
*/
function __construct(DoliDB $db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}
@@ -1765,7 +1765,7 @@ class AccountLine extends CommonObject
* @param string $num External num to load (ex: num of transaction for paypal fee)
* @return int <0 if KO, 0 if OK but not found, >0 if OK and found
*/
function fetch($rowid, $ref = '', $num = '')
public function fetch($rowid, $ref = '', $num = '')
{
global $conf;
@@ -1887,7 +1887,7 @@ class AccountLine extends CommonObject
* @param User $user User object that delete
* @return int <0 if KO, >0 if OK
*/
function delete(User $user = null)
public function delete(User $user = null)
{
$nbko=0;
@@ -1930,14 +1930,14 @@ class AccountLine extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Delete bank line records
*
* @param User $user User object that delete
* @return int <0 if KO, >0 if OK
*/
function delete_urls(User $user = null)
public function delete_urls(User $user = null)
{
// phpcs:enable
$nbko=0;
@@ -1976,7 +1976,7 @@ class AccountLine extends CommonObject
* @param int $notrigger 0=Disable all triggers
* @return int <0 if KO, >0 if OK
*/
function update(User $user, $notrigger = 0)
public function update(User $user, $notrigger = 0)
{
$this->db->begin();
@@ -2002,7 +2002,7 @@ class AccountLine extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update conciliation field
*
@@ -2011,7 +2011,7 @@ class AccountLine extends CommonObject
* @param int $conciliated 1=Set transaction to conciliated, 0=Keep transaction non conciliated
* @return int <0 if KO, >0 if OK
*/
function update_conciliation(User $user, $cat, $conciliated = 1)
public function update_conciliation(User $user, $cat, $conciliated = 1)
{
// phpcs:enable
global $conf,$langs;
@@ -2067,7 +2067,7 @@ class AccountLine extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Increase/decrease value date of a rowid
*
@@ -2075,7 +2075,7 @@ class AccountLine extends CommonObject
* @param int $sign 1 or -1
* @return int >0 if OK, 0 if KO
*/
function datev_change($rowid, $sign = 1)
public function datev_change($rowid, $sign = 1)
{
// phpcs:enable
$sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid;
@@ -2107,34 +2107,34 @@ class AccountLine extends CommonObject
return 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Increase value date of a rowid
*
* @param int $id Id of line to change
* @return int >0 if OK, 0 if KO
*/
function datev_next($id)
public function datev_next($id)
{
// phpcs:enable
return $this->datev_change($id, 1);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Decrease value date of a rowid
*
* @param int $id Id of line to change
* @return int >0 if OK, 0 if KO
*/
function datev_previous($id)
public function datev_previous($id)
{
// phpcs:enable
return $this->datev_change($id, -1);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Increase/decrease operation date of a rowid
*
@@ -2142,7 +2142,7 @@ class AccountLine extends CommonObject
* @param int $sign 1 or -1
* @return int >0 if OK, 0 if KO
*/
function dateo_change($rowid, $sign = 1)
public function dateo_change($rowid, $sign = 1)
{
// phpcs:enable
$sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid;
@@ -2174,27 +2174,27 @@ class AccountLine extends CommonObject
return 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Increase operation date of a rowid
*
* @param int $id Id of line to change
* @return int >0 if OK, 0 if KO
*/
function dateo_next($id)
public function dateo_next($id)
{
// phpcs:enable
return $this->dateo_change($id, 1);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Decrease operation date of a rowid
*
* @param int $id Id of line to change
* @return int >0 if OK, 0 if KO
*/
function dateo_previous($id)
public function dateo_previous($id)
{
// phpcs:enable
return $this->dateo_change($id, -1);
@@ -2207,7 +2207,7 @@ class AccountLine extends CommonObject
* @param int $id Id of object to load
* @return void
*/
function info($id)
public function info($id)
{
$sql = 'SELECT b.rowid, b.datec, b.tms as datem,';
$sql.= ' b.fk_user_author, b.fk_user_rappro';
@@ -2257,7 +2257,7 @@ class AccountLine extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL
*/
function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0)
public function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0)
{
global $langs;
@@ -2298,12 +2298,12 @@ class AccountLine extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -2311,7 +2311,7 @@ class AccountLine extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
*/
function LibStatut($statut, $mode = 0)
public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;

View File

@@ -43,7 +43,7 @@ class BankAccounts extends DolibarrApi
/**
* Constructor
*/
function __construct()
public function __construct()
{
global $db;
$this->db = $db;
@@ -61,11 +61,11 @@ class BankAccounts extends DolibarrApi
*
* @throws RestException
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
$list = array();
if(! DolibarrApiAccess::$user->rights->banque->lire) {
if (! DolibarrApiAccess::$user->rights->banque->lire) {
throw new RestException(401);
}
@@ -121,7 +121,7 @@ class BankAccounts extends DolibarrApi
*
* @throws RestException
*/
function get($id)
public function get($id)
{
if (! DolibarrApiAccess::$user->rights->banque->lire) {
throw new RestException(401);
@@ -142,7 +142,7 @@ class BankAccounts extends DolibarrApi
* @param array $request_data Request data
* @return int ID of account
*/
function post($request_data = null)
public function post($request_data = null)
{
if (! DolibarrApiAccess::$user->rights->banque->configurer) {
throw new RestException(401);
@@ -173,7 +173,7 @@ class BankAccounts extends DolibarrApi
* @param array $request_data data
* @return int
*/
function put($id, $request_data = null)
public function put($id, $request_data = null)
{
if (! DolibarrApiAccess::$user->rights->banque->configurer) {
throw new RestException(401);
@@ -196,7 +196,7 @@ class BankAccounts extends DolibarrApi
}
else
{
throw new RestException(500, $account->error);
throw new RestException(500, $account->error);
}
}
@@ -206,7 +206,7 @@ class BankAccounts extends DolibarrApi
* @param int $id ID of account
* @return array
*/
function delete($id)
public function delete($id)
{
if (! DolibarrApiAccess::$user->rights->banque->configurer) {
throw new RestException(401);
@@ -237,7 +237,7 @@ class BankAccounts extends DolibarrApi
*
* @throws RestException
*/
function _validate($data)
private function _validate($data)
{
$account = array();
foreach (BankAccounts::$FIELDS as $field) {
@@ -248,14 +248,16 @@ class BankAccounts extends DolibarrApi
return $account;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->rowid);
@@ -273,7 +275,7 @@ class BankAccounts extends DolibarrApi
*
* @url GET {id}/lines
*/
function getLines($id)
public function getLines($id)
{
$list = array();
@@ -325,7 +327,7 @@ class BankAccounts extends DolibarrApi
*
* @url POST {id}/lines
*/
function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '')
public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '')
{
if (! DolibarrApiAccess::$user->rights->banque->modifier) {
throw new RestException(401);
@@ -337,8 +339,16 @@ class BankAccounts extends DolibarrApi
throw new RestException(404, 'account not found');
}
$result = $account->addline($date, $type, $label, $amount, $cheque_number, $category,
DolibarrApiAccess::$user, $cheque_writer, $cheque_bank);
$result = $account->addline(
$date,
$type,
$label,
$amount,
$cheque_number,
$category,
DolibarrApiAccess::$user,
$cheque_writer, $cheque_bank
);
if ($result < 0) {
throw new RestException(503, 'Error when adding line to account: ' . $account->error);
}
@@ -358,7 +368,7 @@ class BankAccounts extends DolibarrApi
*
* @url POST {id}/lines/{line_id}/links
*/
function addLink($id, $line_id, $url_id, $url, $label, $type)
public function addLink($id, $line_id, $url_id, $url, $label, $type)
{
if (! DolibarrApiAccess::$user->rights->banque->modifier) {
throw new RestException(401);

View File

@@ -99,7 +99,7 @@ class PaymentVarious extends CommonObject
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
$this->element = 'payment_various';
@@ -113,7 +113,7 @@ class PaymentVarious extends CommonObject
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK
*/
function update($user = null, $notrigger = 0)
public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
@@ -184,7 +184,7 @@ class PaymentVarious extends CommonObject
* @param User $user User that load
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $user = null)
public function fetch($id, $user = null)
{
global $langs;
$sql = "SELECT";
@@ -258,7 +258,7 @@ class PaymentVarious extends CommonObject
* @param User $user User that delete
* @return int <0 if KO, >0 if OK
*/
function delete($user)
public function delete($user)
{
global $conf, $langs;
@@ -292,7 +292,7 @@ class PaymentVarious extends CommonObject
*
* @return void
*/
function initAsSpecimen()
public function initAsSpecimen()
{
$this->id=0;
@@ -316,7 +316,7 @@ class PaymentVarious extends CommonObject
* @param User $user User that create
* @return int <0 if KO, >0 if OK
*/
function create($user)
public function create($user)
{
global $conf,$langs;
@@ -482,14 +482,14 @@ class PaymentVarious extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update link between payment various and line generate into llx_bank
*
* @param int $id_bank Id bank account
* @return int <0 if KO, >0 if OK
*/
function update_fk_bank($id_bank)
public function update_fk_bank($id_bank)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.$id_bank;
@@ -513,12 +513,12 @@ class PaymentVarious extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -526,7 +526,7 @@ class PaymentVarious extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
*/
function LibStatut($statut, $mode = 0)
public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -575,7 +575,7 @@ class PaymentVarious extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0)
public function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0)
{
global $db, $conf, $langs, $hookmanager;
global $langs;
@@ -644,8 +644,8 @@ class PaymentVarious extends CommonObject
* @param int $id Id of record
* @return void
*/
function info($id)
{
public function info($id)
{
$sql = 'SELECT v.rowid, v.datec, v.fk_user_author';
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
$sql.= ' WHERE v.rowid = '.$id;

View File

@@ -83,7 +83,7 @@ class Deplacement extends CommonObject
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
@@ -98,7 +98,7 @@ class Deplacement extends CommonObject
* @param User $user User that creates
* @return int <0 if KO, >0 if OK
*/
function create($user)
public function create($user)
{
global $conf;
@@ -183,7 +183,7 @@ class Deplacement extends CommonObject
* @param User $user User making update
* @return int <0 if KO, >0 if OK
*/
function update($user)
public function update($user)
{
global $langs;
@@ -245,7 +245,7 @@ class Deplacement extends CommonObject
* @param string $ref Ref of record
* @return int <0 if KO, >0 if OK
*/
function fetch($id, $ref = '')
public function fetch($id, $ref = '')
{
$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet as fk_project, extraparams";
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
@@ -288,7 +288,7 @@ class Deplacement extends CommonObject
* @param int $id Id of record to delete
* @return int <0 if KO, >0 if OK
*/
function delete($id)
public function delete($id)
{
$this->db->begin();
@@ -316,12 +316,12 @@ class Deplacement extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
*/
function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->statut, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@@ -329,7 +329,7 @@ class Deplacement extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
*/
function LibStatut($statut, $mode = 0)
public function LibStatut($statut, $mode = 0)
{
// phpcs:enable
global $langs;
@@ -345,26 +345,26 @@ class Deplacement extends CommonObject
elseif ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
}
elseif ($mode == 3)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
}
elseif ($mode == 4)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
}
elseif ($mode == 5)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
}
}
@@ -374,7 +374,7 @@ class Deplacement extends CommonObject
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL
*/
function getNomUrl($withpicto = 0)
public function getNomUrl($withpicto = 0)
{
global $langs;
@@ -400,7 +400,7 @@ class Deplacement extends CommonObject
* @param int $active Active or not
* @return array
*/
function listOfTypes($active = 1)
public function listOfTypes($active = 1)
{
global $langs;
@@ -437,7 +437,7 @@ class Deplacement extends CommonObject
* @param int $id Id of record
* @return void
*/
function info($id)
public function info($id)
{
$sql = 'SELECT c.rowid, c.datec, c.fk_user_author, c.fk_user_modif,';
$sql.= ' c.tms';

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