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

This commit is contained in:
markus 2019-03-04 17:26:40 +01:00
commit c905575d3e
789 changed files with 25790 additions and 19809 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

@ -191,6 +191,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install

View File

@ -271,6 +271,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install

View File

@ -188,6 +188,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install

View File

@ -199,6 +199,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install

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

@ -0,0 +1,136 @@
<?php
/* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.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 htdocs/accountancy/admin/closure.php
* \ingroup Advanced accountancy
* \brief Setup page to configure accounting expert module
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta","admin","accountancy"));
// Security check
if (empty($user->rights->accounting->chartofaccount)) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09');
$list_account_main = array (
'ACCOUNTING_RESULT_PROFIT',
'ACCOUNTING_RESULT_LOSS'
);
/*
* Actions
*/
if ($action == 'update') {
$error = 0;
$defaultjournal = GETPOST('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', 'alpha');
if (! empty($defaultjournal)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
} else {
$error ++;
}
foreach ($list_account_main as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
$form = new Form($db);
$formaccounting = new FormAccounting($db);
llxHeader();
$linkback = '';
print load_fiche_titre($langs->trans('MenuClosureAccounts'), $linkback, 'title_accountancy');
print $langs->trans("DefaultClosureDesc").'<br>';
print '<br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">';
// Define main accounts for closure
print '<table class="noborder" width="100%">';
foreach ($list_account_main as $key) {
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
$keydesc=$key.'_Desc';
$htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
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>';
}
// Journal
print '<tr class="oddeven">';
print '<td width="50%">' . $langs->trans("ACCOUNTING_CLOSURE_DEFAULT_JOURNAL") . '</td>';
print '<td>';
$defaultjournal=$conf->global->ACCOUNTING_CLOSURE_DEFAULT_JOURNAL;
print $formaccounting->select_journal($defaultjournal, "ACCOUNTING_CLOSURE_DEFAULT_JOURNAL", 9, 1, 0, 0);
print '</td></tr>';
print "</table>\n";
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
print '</form>';
// End of page
llxFooter();
$db->close();

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

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -144,6 +144,18 @@ if ($action == 'setenabledraftexport') {
}
}
if ($action == 'setenablesubsidiarylist') {
$setenablesubsidiarylist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
if (! $res > 0)
$error ++;
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/*
* View
*/
@ -251,6 +263,19 @@ if (! empty($user->admin))
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>' . $langs->trans("ACCOUNTANCY_COMBO_FOR_AUX") . '</td>';
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print '<td class="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=setenablesubsidiarylist&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=setenablesubsidiarylist&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . '</td>';
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {

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

@ -305,6 +305,7 @@ if (empty($reshook))
$object->skype = trim(GETPOST("skype", 'alpha'));
$object->twitter = trim(GETPOST("twitter", 'alpha'));
$object->facebook = trim(GETPOST("facebook", 'alpha'));
$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
$object->birth = $birthdate;
$object->typeid = GETPOST("typeid", 'int');
@ -450,6 +451,7 @@ if (empty($reshook))
$skype=GETPOST("member_skype", 'alpha');
$twitter=GETPOST("member_twitter", 'alpha');
$facebook=GETPOST("member_facebook", 'alpha');
$linkedin=GETPOST("member_linkedin", 'alpha');
$email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
$login=GETPOST("member_login", 'alpha');
$pass=GETPOST("password", 'alpha');
@ -479,6 +481,7 @@ if (empty($reshook))
$object->skype = $skype;
$object->twitter = $twitter;
$object->facebook = $facebook;
$object->linkedin = $linkedin;
$object->email = $email;
$object->login = $login;
@ -1029,6 +1032,12 @@ else
print '<tr><td>'.$langs->trans("Facebook").'</td><td><input type="text" name="member_facebook" size="40" value="'.(GETPOST('member_facebook', 'alpha')?GETPOST('member_facebook', 'alpha'):$object->facebook).'"></td></tr>';
}
// LinkedIn
if (! empty($conf->socialnetworks->enabled))
{
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="member_linkedin" size="40" value="'.(GETPOST('member_linkedin', 'alpha')?GETPOST('member_linkedin', 'alpha'):$object->linkedin).'"></td></tr>';
}
// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
@ -1281,10 +1290,16 @@ else
}
// Facebook
if (! empty($conf->socialnetworks->enabled))
{
print '<tr><td>'.$langs->trans("Facebook").'</td><td><input type="text" name="facebook" class="minwidth100" value="'.(isset($_POST["facebook"])?GETPOST("facebook"):$object->facebook).'"></td></tr>';
}
if (! empty($conf->socialnetworks->enabled))
{
print '<tr><td>'.$langs->trans("Facebook").'</td><td><input type="text" name="facebook" class="minwidth100" value="'.(isset($_POST["facebook"])?GETPOST("facebook"):$object->facebook).'"></td></tr>';
}
// LinkedIn
if (! empty($conf->socialnetworks->enabled))
{
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="linkedin" class="minwidth100" value="'.(isset($_POST["linkedin"])?GETPOST("linkedin"):$object->linkedin).'"></td></tr>';
}
// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";

View File

@ -137,6 +137,11 @@ class Adherent extends CommonObject
*/
public $facebook;
/**
* @var string linkedin account
*/
public $linkedin;
/**
* @var string Phone number
*/
@ -218,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;
@ -229,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.
*
@ -246,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;
@ -291,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;
@ -358,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; }
@ -374,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;
@ -500,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;
@ -550,6 +555,7 @@ class Adherent extends CommonObject
$sql.= ", skype = '".$this->db->escape($this->skype)."'";
$sql.= ", twitter = '".$this->db->escape($this->twitter)."'";
$sql.= ", facebook = '".$this->db->escape($this->facebook)."'";
$sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'";
$sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null");
$sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
$sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
@ -660,6 +666,7 @@ class Adherent extends CommonObject
$luser->skype=$this->skype;
$luser->twitter=$this->twitter;
$luser->facebook=$this->facebook;
$luser->linkedin=$this->linkedin;
$luser->office_phone=$this->phone;
$luser->user_mobile=$this->phone_mobile;
@ -701,6 +708,7 @@ class Adherent extends CommonObject
$lthirdparty->skype=$this->skype;
$lthirdparty->twitter=$this->twitter;
$lthirdparty->facebook=$this->facebook;
$lthirdparty->linkedin=$this->linkedin;
$lthirdparty->phone=$this->phone;
$lthirdparty->state_id=$this->state_id;
$lthirdparty->country_id=$this->country_id;
@ -752,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.
@ -760,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();
@ -817,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;
@ -927,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;
@ -1038,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;
@ -1072,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;
@ -1108,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;
@ -1139,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
*
@ -1147,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;
@ -1183,13 +1191,13 @@ 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;
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
$sql.= " d.note_public,";
$sql.= " d.email, d.skype, d.twitter, d.facebook, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
$sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
$sql.= " d.datec as datec,";
$sql.= " d.tms as datem,";
@ -1266,15 +1274,19 @@ class Adherent extends CommonObject
$this->skype = $obj->skype;
$this->twitter = $obj->twitter;
$this->facebook = $obj->facebook;
$this->linkedin = $obj->linkedin;
$this->photo = $obj->photo;
$this->statut = $obj->statut;
$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;
@ -1316,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
@ -1324,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;
@ -1400,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;
@ -1486,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;
@ -1779,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;
@ -1832,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;
@ -1874,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;
@ -1933,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;
@ -1997,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");
@ -2018,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;
@ -2109,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
*
@ -2124,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;
@ -2202,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;
@ -2238,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;
@ -2337,7 +2349,7 @@ class Adherent extends CommonObject
*
* @return void
*/
function initAsSpecimen()
public function initAsSpecimen()
{
global $user,$langs;
@ -2362,6 +2374,7 @@ class Adherent extends CommonObject
$this->skype = 'skypepseudo';
$this->twitter = 'twitterpseudo';
$this->facebook = 'facebookpseudo';
$this->linkedin = 'linkedinpseudo';
$this->phone = '0999999999';
$this->phone_perso = '0999999998';
$this->phone_mobile = '0999999997';
@ -2390,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
*
@ -2400,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;
@ -2412,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;
@ -2469,8 +2482,9 @@ class Adherent extends CommonObject
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
if ($this->twitter && ! empty($conf->global->LDAP_MEMBER_FIELD_TWITTER)) $info[$conf->global->LDAP_MEMBER_FIELD_TWITTER] = $this->twitter;
if ($this->facebook && ! empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook;
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
if ($this->facebook && ! empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook;
if ($this->linkedin && ! empty($conf->global->LDAP_MEMBER_FIELD_LINKEDIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LINKEDIN] = $this->linkedin;
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
@ -2525,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,';
@ -2581,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";
@ -2763,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) {
@ -294,7 +294,7 @@ class Members extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@ -328,7 +328,7 @@ class Members extends DolibarrApi
*
* @url GET {id}/subscriptions
*/
function getSubscriptions($id)
public function getSubscriptions($id)
{
$obj_ret = array();
@ -361,7 +361,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 +389,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) {
@ -272,7 +272,7 @@ class MembersTypes extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);

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

@ -88,7 +88,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,37,0,25,0);
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0);
// Name of SQL tables of dictionaries
$tabname=array();

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

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.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
@ -96,7 +97,7 @@ dol_fiche_head($head, 'setup', '', 0, 'user');
print '<br>';
$arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook');
$arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook', 'linkedin'=>'LinkedIn');
foreach($arrayofsocialnetworks as $snkey => $snlabel) {
$consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey);

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;
@ -355,6 +354,22 @@ class Documents extends DolibarrApi
$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
}
else if ($modulepart == 'produit' || $modulepart == 'product')
{
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$object = new Product($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
throw new RestException(404, 'Product not found');
}
$upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product');
}
else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@ -376,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.');
}
@ -412,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
@ -421,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;
@ -501,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.');
@ -576,6 +592,7 @@ class Documents extends DolibarrApi
return dol_basename($destfile);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName
/**
* Validate fields before create or update object
*
@ -583,7 +600,8 @@ 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();
@ -279,7 +279,7 @@ class Setup extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@ -334,7 +334,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 +397,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 +442,7 @@ class Setup extends DolibarrApi
return $list;
}
/**
* Get the list of currencies.
*
@ -458,10 +458,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 +516,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 +595,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 +659,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 +720,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 +780,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 +840,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 +898,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;
}
}
}

146
htdocs/bom/admin/setup.php Normal file
View File

@ -0,0 +1,146 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.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 bom/admin/setup.php
* \ingroup bom
* \brief Bom setup page.
*/
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
global $langs, $user;
// Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once '../lib/bom.lib.php';
//require_once "../class/myclass.class.php";
// Translations
$langs->loadLangs(array("admin", "mrp"));
// Access control
if (! $user->admin) accessforbidden();
// Parameters
$action = GETPOST('action', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$arrayofparameters=array(
'BILLOFMATERIALS_MYPARAM1'=>array('css'=>'minwidth200','enabled'=>1),
'BILLOFMATERIALS_MYPARAM2'=>array('css'=>'minwidth500','enabled'=>1)
);
/*
* Actions
*/
if ((float) DOL_VERSION >= 6)
{
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
/*
* View
*/
$page_name = "BomSetup";
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');
// Configuration header
$head = bomAdminPrepareHead();
dol_fiche_head($head, 'settings', '', -1, "bom");
// Setup page goes here
echo $langs->trans("BomSetupPage").'<br><br>';
if ($action == 'edit')
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach($arrayofparameters as $key => $val)
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css'])?'minwidth200':$val['css']).'" value="' . $conf->global->$key . '"></td></tr>';
}
print '</table>';
print '<br><div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '<br>';
}
else
{
if (! empty($arrayofparameters))
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach($arrayofparameters as $key => $val)
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
print '</td><td>' . $conf->global->$key . '</td></tr>';
}
print '</table>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';
}
else
{
print '<br>'.$langs->trans("NothingToSetup");
}
}
// Page end
dol_fiche_end();
llxFooter();
$db->close();

471
htdocs/bom/bom_card.php Normal file
View File

@ -0,0 +1,471 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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 bom_card.php
* \ingroup bom
* \brief Page to create/edit/view bom
*/
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("FORCECSP")) define('FORCECSP','none'); // Disable all Content Security Policies
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
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("mrp","other"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
// Initialize technical objects
$object=new BillOfMaterials($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
$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 (empty($action) && empty($id) && empty($ref)) $action='view';
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
//if ($user->societe_id > 0) $socid = $user->societe_id;
//$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
/*
* Actions
*
* Put here all code to do according to value of "action" parameter
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
$error=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__');
}
$triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, delete or clone
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails
$trigger_name='BILLOFMATERIALS_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_BILLOFMATERIALS_TO';
$trackid='bom'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
/*
* View
*
* Put here all code to build page
*/
$form=new Form($db);
$formfile=new FormFile($db);
llxHeader('', 'NewBOM', '');
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_myfunc()
{
jQuery("#myid").removeAttr(\'disabled\');
jQuery("#myid").attr(\'disabled\',\'disabled\');
}
init_myfunc();
jQuery("#mybutton").click(function() {
init_myfunc();
});
});
</script>';
// Part to create
if ($action == 'create')
{
print load_fiche_titre($langs->trans("NewBOM"));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head(array(), '');
print '<table class="border centpercent">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
print '</table>'."\n";
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
print '&nbsp; ';
print '<input type="'.($backtopage?"submit":"button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage?'':' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
print '</div>';
print '</form>';
}
// Part to edit record
if (($id || $ref) && $action == 'edit')
{
print load_fiche_titre($langs->trans("BillOfMaterials"));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
dol_fiche_head();
print '<table class="border centpercent">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
print '</table>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
}
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
{
$res = $object->fetch_optionals();
$head = bomPrepareHead($object);
dol_fiche_head($head, 'card', $langs->trans("NewBOM"), -1, 'bom');
$formconfirm = '';
// Confirmation to delete
if ($action == 'delete')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
}
// Clone confirmation
if ($action == 'clone') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneBillOfMaterials'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
// Confirmation of action xxxx
if ($action == 'xxx')
{
$formquestion=array();
/*
$forcecombo=0;
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
);
*/
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
}
// Call Hook formConfirm
$parameters = array('lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
// Print form confirm
print $formconfirm;
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' .dol_buildpath('/bom/bom_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
/*
// Ref bis
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->bom->write)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.=$proj->getNomUrl();
} else {
$morehtmlref.='';
}
}
}
*/
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'."\n";
// Common attributes
//$keyforbreak='fieldkeytoswithonsecondcolumn';
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div><br>';
dol_fiche_end();
// Buttons for actions
if ($action != 'presend' && $action != 'editline') {
print '<div class="tabsAction">'."\n";
$parameters=array();
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Send
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
// Modify
if ($user->rights->bom->write)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
// Clone
if ($user->rights->bom->write)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;socid=' . $object->socid . '&amp;action=clone&amp;object=order">' . $langs->trans("ToClone") . '</a></div>';
}
/*
if ($user->rights->bom->write)
{
if ($object->status == 1)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=disable">'.$langs->trans("Disable").'</a>'."\n";
}
else
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=enable">'.$langs->trans("Enable").'</a>'."\n";
}
}
*/
if ($user->rights->bom->delete)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n";
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
}
print '</div>'."\n";
}
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'presend')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
// Documents
/*$objref = dol_sanitizeFileName($object->ref);
$relativepath = $comref . '/' . $comref . '.pdf';
$filedir = $conf->bom->dir_output . '/' . $objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->bom->create; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
*/
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAXEVENT = 10;
$morehtmlright = '<a href="'.dol_buildpath('/bom/bom_info.php', 1).'?id='.$object->id.'">';
$morehtmlright.= $langs->trans("SeeAll");
$morehtmlright.= '</a>';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'bom', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
print '</div></div></div>';
}
//Select mail models is same action as presend
/*
if (GETPOST('modelselected')) $action = 'presend';
// Presend form
$modelmail='inventory';
$defaulttopic='InformationMessage';
$diroutput = $conf->product->dir_output.'/inventory';
$trackid = 'stockinv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
*/
}
// End of page
llxFooter();
$db->close();

166
htdocs/bom/bom_document.php Normal file
View File

@ -0,0 +1,166 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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 bom_document.php
* \ingroup bom
* \brief Tab for documents linked to BillOfMaterials
*/
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
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("mrp","companies","other","mails"));
$action=GETPOST('action', 'aZ09');
$confirm=GETPOST('confirm', 'alpha');
$id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
//if ($user->societe_id > 0) $socid = $user->societe_id;
//$result = restrictedArea($user, 'bom', $id);
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
//if (! $sortfield) $sortfield="position_name";
// Initialize technical objects
$object=new BillOfMaterials($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomdocument', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('bom');
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->id);
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->ref);
/*
* Actions
*/
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
/*
* View
*/
$form = new Form($db);
$title=$langs->trans("BillOfMaterials").' - '.$langs->trans("Files");
$help_url='';
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url);
if ($object->id)
{
/*
* Show tabs
*/
$head = bomPrepareHead($object);
dol_fiche_head($head, 'document', $langs->trans("BillOfMaterials"), -1, 'bom');
// Build file list
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
$totalsize=0;
foreach($filearray as $key => $file)
{
$totalsize+=$file['size'];
}
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' .dol_buildpath('/bom/bom_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Number of files
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
// Total size
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
dol_fiche_end();
$modulepart = 'bom';
//$permission = $user->rights->bom->create;
$permission = 1;
//$permtoedit = $user->rights->bom->create;
$permtoedit = 1;
$param = '&id=' . $object->id;
//$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/';
$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->ref).'/';
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}
else
{
accessforbidden('', 0, 0);
}
// End of page
llxFooter();
$db->close();

596
htdocs/bom/bom_list.php Normal file
View File

@ -0,0 +1,596 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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 bom_list.php
* \ingroup bom
* \brief List page for bom
*/
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL'
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
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("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)
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int');
// Load variable for pagination
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
//if (! $sortfield) $sortfield="p.date_fin";
//if (! $sortorder) $sortorder="DESC";
// Initialize technical objects
$object = new BillOfMaterials($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('bom'); // Load $extrafields->attributes['bom']
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Default sort order (if not yet defined by previous GETPOST)
if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition.
if (! $sortorder) $sortorder="ASC";
// Security check
$socid=0;
if ($user->societe_id > 0) // Protection if external user
{
//$socid = $user->societe_id;
accessforbidden();
}
//$result = restrictedArea($user, 'bom', $id, '');
// Initialize array of search criterias
$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');
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach($object->fields as $key => $val)
{
if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
}
// Definition of fields for list
$arrayfields=array();
foreach($object->fields as $key => $val)
{
// If $val['visible']==0, then we never show the field
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
}
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/*
* Actions
*/
if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') ||GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
foreach($object->fields as $key => $val)
{
$search[$key]='';
}
$toselect='';
$search_array_options=array();
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
{
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
}
// Mass actions
$objectclass='BillOfMaterials';
$objectlabel='BillOfMaterials';
$permtoread = $user->rights->bom->read;
$permtodelete = $user->rights->bom->delete;
$uploaddir = $conf->bom->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
/*
* View
*/
$form=new Form($db);
$now=dol_now();
//$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials";
$help_url='';
$title = $langs->trans('ListOfBOMs');
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';
foreach($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label']))
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/', '', $sql);
$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")";
else $sql.=" WHERE 1 = 1";
foreach($search as $key => $val)
{
if ($key == 'status' && $search[$key] == -1) continue;
$mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
}
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY "
foreach($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/','', $sql);
*/
$sql.=$db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
{
$page = 0;
$offset = 0;
}
}
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
{
$num = $nbtotalofrecords;
}
else
{
$sql.= $db->plimit($limit+1, $offset);
$resql=$db->query($sql);
if (! $resql)
{
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
}
// Direct jump if only one record found
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".dol_buildpath('/bom/bom_card.php', 1).'?id='.$id);
exit;
}
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url);
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_myfunc()
{
jQuery("#myid").removeAttr(\'disabled\');
jQuery("#myid").attr(\'disabled\',\'disabled\');
}
init_myfunc();
jQuery("#mybutton").click(function() {
init_myfunc();
});
});
</script>';
$arrayofselected=is_array($toselect)?$toselect:array();
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
foreach($search as $key => $val)
{
$param.= '&search_'.$key.'='.urlencode($search[$key]);
}
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->bom->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton='';
//if ($user->rights->bom->creer)
//{
$newcardbutton='<a class="butActionNew" href="bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle">'.$langs->trans('New').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
//}
//else
//{
// $newcardbutton='<a class="butActionNewRefused" href="#">'.$langs->trans('New');
// $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
// $newcardbutton.= '</a>';
//}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
// Add code for pre mass action (confirmation or email presend form)
$topicmail="SendBillOfMaterialsRef";
$modelmail="bom";
$objecttmp=new BillOfMaterials($db);
$trackid='xxxx'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
}
$moreforfilter = '';
/*$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
$moreforfilter.= '</div>';*/
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Fields title search
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
foreach($object->fields as $key => $val)
{
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>'."\n";
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
foreach($object->fields as $key => $val)
{
$cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
{
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
{
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
}
}
// Loop on record
// --------------------------------------------------------------------
$i=0;
$totalarray=array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen
// Store properties in $object
$object->id = $obj->rowid;
foreach($object->fields as $key => $val)
{
if (isset($obj->$key)) $object->$key = $obj->$key;
}
// 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 (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td';
if ($cssforfield || $val['css']) print ' class="';
print $cssforfield;
if ($cssforfield && $val['css']) print ' ';
print $val['css'];
if ($cssforfield || $val['css']) print '"';
print '>';
print $object->showOutputField($val, $key, $obj->$key, '');
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
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
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print '</tr>';
$i++;
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
// If no record found
if ($num == 0)
{
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
$db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";
print '</div>'."\n";
print '</form>'."\n";
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
{
$hidegeneratedfilelistifempty=1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$formfile = new FormFile($db);
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;', '&', $param);
$filedir=$diroutputmassaction;
$genallowed=$user->rights->bom->read;
$delallowed=$user->rights->bom->create;
print $formfile->showdocuments('massfilesarea_bom', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
}
// End of page
llxFooter();
$db->close();

164
htdocs/bom/bom_note.php Normal file
View File

@ -0,0 +1,164 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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 bom_note.php
* \ingroup bom
* \brief Car with notes on BillOfMaterials
*/
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
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("mrp","companies"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
// Initialize technical objects
$object=new BillOfMaterials($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomnote','globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('bom');
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
//if ($user->societe_id > 0) $socid = $user->societe_id;
//$result = restrictedArea($user, 'bom', $id);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity] . "/" . $object->id;
$permissionnote=1;
//$permissionnote=$user->rights->bom->creer; // Used by the include of actions_setnotes.inc.php
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
/*
* View
*/
$form = new Form($db);
//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
$help_url='';
llxHeader('', $langs->trans('BillOfMaterials'), $help_url);
if ($id > 0 || ! empty($ref))
{
$object->fetch_thirdparty();
$head = bomPrepareHead($object);
dol_fiche_head($head, 'note', $langs->trans("BillOfMaterials"), -1, 'bom');
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' .dol_buildpath('/bom/bom_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
/*
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->bom->creer)
{
if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}*/
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print '</div>';
dol_fiche_end();
}
// End of page
llxFooter();
$db->close();

View File

@ -0,0 +1,324 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.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/>.
*/
use Luracast\Restler\RestException;
dol_include_once('/bom/class/bom.class.php');
/**
* \file bom/class/api_bom.class.php
* \ingroup bom
* \brief File for API management of bom.
*/
/**
* API class for bom bom
*
* @smart-auto-routing false
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class BillOfMaterialsApi extends DolibarrApi
{
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
'name',
);
/**
* @var BillOfMaterials $bom {@type BillOfMaterials}
*/
public $bom;
/**
* Constructor
*
* @url GET /
*
*/
public function __construct()
{
global $db, $conf;
$this->db = $db;
$this->bom = new BillOfMaterials($this->db);
}
/**
* Get properties of a bom object
*
* Return an array with bom informations
*
* @param int $id ID of bom
* @return array|mixed data without useless information
*
* @url GET boms/{id}
* @throws RestException
*/
public function get($id)
{
if(! DolibarrApiAccess::$user->rights->bom->read) {
throw new RestException(401);
}
$result = $this->bom->fetch($id);
if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found');
}
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->bom);
}
/**
* List boms
*
* Get a list of boms
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of order objects
*
* @throws RestException
*
* @url GET /boms/
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf;
$obj_ret = array();
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
$restictonsocid = 0; // Set to 1 if there is a field socid in table of object
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
$sql = "SELECT t.rowid";
if ($restictonsocid && (!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."bom_mytable as t";
if ($restictonsocid && (!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 1 = 1";
// Example of use $mode
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
$tmpobject = new BillOfMaterials($db);
if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')';
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
if ($restictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter
if ($restictonsocid && $search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
$sql.= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
while ($i < $num)
{
$obj = $db->fetch_object($result);
$bom_static = new BillOfMaterials($db);
if($bom_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($bom_static);
}
$i++;
}
}
else {
throw new RestException(503, 'Error when retrieve bom list');
}
if( ! count($obj_ret)) {
throw new RestException(404, 'No bom found');
}
return $obj_ret;
}
/**
* Create bom object
*
* @param array $request_data Request datas
* @return int ID of bom
*
* @url POST boms/
*/
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->bom->create) {
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
foreach($request_data as $field => $value) {
$this->bom->$field = $value;
}
if( ! $this->bom->create(DolibarrApiAccess::$user)) {
throw new RestException(500);
}
return $this->bom->id;
}
/**
* Update bom
*
* @param int $id Id of bom to update
* @param array $request_data Datas
* @return int
*
* @url PUT boms/{id}
*/
public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->bom->create) {
throw new RestException(401);
}
$result = $this->bom->fetch($id);
if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found');
}
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
$this->bom->$field = $value;
}
if($this->bom->update($id, DolibarrApiAccess::$user))
return $this->get($id);
return false;
}
/**
* Delete bom
*
* @param int $id BillOfMaterials ID
* @return array
*
* @url DELETE bom/{id}
*/
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->bom->delete) {
throw new RestException(401);
}
$result = $this->bom->fetch($id);
if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found');
}
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( !$this->bom->delete(DolibarrApiAccess::$user, 0))
{
throw new RestException(500);
}
return array(
'success' => array(
'code' => 200,
'message' => 'BillOfMaterials deleted'
)
);
}
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
/*unset($object->note);
unset($object->address);
unset($object->barcode_type);
unset($object->barcode_type_code);
unset($object->barcode_type_label);
unset($object->barcode_type_coder);*/
return $object;
}
/**
* Validate fields before create or update object
*
* @param array $data Data to validate
* @return array
*
* @throws RestException
*/
private function _validate($data)
{
$bom = array();
foreach (BillOfMaterialsApi::$FIELDS as $field) {
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$bom[$field] = $data[$field];
}
return $bom;
}
}

File diff suppressed because it is too large Load Diff

124
htdocs/bom/lib/bom.lib.php Normal file
View File

@ -0,0 +1,124 @@
<?php
/* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.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 bom/lib/bom.lib.php
* \ingroup bom
* \brief Library files with common functions for BillOfMaterials
*/
/**
* Prepare admin pages header
*
* @return array
*/
function bomAdminPrepareHead()
{
global $langs, $conf;
$langs->load("mrp");
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/admin/bom.php";
$head[$h][1] = $langs->trans("Settings");
$head[$h][2] = 'settings';
$h++;
/*$head[$h][0] = dol_buildpath("/bom/admin/about.php", 1);
$head[$h][1] = $langs->trans("About");
$head[$h][2] = 'about';
$h++;
*/
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(
// 'entity:+tabname:Title:@bom:/bom/mypage.php?id=__ID__'
//); // to add new tab
//$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');
return $head;
}
/**
* Prepare array of tabs for BillOfMaterials
*
* @param BillOfMaterials $object BillOfMaterials
* @return array Array of tabs
*/
function bomPrepareHead($object)
{
global $db, $langs, $conf;
$langs->load("mrp");
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/bom/bom_card.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
{
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = dol_buildpath('/bom/bom_note.php', 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
$head[$h][2] = 'note';
$h++;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->bom->dir_output . "/bom/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = dol_buildpath("/bom/bom_document.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
$head[$h][2] = 'document';
$h++;
$head[$h][0] = dol_buildpath("/bom/bom_agenda.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
$head[$h][2] = 'agenda';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(
// 'entity:+tabname:Title:@bom:/bom/mypage.php?id=__ID__'
//); // to add new tab
//$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');
return $head;
}

View File

@ -0,0 +1,3 @@
# DO NOT DELETE THIS FILE MANUALLY
# File to flag module built using official module template.
# When this file is present into a module directory, you can edit it with the module builder tool. Use ModuleBuilder if you want to delete module.

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);
@ -267,7 +267,7 @@ class Categories extends DolibarrApi
* @param Categorie $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@ -324,7 +324,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

@ -895,7 +895,7 @@ if ($action == 'create')
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
$urloption='?action=create';
$url = dol_buildpath('comm/action/card.php', 2).$urloption;
@ -1293,7 +1293,7 @@ if ($id > 0)
$numprojet=$formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0);
if ($numprojet==0)
{
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'">'.$langs->trans("AddProject").'</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'">'.$langs->trans("AddProject").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
}
print '</td></tr>';
}

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) {
@ -319,51 +319,51 @@ class AgendaEvents extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
private function _cleanObjectDatas($object)
{
$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

@ -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

@ -1590,7 +1590,7 @@ if ($action == 'create')
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
}
print '</tr>' . "\n";
@ -1677,7 +1677,7 @@ if ($action == 'create')
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td>';
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . ' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
print '</tr>';
}

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) {
@ -790,7 +788,7 @@ class Proposals extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);

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";
@ -1357,7 +1357,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
$sql.= ", p.date_livraison as date_livraison";
$sql.= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams";
$sql.= ", p.note_private, p.note_public";
$sql.= ", p.fk_projet, p.fk_statut";
$sql.= ", p.fk_projet as fk_project, p.fk_statut";
$sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture";
$sql.= ", p.fk_delivery_address";
$sql.= ", p.fk_availability";
@ -1412,7 +1412,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise
$this->total_localtax2 = $obj->localtax2;
$this->total_ttc = $obj->total;
$this->socid = $obj->fk_soc;
$this->fk_project = $obj->fk_projet;
$this->fk_project = $obj->fk_project;
$this->modelpdf = $obj->model_pdf;
$this->last_main_doc = $obj->last_main_doc;
$this->note = $obj->note_private; // TODO deprecated
@ -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

@ -1636,7 +1636,7 @@ if ($action == 'create' && $user->rights->commande->creer)
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
}
print '</tr>' . "\n";
@ -1727,7 +1727,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td>';
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . ' <span class="fa fa-plus-circle valignmiddle"></span></a>';
print '</td>';
print '</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';
@ -844,7 +844,7 @@ class Orders extends DolibarrApi
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object)
private function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
@ -866,7 +866,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();

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