diff --git a/.github/workflows/stale-issues-safe.yml b/.github/workflows/stale-issues-safe.yml index 55599654707..ed37c9aadc2 100644 --- a/.github/workflows/stale-issues-safe.yml +++ b/.github/workflows/stale-issues-safe.yml @@ -16,7 +16,7 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).' stale-label: 'Issue Stale (automatic label)' - exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE)' + exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE),Analysis of PR in progres' days-before-stale: 365 days-before-close: 15 operations-per-run: 100 diff --git a/ChangeLog b/ChangeLog index 0483767ac50..7089658872e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,10 @@ For Users: NEW: Module MO (Manufacturing Order) is available as stable module. For Developers or integrators: - +* A new way to navigate between pages in list is available. To use it, you must + - replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); + - remove input field in form '';' + - add parameter $pagenavastextinput to value 1 when calling print_barre_liste WARNING: @@ -23,6 +26,36 @@ Following changes may create regressions for some external modules, but were nec by a "_" automatically when a reference (with a custom numbering mask that use it) is generated. + +***** ChangeLog for 11.0.3 compared to 11.0.2 ***** +FIX: unit price for selected supplier products not set. NaN was used. +FIX: use bad var to check if total is positive for each VAT rate when validating an invoice +FIX: status missing from last customer invoices box when using MAIN_STATUS_USES_CSS +FIX: translations for "orders" not loaded in the homepage box +FIX: #13194 +FIX: #13274 cannot add or update 0 value for an int or double extrafield +FIX: #13285 SQL error during migration with pgsql +FIX: #13294 +FIX: #13313 +FIX: Clone Fourn Command, add line's extrafields +FIX: cols parameter not propagated to tpl +FIX: CSRF error when creating an intervention +FIX: date order was -1D and desc with label repetition +FIX: empty of series in graph of product distribution +FIX: fk_type subscription list via api REST +FIX: link when using anchor on "/" in website module +FIX: menu export document was not visible when using "simple accounting" +FIX: missing class declaration +FIX: missing global $conf +FIX: Missing token in some forms (avoid unset POST errors) +FIX: params of setEventMessage($langs->trans('ErrorProductClone')... +FIX: Remove unexisting link +FIX: mass action on stock movements +FIX: substitute lines dates values on doc generator (ODT, ...) +FIX: Ticket - Load Cache Messages Ticket, wrong message's status +FIX: Ticket Public - Private messages are displayed +FIX: wrong include - replace extrafields_create.tpl.php to extrafields_add.tpl.php + ***** ChangeLog for 11.0.2 compared to 11.0.1 ***** FIX: #10309 FIX: #13110 @@ -30,7 +63,8 @@ FIX: #13118 FIX: #13124 FIX: #13131 FIX: #13135 -FIX: #13146 #13198 +FIX: #13146 +FIX: #13198 FIX: #13175 FIX: #13182 FIX: #13183 diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 994beb95eff..b9a6b837d7f 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -102,10 +102,13 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi ; Put here path of Wampserver applications ; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 ; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 -; Value OK: apache 2.4.19, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe) +; Value OK: apache 2.4.9, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe) +; Value To test: apache 2.4.41, php 7.3.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe) Source: "C:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange" -Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" -Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" +;Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" +Source: "C:\wamp64\bin\apache\apache2.4.41\*.*"; DestDir: "{app}\bin\apache\apache2.4.41"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log" +;Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" +Source: "C:\wamp64\bin\php\php7.3.12\*.*"; DestDir: "{app}\bin\php\php7.3.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log" Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe" ; Mysql data files (does not overwrite if exists) Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db" @@ -119,9 +122,11 @@ Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ". Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion; Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion; Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion; -Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion; +;Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion; +Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.41\conf"; Flags: ignoreversion; Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion; -Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion; +;Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion; +Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php7.3.12"; Flags: ignoreversion; Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion; Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion; Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion; @@ -227,8 +232,10 @@ procedure InitializeWizard(); begin //version des applis, a modifier pour chaque version de WampServer 2 - apacheVersion := '2.4.9'; - phpVersion := '5.5.12' ; + //apacheVersion := '2.4.9'; + //phpVersion := '5.5.12' ; + apacheVersion := '2.4.41'; + phpVersion := '7.3.12' ; mysqlVersion := '5.0.45'; phpmyadminVersion := '4.1.14'; @@ -392,40 +399,42 @@ begin //---------------------------------------------- // TODO Update this list when changing PHP/Apache versions - phpDllCopy := 'fdftk.dll'; +// phpDllCopy := 'fdftk.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'fribidi.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'gds32.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'libeay32.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'libmhash.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'libmysql.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'libpq.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'msql.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'libmcrypt.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'libmysqli.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'ntwdblib.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); + +// phpDllCopy := 'php5activescript.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'php5nsapi.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); + phpDllCopy := 'php7apache2_4.dll'; filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'fribidi.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'gds32.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'libeay32.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'libmhash.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'libmysql.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'libpq.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'msql.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'libmcrypt.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'libmysqli.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'ntwdblib.dll'; + phpDllCopy := 'php7ts.dll'; filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'php5activescript.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'php5nsapi.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'php5ts.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - - phpDllCopy := 'ssleay32.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); - phpDllCopy := 'yaz.dll'; - filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'ssleay32.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); +// phpDllCopy := 'yaz.dll'; +// filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False); // Remove lock file diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index f68ca6a77f5..c6b8cd330c8 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -2,7 +2,7 @@ #---------------------------------------------------------------------------- # \file build/makepack-dolibarr.pl # \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps) -# \author (c)2004-2015 Laurent Destailleur +# \author (c)2004-2020 Laurent Destailleur # # This is list of constant you can set to have generated packages moved into a specific dir: #DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild' @@ -430,12 +430,14 @@ if ($nboftargetok) { $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; print 'Run git push -f --tags'."\n"; $ret=`git push -f --tags`; + #$ret=`git push -f origin "$MAJOR.$MINOR.$BUILD"`; } } else { print 'Run git push --tags'."\n"; $ret=`git push --tags`; + #$ret=`git push origin "$MAJOR.$MINOR.$BUILD"`; } chdir("$olddir"); } diff --git a/dev/translation/txpull.sh b/dev/translation/txpull.sh index 3f24bd0912d..fcccae98221 100755 --- a/dev/translation/txpull.sh +++ b/dev/translation/txpull.sh @@ -54,5 +54,5 @@ fi echo Think to launch also: echo "> dev/tools/fixaltlanguages.sh fix all" -echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with ''" +echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with '' on *.lang files" diff --git a/doc/images/README.md b/doc/images/README.md index 798cf599b4c..7422d246d40 100644 --- a/doc/images/README.md +++ b/doc/images/README.md @@ -10,7 +10,11 @@ https://github.com/Dolibarr/foundation -* Few icons are from http://led24.de/iconset/. This is original README file for this source: +* Few icons are / were from website led24.de + +* Attention: This website is no longer available! + +This is original README file for this source: ------------------------------------------------------- You can do whatever you want with these icons (use on web or in desktop applications) as long as you don’t pass them off as your own and remove this readme file. A credit statement and a link back to http://led24.de/iconset/ or http://led24.de/ would be appreciated. diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 7da6de23725..1afe2ecca18 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -70,11 +70,11 @@ $arrayfields = array( 'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1), 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), - 'aa.reconciliable'=>array('label'=>$langs->trans("Reconciliable"), 'checked'=>1), + 'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1), 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) ); -if ($conf->global->MAIN_FEATURES_LEVEL < 2) unset($arrayfields['aa.reconciliable']); +if ($conf->global->MAIN_FEATURES_LEVEL < 2) unset($arrayfields['aa.reconcilable']); $accounting = new AccountingAccount($db); @@ -197,7 +197,7 @@ if ($action == 'delete') { $pcgver = $conf->global->CHARTOFACCOUNTS; -$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.reconciliable, aa.active, "; +$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.reconcilable, aa.active, "; $sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity; @@ -357,7 +357,7 @@ if ($resql) print ''; } if (!empty($arrayfields['aa.pcg_type']['checked'])) print ''; - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconciliable']['checked'])) print ' '; } + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print ' '; } if (!empty($arrayfields['aa.active']['checked'])) print ' '; print ''; $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); @@ -371,7 +371,7 @@ if ($resql) if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $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, '', $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 ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconciliable']['checked'])) print_liste_field_titre($arrayfields['aa.reconciliable']['label'], $_SERVER["PHP_SELF"], 'aa.reconciliable', '', $param, '', $sortfield, $sortorder); } + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder); } 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"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -450,9 +450,9 @@ if ($resql) if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // Activated or not reconciliation on accounting account - if (!empty($arrayfields['aa.reconciliable']['checked'])) { + if (!empty($arrayfields['aa.reconcilable']['checked'])) { print ''; - if (empty($obj->reconciliable)) { + if (empty($obj->reconcilable)) { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index 1dfb324599c..1a212c00b84 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -197,7 +197,7 @@ if ($resql) { $param="&socid=".$socid; print '
'; - print ''; + print ''; print ''; $letteringbutton = ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 5a5a4d36c21..f71b41a9c28 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -195,7 +195,7 @@ if ($resql) { $param="&socid=".$socid; print ''; - print ''; + print ''; print ''; $letteringbutton = ''; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index bb1f1b8679c..6c628ae52c3 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1088,9 +1088,23 @@ class AccountancyExport { $soc = $this->db->fetch_object($resql); - $address = str_replace(array("\t", "\n", "\r"), " ", $soc->address); + $address=array('','',''); + if (strpos($soc->address, "\n")!==false) { + $address = explode("\n", $soc->address); + if (is_array($address) && count($address)>0) { + foreach($address as $key=>$data) { + $address[$key]=str_replace(array("\t", "\n", "\r"), "", $data); + $address[$key]=dol_trunc($address[$key], 40, 'right', 'UTF-8', 1); + } + } + } else { + $address[0] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 0, 40); + $address[1] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 41, 40); + $address[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 82, 40); + } $type_enregistrement = 'C'; + //TYPE print $type_enregistrement.$separator; //NOCL print $soc->code_client.$separator; @@ -1099,15 +1113,15 @@ class AccountancyExport //LIBI print $separator; //TITR - print getFormeJuridiqueLabel($soc->fk_forme_juridique).$separator; + print $separator; //RSSO print $soc->nom.$separator; //CAD1 - print substr($address, 0, 40).$separator; + print $address[0].$separator; //CAD2 - print substr($address, 41, 40).$separator; + print $address[1].$separator; //CAD3 - print substr($address, 82, 40).$separator; + print $address[2].$separator; //COPO print $soc->zip.$separator; //BUDI @@ -1129,7 +1143,7 @@ class AccountancyExport //COMM print $separator; //SIRE - print $soc->siret.$separator; + print str_replace(" ", "", $soc->siret).$separator; //RIBP print $separator; //DOBQ @@ -1267,8 +1281,6 @@ class AccountancyExport } else { print $separator; } - // SECT - print $separator; // CTRE print $separator; // NORL @@ -1286,13 +1298,13 @@ class AccountancyExport // CDES print $separator; // QTUE - print '0'.$separator; + print $separator; // MTDV - print $separator; - // CODV print '0'.$separator; - // TXDV + // CODV print $separator; + // TXDV + print '0'.$separator; // MOPM print $separator; // BONP diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 0178f87a32d..58e6bd600f6 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -136,9 +136,9 @@ class AccountingAccount extends CommonObject public $active; /** - * @var int reconciliable + * @var int reconcilable */ - public $reconciliable; + public $reconcilable; /** * Constructor @@ -167,7 +167,7 @@ class AccountingAccount extends CommonObject global $conf; if ($rowid || $account_number) { - $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconciliable"; + $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconcilable"; $sql .= ", ca.label as category_label"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid"; @@ -208,7 +208,7 @@ class AccountingAccount extends CommonObject $this->fk_user_modif = $obj->fk_user_modif; $this->active = $obj->active; $this->status = $obj->active; - $this->reconciliable = $obj->reconciliable; + $this->reconcilable = $obj->reconcilable; return $this->id; } else { @@ -267,7 +267,7 @@ class AccountingAccount extends CommonObject $sql .= ", fk_accounting_category"; $sql .= ", fk_user_author"; $sql .= ", active"; - $sql .= ", reconciliable"; + $sql .= ", reconcilable"; $sql .= ") VALUES ("; $sql .= " '" . $this->db->idate($now) . "'"; $sql .= ", " . $conf->entity; @@ -280,7 +280,7 @@ class AccountingAccount extends CommonObject $sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category); $sql .= ", " . $user->id; $sql .= ", " . (int) $this->active; - $sql .= ", " . (int) $this->reconciliable; + $sql .= ", " . (int) $this->reconcilable; $sql .= ")"; $this->db->begin(); @@ -348,7 +348,7 @@ class AccountingAccount extends CommonObject $sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category); $sql .= " , fk_user_modif = " . $user->id; $sql .= " , active = " . (int) $this->active; - $sql .= " , reconciliable = " . (int) $this->reconciliable; + $sql .= " , reconcilable = " . (int) $this->reconcilable; $sql .= " WHERE rowid = " . $this->id; dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); @@ -588,7 +588,7 @@ class AccountingAccount extends CommonObject } elseif ($mode == 1) { - $fieldtouse = 'reconciliable'; + $fieldtouse = 'reconcilable'; } if ($result > 0) { @@ -619,7 +619,7 @@ class AccountingAccount extends CommonObject * Account activated * * @param int $id Id - * @param int $mode 0=field active, 1=field reconciliable, 2=field active_customer_list, 3=field_active_supplier_list + * @param int $mode 0=field active, 1=field reconcilable * @return int <0 if KO, >0 if OK */ public function account_activate($id, $mode = 0) @@ -633,7 +633,7 @@ class AccountingAccount extends CommonObject } elseif ($mode == 1) { - $fieldtouse = 'reconciliable'; + $fieldtouse = 'reconcilable'; } $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 2012efe0eb9..97d62ebb5dc 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -230,7 +230,7 @@ class Lettering extends BookKeeping * * @param array $ids ids array * @param boolean $notrigger no trigger - * @return number + * @return number */ public function updateLettering($ids = array(), $notrigger = false) { diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 9e4f73d8f7a..ec872726012 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -566,8 +566,8 @@ if ($result) { print ''.$objp->tva_intra.''; - // Current account - print ''; + // Found accounts + print ''; $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index b6c220c347a..302c4410111 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -225,9 +225,9 @@ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; // Add search filter like @@ -411,6 +411,10 @@ if ($result) { $facturefourn_static = new FactureFournisseur($db); $product_static = new Product($db); + $isBuyerInEEC = isInEEC($mysoc); + + $accountingaccount_codetotid_cache = array(); + while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); @@ -440,7 +444,7 @@ if ($result) { $code_buy_p_notset = ''; $objp->aarowid_suggest = ''; // Will be set later - $isBuyerInEEC = isInEEC($objp); + $isSellerInEEC = isInEEC($objp); $suggestedaccountingaccountbydefaultfor = ''; if ($objp->type_l == 1) { @@ -548,7 +552,7 @@ if ($result) { // VAT Num print ''.$objp->tva_intra.''; - // Current account + // Found accounts print ''; $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index 3e091acdfda..cd73320d02d 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -100,7 +100,7 @@ if ($action == 'create') print "
"; print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -113,7 +113,7 @@ if ($action == 'edit' && ! empty($attrname)) print "
"; print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index e7686a0a055..6736a22cd5d 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -259,7 +259,7 @@ print '
'; print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -279,7 +279,7 @@ print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print ''; -print ''; +print ''; print ''; print ''; print $langs->trans("DescADHERENT_CARD_TYPE").' '; @@ -299,7 +299,7 @@ print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' '; print ''; -print ''; +print ''; print ''; print ''; print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' '; diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index f02c012a48e..10eca32ac13 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -145,6 +145,8 @@ print '
'; // Show filter box /*print ''; +print ''; + print ''; print ''; print ''; print ''; if ($user->rights->adherent->configurer) - print ''; + print ''; else print ''; print ""; @@ -607,7 +607,7 @@ if ($rowid > 0) } print ''; - print ''; + print ''; print ''; print '
'; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 5338010772f..4960f044065 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -324,7 +324,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } print ''; -print ''; +print ''; print ''; print '
'.$langs->trans("Filter").'
'.$langs->trans("Member").''; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 68989ee3ef9..969117c4bdc 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -297,7 +297,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') print ''.yn($objp->vote).''.$membertype->getLibStatut(5).'rowid.'">'.img_edit().'rowid.'">'.img_edit().' 
'."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 614d4ef4407..b641dd74fe2 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -180,7 +180,7 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action'); print ''; -print ''; +print ''; print ''; print '
'."\n"; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index b63cecf340b..f5f0f6eb752 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -76,18 +76,18 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') { $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT', 'none'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_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'); - } + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } } /* @@ -258,13 +258,13 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $lang $variablename='BANK_CHEQUERECEIPT_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { - print ''; + print ''; } else { - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); + print $doleditor->Create(); } print ''; print ''; print ''; print ''; print ''; if ($newkey == 'separator') @@ -233,17 +233,17 @@ if ($resql) $i = 0; while ($i < $num) - { - $obj = $db->fetch_object($resql); + { + $obj = $db->fetch_object($resql); - print ''; - print ''."\n"; - print ''."\n"; - if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled - print "\n"; + print ''; + print ''."\n"; + print ''."\n"; + if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled + print "\n"; - $i++; - } + $i++; + } } print '
'; print ''; diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 03c4eeb66cf..3fb3340a702 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -119,7 +119,7 @@ if (! empty($conf->global->CLICKTODIAL_URL)) if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest'); print ''; - print ''; + print ''; print $langs->trans("LinkToTestClickToDial", $user->login).' : '; print ''; print ''; diff --git a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php index 900d66c73b5..b7e874beec2 100644 --- a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php +++ b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php @@ -89,9 +89,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -103,10 +103,10 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; - print load_fiche_titre($langs->trans('NewAttribute')); + print "
"; + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -116,10 +116,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index 29940f95d56..b3265479d38 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -45,8 +45,8 @@ $action=GETPOST('action', 'alpha'); // Shipment note if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { - // This option should always be set to on when module is on. - dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); + // This option should always be set to on when module is on. + dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); } /* if ($action == 'activate_sending') @@ -66,16 +66,16 @@ if ($action == 'disable_sending') // Delivery note if ($action == 'activate_delivery') { - dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this - dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this + dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity); header("Location: confexped.php"); exit; } elseif ($action == 'disable_delivery') { dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON", $conf->entity); - header("Location: confexped.php"); - exit; + header("Location: confexped.php"); + exit; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 0dfa050f067..75fae3c7a86 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -437,15 +437,15 @@ $tabcond[8] = !empty($conf->societe->enabled); $tabcond[9] = true; $tabcond[10] = true; $tabcond[11] = (!empty($conf->societe->enabled)); -$tabcond[12] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled)); -$tabcond[13] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled)); +$tabcond[12] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled)); +$tabcond[13] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled)); $tabcond[14] = (!empty($conf->product->enabled) && (!empty($conf->ecotax->enabled) || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY))); $tabcond[15] = true; $tabcond[16] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)); $tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled)); $tabcond[18] = !empty($conf->expedition->enabled) || !empty($conf->reception->enabled); $tabcond[19] = !empty($conf->societe->enabled); -$tabcond[20] = !empty($conf->fournisseur->enabled); +$tabcond[20]= (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled)); $tabcond[21] = !empty($conf->propal->enabled); $tabcond[22] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled)); $tabcond[23] = true; diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php index ecba02c712c..8d1122417b5 100644 --- a/htdocs/admin/dolistore/ajax/image.php +++ b/htdocs/admin/dolistore/ajax/image.php @@ -40,19 +40,19 @@ $id_image = GETPOST('id_image', 'int'); $quality = GETPOST('quality', 'alpha'); try { - $url = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/images/products/'.$id_product.'/'.$id_image.'/'.$quality; - $api = new PrestaShopWebservice( - $conf->global->MAIN_MODULE_DOLISTORE_API_SRV, - $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $dolistore->debug_api - ); - //echo $url; - $request = $api->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); - header('Content-type:image'); - print $request['response']; + $url = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/images/products/'.$id_product.'/'.$id_image.'/'.$quality; + $api = new PrestaShopWebservice( + $conf->global->MAIN_MODULE_DOLISTORE_API_SRV, + $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $dolistore->debug_api + ); + //echo $url; + $request = $api->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); + header('Content-type:image'); + print $request['response']; } catch (PrestaShopWebserviceException $e) { - // Here we are dealing with errors - $trace = $e->getTrace(); - if ($trace[0]['args'][0] == 404) die('Bad ID'); - elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); - else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); + // Here we are dealing with errors + $trace = $e->getTrace(); + if ($trace[0]['args'][0] == 404) die('Bad ID'); + elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); + else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); } diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 2fcf3fe6422..66fa695c5b9 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -36,30 +36,30 @@ if (! $user->admin) accessforbidden(); */ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { - $code=$reg[1]; - if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } + $code=$reg[1]; + if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { - $code=$reg[1]; - if (dolibarr_del_const($db, $code, $conf->entity) > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } + $code=$reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 392e1a9e147..d4415c6c1b6 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -483,7 +483,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Filters - print ''; + print '
'; print ''; print ''; print ''; @@ -562,7 +562,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '

'; // Operations - print '
'.$langs->trans("Filters").'
'; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/admin/expedition_extrafields.php b/htdocs/admin/expedition_extrafields.php index a34bd841c81..69ad145e7df 100644 --- a/htdocs/admin/expedition_extrafields.php +++ b/htdocs/admin/expedition_extrafields.php @@ -86,9 +86,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -101,9 +101,9 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { print '
'; - print load_fiche_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -113,10 +113,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/admin/expensereport_extrafields.php b/htdocs/admin/expensereport_extrafields.php index 276a50bc440..61dcf3dcf66 100644 --- a/htdocs/admin/expensereport_extrafields.php +++ b/htdocs/admin/expensereport_extrafields.php @@ -80,9 +80,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -95,9 +95,9 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { print '
'; - print load_fiche_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -107,10 +107,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index 107954fa4cd..ef6a7c3108f 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -23,9 +23,9 @@ */ /** - * \file htdocs/admin/expedition.php - * \ingroup expedition - * \brief Page d'administration/configuration du module Expedition + * \file htdocs/admin/export.php + * \ingroup export + * \brief config Page module Export */ require '../main.inc.php'; @@ -38,13 +38,15 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); -$value = GETPOST('value', 'alpha'); + /* * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +if ($action == 'save') { + dolibarr_set_const($db, 'EXPORT_CSV_SEPARATOR_TO_USE', GETPOST('EXPORT_CSV_SEPARATOR_TO_USE', 'alphanohtml')); +} /* @@ -69,32 +71,38 @@ $head[$h][1] = $langs->trans("Setup"); $head[$h][2] = 'setup'; $h++; -dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "exports"); +dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "technic"); +print ''; +print ''; +print ''; print '
'.$langs->trans("EmailcollectorOperations").'
'; + print ''; print ''."\n"; print ''; print ''."\n"; - +print ''; // Example with a yes / no select print ''; print ''; print ''; print ''; +print ''; +print ''; +print '"; +print ''; +print ''; + print '
'.$langs->trans("Parameters").' 
'.$langs->trans("EXPORTS_SHARE_MODELS").' '; - -print ''; -print ''; -print ''; echo ajax_constantonoff('EXPORTS_SHARE_MODELS'); -print ''; - print '
'.$langs->trans("ExportCsvSeparator").''."global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE)."\">
'; +print ''; + dol_fiche_end(); // End of page diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 6f2ad22015d..ad077361fe8 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -57,7 +57,7 @@ $modules = array( $conditions = array( 'SOCIETE' => 1, 'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)), -'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled)), +'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)), 'USERSIGN' => 1, 'MAILING' => ! empty($conf->mailing->enabled), 'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)), @@ -185,7 +185,7 @@ else print '
'."\n"; print '
'."\n"; - print ''; + print ''; // Skins show_skin(null, 1); diff --git a/htdocs/admin/import.php b/htdocs/admin/import.php new file mode 100644 index 00000000000..37c9b205424 --- /dev/null +++ b/htdocs/admin/import.php @@ -0,0 +1,100 @@ + + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2020 Floriazn Henry + * + * 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 . + */ + +/** + * \file htdocs/admin/import.php + * \ingroup import + * \brief config page module import + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'exports', 'other')); + +if (!$user->admin) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); +$value = GETPOST('value', 'alpha'); + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + + +/* + * View + */ + +$form = new Form($db); + +$page_name = "ImportSetup"; +llxHeader('', $langs->trans($page_name)); + +// Subheader +$linkback = ''.$langs->trans("BackToModuleList").''; + +print load_fiche_titre($langs->trans($page_name), $linkback); + +//$head = export_admin_prepare_head(); +$h = 0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT.'/admin/import.php'; +$head[$h][1] = $langs->trans("Setup"); +$head[$h][2] = 'setup'; +$h++; + +dol_fiche_head($head, 'setup', $langs->trans("ImportArea"), -1, "technic"); + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''."\n"; +print ''; +print ''."\n"; + +print ''; +print ''; +print '"; +print ''; +print ''; + +print '
'.$langs->trans("Parameters").' 
'.$langs->trans("ImportCsvSeparator").' ('.$langs->trans("ByDefault").')'."global->IMPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE)."\">
'; + +print ''; + +dol_fiche_end(); + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index cf4b5f9e9bc..c3ce7724752 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -91,14 +91,6 @@ print '
'; // Show info setup module print img_picto('', 'puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules")); - -/* -$nbofactivatedmodules=count($conf->modules); -$moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1), count($modules)); -if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule")); -print '
'.$moreinfo; -*/ - if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled { $langs->load("errors"); diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 4a6a21197a8..d2984cab6bf 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -68,22 +68,22 @@ if ($action == 'setvalue' && $user->admin) if (! dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_TOWN', GETPOST("fieldtown"), 'chaine', 0, '', $conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_COUNTRY', GETPOST("fieldcountry"), 'chaine', 0, '', $conf->entity)) $error++; - // This one must be after the others - $valkey=''; - $key=GETPOST("key"); - if ($key) $valkey=$conf->global->$key; - if (! dolibarr_set_const($db, 'LDAP_KEY_CONTACTS', $valkey, 'chaine', 0, '', $conf->entity)) $error++; + // This one must be after the others + $valkey=''; + $key=GETPOST("key"); + if ($key) $valkey=$conf->global->$key; + if (! dolibarr_set_const($db, 'LDAP_KEY_CONTACTS', $valkey, 'chaine', 0, '', $conf->entity)) $error++; - if (! $error) - { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - $db->rollback(); - dol_print_error($db); - } + if (! $error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + dol_print_error($db); + } } diff --git a/htdocs/admin/livraison_extrafields.php b/htdocs/admin/livraison_extrafields.php index b78e6f1730e..814a865216d 100644 --- a/htdocs/admin/livraison_extrafields.php +++ b/htdocs/admin/livraison_extrafields.php @@ -86,9 +86,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -101,9 +101,9 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { print '
'; - print load_fiche_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -113,10 +113,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 4a37c761628..7598d2d8588 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -48,7 +48,7 @@ if ($action == 'setvalue') $mailerror = GETPOST('MAILING_EMAIL_ERRORSTO', 'alpha'); $checkread = GETPOST('value', 'alpha'); $checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY', 'alpha'); - $mailingdelay = GETPOST('MAILING_DELAY', 'int'); + $mailingdelay = GETPOST('MAILING_DELAY', 'int'); $res=dolibarr_set_const($db, "MAILING_EMAIL_FROM", $mailfrom, 'chaine', 0, '', $conf->entity); if (! $res > 0) $error++; @@ -61,16 +61,16 @@ if ($action == 'setvalue') $res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY", $checkread_key, 'chaine', 0, '', $conf->entity); if (! $res > 0) $error++; - if (! $error) - { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (! $error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } } diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 1102f68ba5f..f2d27cf2849 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -162,8 +162,8 @@ if ($conf->expedition->enabled) $elementList['shipping_send'] = $langs->t if ($conf->reception->enabled) $elementList['reception_send'] = $langs->trans('MailToSendReception'); if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = $langs->trans('MailToSendIntervention'); if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = $langs->trans('MailToSendSupplierRequestForQuotation'); -if ($conf->fournisseur->enabled) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder'); -if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice'); +if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder'); +if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_invoice->enabled) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice'); if ($conf->societe->enabled) $elementList['thirdparty'] = $langs->trans('MailToThirdparty'); if ($conf->adherent->enabled) $elementList['member'] = $langs->trans('MailToMember'); if ($conf->contrat->enabled) $elementList['contract'] = $langs->trans('MailToSendContract'); diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index 32cd7c35829..ce0136642e2 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -41,8 +41,8 @@ $dirsmartphone = array(); $dirmenus=array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']); foreach($dirmenus as $dirmenu) { - $dirstandard[]=$dirmenu.'standard'; - $dirsmartphone[]=$dirmenu.'smartphone'; + $dirstandard[]=$dirmenu.'standard'; + $dirsmartphone[]=$dirmenu.'smartphone'; } $error=0; @@ -85,8 +85,8 @@ if ($action == 'update' && ! $cancel) foreach($dirmenus as $dirmenu) { $file='init_menu_'.$key.'.sql'; - $fullpath=dol_buildpath($dirmenu.$file); - //print 'action='.$action.' Search menu into fullpath='.$fullpath.'
';exit; + $fullpath=dol_buildpath($dirmenu.$file); + //print 'action='.$action.' Search menu into fullpath='.$fullpath.'
';exit; if (file_exists($fullpath)) { diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 21d54908cf1..72eb8240c10 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -930,7 +930,7 @@ if ($mode == 'marketplace') ?>
- +
trans('Keyword') ?>:
diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index b3e6ec312ae..12231079ae0 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -46,15 +46,15 @@ $type = 'paymentorder'; if ($action == "set") { - $db->begin(); + $db->begin(); - $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT', 'int'); - $account = new Account($db); - if($account->fetch($id)>0) - { - $res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; - /* + $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT', 'int'); + $account = new Account($db); + if($account->fetch($id)>0) + { + $res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity); + if (! $res > 0) $error++; + /* $res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity); @@ -70,33 +70,33 @@ if ($action == "set") $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; */ - } - else $error++; + } + else $error++; - $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; + $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity); + if (! $res > 0) $error++; - if (GETPOST("PRELEVEMENT_USER") > 0) - { - $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; - } - if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END")=="") - { - $res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; - } - if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD")=="") - { - $res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; - } + if (GETPOST("PRELEVEMENT_USER") > 0) + { + $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity); + if (! $res > 0) $error++; + } + if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END")=="") + { + $res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity); + if (! $res > 0) $error++; + } + if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD")=="") + { + $res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity); + if (! $res > 0) $error++; + } - if (GETPOST("PRELEVEMENT_ADDDAYS") || GETPOST("PRELEVEMENT_ADDDAYS")=="") - { - $res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity); - if (! $res > 0) $error++; - } elseif (! $error) + if (GETPOST("PRELEVEMENT_ADDDAYS") || GETPOST("PRELEVEMENT_ADDDAYS")=="") + { + $res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity); + if (! $res > 0) $error++; + } elseif (! $error) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -110,20 +110,20 @@ if ($action == "set") if ($action == "addnotif") { - $bon = new BonPrelevement($db); - $bon->AddNotification($db, GETPOST('user', 'int'), $action); + $bon = new BonPrelevement($db); + $bon->AddNotification($db, GETPOST('user', 'int'), $action); - header("Location: prelevement.php"); - exit; + header("Location: prelevement.php"); + exit; } if ($action == "deletenotif") { - $bon = new BonPrelevement($db); - $bon->DeleteNotificationById(GETPOST('notif', 'int')); + $bon = new BonPrelevement($db); + $bon->DeleteNotificationById(GETPOST('notif', 'int')); - header("Location: prelevement.php"); - exit; + header("Location: prelevement.php"); + exit; } /* diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index c00bef75697..9011c6b4e67 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -40,34 +40,34 @@ $upload_dir=$conf->admin->dir_temp; if (GETPOST('action', 'aZ09') == 'set_proxy') { - if (GETPOST("MAIN_USE_CONNECT_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_CONNECT_TIMEOUT"))) - { - setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors'); - $error++; - } - if (GETPOST("MAIN_USE_RESPONSE_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_RESPONSE_TIMEOUT"))) - { - setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors'); - $error++; - } + if (GETPOST("MAIN_USE_CONNECT_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_CONNECT_TIMEOUT"))) + { + setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors'); + $error++; + } + if (GETPOST("MAIN_USE_RESPONSE_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_RESPONSE_TIMEOUT"))) + { + setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors'); + $error++; + } - if (! $error) - { - $result=0; - $result+=dolibarr_set_const($db, 'MAIN_USE_CONNECT_TIMEOUT', GETPOST("MAIN_USE_CONNECT_TIMEOUT"), 'chaine', 0, '', $conf->entity); - $result+=dolibarr_set_const($db, 'MAIN_USE_RESPONSE_TIMEOUT', GETPOST("MAIN_USE_RESPONSE_TIMEOUT"), 'chaine', 0, '', $conf->entity); - $result+=dolibarr_set_const($db, 'MAIN_PROXY_USE', GETPOST("MAIN_PROXY_USE"), 'chaine', 0, '', $conf->entity); - $result+=dolibarr_set_const($db, 'MAIN_PROXY_HOST', GETPOST("MAIN_PROXY_HOST"), 'chaine', 0, '', $conf->entity); - $result+=dolibarr_set_const($db, 'MAIN_PROXY_PORT', GETPOST("MAIN_PROXY_PORT"), 'chaine', 0, '', $conf->entity); - $result+=dolibarr_set_const($db, 'MAIN_PROXY_USER', GETPOST("MAIN_PROXY_USER"), 'chaine', 0, '', $conf->entity); - $result+=dolibarr_set_const($db, 'MAIN_PROXY_PASS', GETPOST("MAIN_PROXY_PASS"), 'chaine', 0, '', $conf->entity); - if ($result < 5) dol_print_error($db); - } + if (! $error) + { + $result=0; + $result+=dolibarr_set_const($db, 'MAIN_USE_CONNECT_TIMEOUT', GETPOST("MAIN_USE_CONNECT_TIMEOUT"), 'chaine', 0, '', $conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_USE_RESPONSE_TIMEOUT', GETPOST("MAIN_USE_RESPONSE_TIMEOUT"), 'chaine', 0, '', $conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_PROXY_USE', GETPOST("MAIN_PROXY_USE"), 'chaine', 0, '', $conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_PROXY_HOST', GETPOST("MAIN_PROXY_HOST"), 'chaine', 0, '', $conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_PROXY_PORT', GETPOST("MAIN_PROXY_PORT"), 'chaine', 0, '', $conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_PROXY_USER', GETPOST("MAIN_PROXY_USER"), 'chaine', 0, '', $conf->entity); + $result+=dolibarr_set_const($db, 'MAIN_PROXY_PASS', GETPOST("MAIN_PROXY_PASS"), 'chaine', 0, '', $conf->entity); + if ($result < 5) dol_print_error($db); + } - if (! $error) - { - setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); - } + if (! $error) + { + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + } } @@ -99,8 +99,8 @@ dol_fiche_head($head, 'proxy', $langs->trans("Security"), -1); if ($conf->use_javascript_ajax) { - print "\n".''."\n"; + print ''."\n"; } diff --git a/htdocs/admin/reception_extrafields.php b/htdocs/admin/reception_extrafields.php index 454fe1c4a8f..95338903ade 100644 --- a/htdocs/admin/reception_extrafields.php +++ b/htdocs/admin/reception_extrafields.php @@ -89,9 +89,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -103,10 +103,10 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; - print load_fiche_titre($langs->trans('NewAttribute')); + print "
"; + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -116,10 +116,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php index 462326316b2..b64c01c5f00 100644 --- a/htdocs/admin/resource.php +++ b/htdocs/admin/resource.php @@ -35,7 +35,7 @@ $langs->loadLangs(array("admin","resource")); // Security check if (!$user->admin) - accessforbidden(); + accessforbidden(); $action = GETPOST('action', 'alpha'); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index f1cbea504d3..0b6987b1a9f 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -213,7 +213,7 @@ $found=0; print '
'.$langs->trans("ReStockOnBill").''; -if (! empty($conf->fournisseur->enabled)) +if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); @@ -234,7 +234,7 @@ $found++; print '
'.$langs->trans("ReStockOnValidateOrder").''; -if (! empty($conf->fournisseur->enabled)) +if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); diff --git a/htdocs/admin/supplierinvoicedet_extrafields.php b/htdocs/admin/supplierinvoicedet_extrafields.php index bcb3b5769ee..39a757bbf9c 100644 --- a/htdocs/admin/supplierinvoicedet_extrafields.php +++ b/htdocs/admin/supplierinvoicedet_extrafields.php @@ -86,9 +86,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -101,9 +101,9 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { print '
'; - print load_fiche_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -113,10 +113,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 78c31291414..8924741df52 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -84,9 +84,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -99,9 +99,9 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { print '
'; - print load_fiche_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -111,10 +111,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index 64f8fba72ad..3cfc18accc9 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -86,31 +86,31 @@ print ''; if (preg_match('/^fr_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("France")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("France")).''; print '
  • '; } if (preg_match('/^el_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Greece")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Greece")).''; print '
  • '; } if (preg_match('/^es_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Spain")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Spain")).''; print '
  • '; } if (preg_match('/^it_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Italy")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Italy")).''; print '
  • '; } if (preg_match('/^de_/i', $langs->getDefaultLang())) { print '
  • '; - print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).''; + print ''.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).''; print '
  • '; } print '
  • '; diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 194c871958d..0835138227b 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -70,27 +70,27 @@ $configfileparameters=array( '?dolibarr_main_auth_ldap_admin_login', '?dolibarr_main_auth_ldap_admin_pass', '?dolibarr_main_auth_ldap_debug', - 'separator', - '?dolibarr_lib_ADODB_PATH', + 'separator', + '?dolibarr_lib_ADODB_PATH', '?dolibarr_lib_FPDF_PATH', - '?dolibarr_lib_TCPDF_PATH', + '?dolibarr_lib_TCPDF_PATH', '?dolibarr_lib_FPDI_PATH', - '?dolibarr_lib_TCPDI_PATH', + '?dolibarr_lib_TCPDI_PATH', '?dolibarr_lib_NUSOAP_PATH', - '?dolibarr_lib_PHPEXCEL_PATH', - '?dolibarr_lib_GEOIP_PATH', + '?dolibarr_lib_PHPEXCEL_PATH', + '?dolibarr_lib_GEOIP_PATH', '?dolibarr_lib_ODTPHP_PATH', - '?dolibarr_lib_ODTPHP_PATHTOPCLZIP', - '?dolibarr_js_CKEDITOR', - '?dolibarr_js_JQUERY', - '?dolibarr_js_JQUERY_UI', - '?dolibarr_js_JQUERY_FLOT', + '?dolibarr_lib_ODTPHP_PATHTOPCLZIP', + '?dolibarr_js_CKEDITOR', + '?dolibarr_js_JQUERY', + '?dolibarr_js_JQUERY_UI', + '?dolibarr_js_JQUERY_FLOT', '?dolibarr_font_DOL_DEFAULT_TTF', - '?dolibarr_font_DOL_DEFAULT_TTF_BOLD', + '?dolibarr_font_DOL_DEFAULT_TTF_BOLD', 'separator', '?dolibarr_mailing_limit_sendbyweb', '?dolibarr_mailing_limit_sendbycli', - '?dolibarr_strict_mode' + '?dolibarr_strict_mode' ); $configfilelib=array( // 'separator', @@ -121,20 +121,20 @@ $configfilelib=array( 'dolibarr_main_auth_ldap_admin_pass', 'dolibarr_main_auth_ldap_debug', 'separator', - 'dolibarr_lib_ADODB_PATH', - 'dolibarr_lib_TCPDF_PATH', - 'dolibarr_lib_FPDI_PATH', + 'dolibarr_lib_ADODB_PATH', + 'dolibarr_lib_TCPDF_PATH', + 'dolibarr_lib_FPDI_PATH', 'dolibarr_lib_NUSOAP_PATH', - 'dolibarr_lib_PHPEXCEL_PATH', - 'dolibarr_lib_GEOIP_PATH', + 'dolibarr_lib_PHPEXCEL_PATH', + 'dolibarr_lib_GEOIP_PATH', 'dolibarr_lib_ODTPHP_PATH', - 'dolibarr_lib_ODTPHP_PATHTOPCLZIP', - 'dolibarr_js_CKEDITOR', - 'dolibarr_js_JQUERY', - 'dolibarr_js_JQUERY_UI', - 'dolibarr_js_JQUERY_FLOT', + 'dolibarr_lib_ODTPHP_PATHTOPCLZIP', + 'dolibarr_js_CKEDITOR', + 'dolibarr_js_JQUERY', + 'dolibarr_js_JQUERY_UI', + 'dolibarr_js_JQUERY_FLOT', 'dolibarr_font_DOL_DEFAULT_TTF', - 'dolibarr_font_DOL_DEFAULT_TTF_BOLD', + 'dolibarr_font_DOL_DEFAULT_TTF_BOLD', 'separator', 'Limit nb of email sent by page', 'Strict mode is on/off' @@ -155,19 +155,19 @@ foreach($configfileparameters as $key) if (empty($ignore)) { - $newkey = preg_replace('/^\?/', '', $key); + $newkey = preg_replace('/^\?/', '', $key); - if (preg_match('/^\?/', $key) && empty(${$newkey})) - { - $i++; - continue; // We discard parametes starting with ? - } + if (preg_match('/^\?/', $key) && empty(${$newkey})) + { + $i++; + continue; // We discard parametes starting with ? + } - if ($newkey == 'separator' && $lastkeyshown == 'separator') - { - $i++; - continue; - } + if ($newkey == 'separator' && $lastkeyshown == 'separator') + { + $i++; + continue; + } print '
  • '.$obj->name.''.$obj->value.''.$obj->entity.'
    '.$obj->name.''.$obj->value.''.$obj->entity.'
    '; diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 7a53b95fcf2..dce23de6270 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -54,17 +54,17 @@ $i=0; foreach($modulesdir as $dir) { $handle=@opendir(dol_osencode($dir)); - if (is_resource($handle)) - { - while (($file = readdir($handle))!==false) - { - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') - { - $modName = substr($file, 0, dol_strlen($file) - 10); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') + { + $modName = substr($file, 0, dol_strlen($file) - 10); - if ($modName) - { - //print 'xx'.$dir.$file.'
    '; + if ($modName) + { + //print 'xx'.$dir.$file.'
    '; if (in_array($file, $modules_files)) { // File duplicate @@ -77,13 +77,13 @@ foreach($modulesdir as $dir) if (class_exists($modName)) { try { - $objMod = new $modName($db); + $objMod = new $modName($db); - $modules[$objMod->numero]=$objMod; - $modules_names[$objMod->numero]=$objMod->name; - $modules_files[$objMod->numero]=$file; - $modules_fullpath[$file]=$dir.$file; - $picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic'; + $modules[$objMod->numero]=$objMod; + $modules_names[$objMod->numero]=$objMod->name; + $modules_files[$objMod->numero]=$file; + $modules_fullpath[$file]=$dir.$file; + $picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic'; } catch(Exception $e) { @@ -95,11 +95,11 @@ foreach($modulesdir as $dir) print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
    "; } } - } - } - } - closedir($handle); - } + } + } + } + closedir($handle); + } } print '
    '; @@ -120,15 +120,15 @@ foreach($sortorder as $numero=>$name) // Module print ''; $alt=$name.' - '.$modules_files[$numero]; - if (! empty($picto[$numero])) - { - if (preg_match('/^\//', $picto[$numero])) print img_picto($alt, $picto[$numero], 'width="14px"', 1); - else print img_object($alt, $picto[$numero], 'width="14px"'); - } - else - { - print img_object($alt, $picto[$numero], 'width="14px"'); - } + if (! empty($picto[$numero])) + { + if (preg_match('/^\//', $picto[$numero])) print img_picto($alt, $picto[$numero], 'width="14px"', 1); + else print img_object($alt, $picto[$numero], 'width="14px"'); + } + else + { + print img_object($alt, $picto[$numero], 'width="14px"'); + } print ' '.$modules[$numero]->getName(); print ""; // Version diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 3dae3c91f9d..42c66281450 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -53,10 +53,10 @@ print $langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index // Recupere la version de PHP $phpversion=version_php(); -print "
    PHP - ".$langs->trans("Version").": ".$phpversion."
    \n"; +print "
    PHP - ".$langs->trans("Version").": ".$phpversion."
    \n"; // Recupere la version du serveur web -print "
    Web server - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."
    \n"; +print "
    Web server - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."
    \n"; // XDebug print '
    '; @@ -65,8 +65,8 @@ $test=!function_exists('xdebug_is_enabled'); if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); else { - print img_picto('', 'warning').' '.$langs->trans("XDebugInstalled"); - print ' '.$langs->trans("MoreInformation").' XDebug admin page'; + print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug")); + print ' - '.$langs->trans("MoreInformation").' XDebug admin page'; } print '
    '; diff --git a/htdocs/admin/system/xdebug.php b/htdocs/admin/system/xdebug.php index 56b452706f5..9ea68431b1a 100644 --- a/htdocs/admin/system/xdebug.php +++ b/htdocs/admin/system/xdebug.php @@ -41,54 +41,54 @@ print "
    \n"; if (!function_exists('xdebug_is_enabled')) { - print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.'; - llxFooter(); - exit; + print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.'; + llxFooter(); + exit; } if (function_exists('socket_create')) { - $address = ini_get('xdebug.remote_host')?ini_get('xdebug.remote_host'):'127.0.0.1'; - $port = ini_get('xdebug.remote_port')?ini_get('xdebug.remote_port'):9000; + $address = ini_get('xdebug.remote_host')?ini_get('xdebug.remote_host'):'127.0.0.1'; + $port = ini_get('xdebug.remote_port')?ini_get('xdebug.remote_port'):9000; - print "Current xdebug setup:
    \n"; - print "* Remote debug setup:
    \n"; - print 'xdebug.remote_enable = '.ini_get('xdebug.remote_enable')."
    \n"; - print 'xdebug.remote_host = '.$address."
    \n"; - print 'xdebug.remote_port = '.$port."
    \n"; - print "* Profiler setup "; - if (function_exists('xdebug_get_profiler_filename')) print xdebug_get_profiler_filename()?"(currently on into file ".xdebug_get_profiler_filename().")":"(currently off)"; - else print "(currenlty not available)"; - print ":
    \n"; - print 'xdebug.profiler_enable = '.ini_get('xdebug.profiler_enable')."
    \n"; - print 'xdebug.profiler_enable_trigger = '.ini_get('xdebug.profiler_enable_trigger')."
    \n"; - print 'xdebug.profiler_output_dir = '.ini_get('xdebug.profiler_output_dir')."
    \n"; - print 'xdebug.profiler_output_name = '.ini_get('xdebug.profiler_output_name')."
    \n"; - print 'xdebug.profiler_append = '.ini_get('xdebug.profiler_append')."
    \n"; - print "
    \n"; + print "Current xdebug setup:
    \n"; + print "* Remote debug setup:
    \n"; + print 'xdebug.remote_enable = '.ini_get('xdebug.remote_enable')."
    \n"; + print 'xdebug.remote_host = '.$address."
    \n"; + print 'xdebug.remote_port = '.$port."
    \n"; + print "* Profiler setup "; + if (function_exists('xdebug_get_profiler_filename')) print xdebug_get_profiler_filename()?"(currently on into file ".xdebug_get_profiler_filename().")":"(currently off)"; + else print "(currenlty not available)"; + print ":
    \n"; + print 'xdebug.profiler_enable = '.ini_get('xdebug.profiler_enable')."
    \n"; + print 'xdebug.profiler_enable_trigger = '.ini_get('xdebug.profiler_enable_trigger')."
    \n"; + print 'xdebug.profiler_output_dir = '.ini_get('xdebug.profiler_output_dir')."
    \n"; + print 'xdebug.profiler_output_name = '.ini_get('xdebug.profiler_output_name')."
    \n"; + print 'xdebug.profiler_append = '.ini_get('xdebug.profiler_append')."
    \n"; + print "
    \n"; - echo "To run a debug session, add parameter
    "; - echo "* XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.
    \n"; - echo "To run a profiler session (when xdebug.profiler_enable_trigger=1), add parameter
    \n"; - echo "* XDEBUG_PROFILE=aname on each URL.
    "; - print "
    "; + echo "To run a debug session, add parameter
    "; + echo "* XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.
    \n"; + echo "To run a profiler session (when xdebug.profiler_enable_trigger=1), add parameter
    \n"; + echo "* XDEBUG_PROFILE=aname on each URL.
    "; + print "
    "; - print "Test debugger server (Eclipse for example):
    \n"; - $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - if (empty($socket)) die('Unable to prepare a socket'); - //socket_bind($sock, $address, $port) or die('Unable to bind on address='.$address.' port='.$port); - //socket_listen($sock); - //$client = socket_accept($sock); - $client=socket_connect($socket, $address, $port); - if ($client) - { - echo "Connection established: ".$client." - address=".$address." port=".$port."
    \n"; - echo "There is a Remote debug server at this address.
    \n"; - echo "
    \n"; - echo "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n"; - echo "your php.ini file with this :
    \n"; - echo '\n"; - print "

    \n"; - echo 'Then check in your debug server (Eclipse), you have setup:
    + print "

    \n"; + echo 'Then check in your debug server (Eclipse), you have setup:
    XDebug with same port than in php.ini
    Allow Remote debug=yes or prompt
    '."\n"; - print "
    \n"; - } - else - { - print socket_strerror(socket_last_error()); - echo "Failed to connect to address=".$address." port=".$port."
    \n"; - echo "There is no Remote debug server at this address.\n"; - } - socket_close($socket); + print "
    \n"; + } + else + { + print socket_strerror(socket_last_error()); + echo "Failed to connect to address=".$address." port=".$port."
    \n"; + echo "There is no Remote debug server at this address.\n"; + } + socket_close($socket); } else { - print "Can't test if PHPDebug is OK as PHP socket functions are not enabled."; + print "Can't test if PHPDebug is OK as PHP socket functions are not enabled."; } diff --git a/htdocs/admin/ticket_extrafields.php b/htdocs/admin/ticket_extrafields.php index 18d5eee40a6..d7be1d058e6 100644 --- a/htdocs/admin/ticket_extrafields.php +++ b/htdocs/admin/ticket_extrafields.php @@ -36,7 +36,7 @@ $form = new Form($db); $tmptype2label = ExtraFields::$type2label; $type2label = array(''); foreach ($tmptype2label as $key => $val) { - $type2label[$key] = $langs->trans($val); + $type2label[$key] = $langs->trans($val); } $action = GETPOST('action', 'alpha'); @@ -44,7 +44,7 @@ $attrname = GETPOST('attrname', 'alpha'); $elementtype = 'ticket'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) { - accessforbidden(); + accessforbidden(); } @@ -79,9 +79,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '"; + print '"; } /* ************************************************************************** */ @@ -91,10 +91,10 @@ if ($action != 'create' && $action != 'edit') { /* ************************************************************************** */ if ($action == 'create') { - print "
    "; - print load_fiche_titre($langs->trans('NewAttribute')); + print "
    "; + print load_fiche_titre($langs->trans('NewAttribute')); - include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -103,10 +103,10 @@ if ($action == 'create') { /* */ /* ************************************************************************** */ if ($action == 'edit' && !empty($attrname)) { - print "
    "; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
    "; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 664cda18916..6d1f40ec4a0 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -54,9 +54,9 @@ $version='0.0'; if ($action == 'getlastversion') { - $result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); - //var_dump($result['content']); - $sfurl = simplexml_load_string($result['content']); + $result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); + //var_dump($result['content']); + $sfurl = simplexml_load_string($result['content']); } @@ -75,39 +75,39 @@ print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
    '; if (function_exists('curl_init')) { - $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10; + $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10; - if ($action == 'getlastversion') - { - if ($sfurl) - { - $i=0; - while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) - { - $title=$sfurl->channel[0]->item[$i]->title; - if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) - { - $newversion=$reg[1]; - $newversionarray=explode('.', $newversion); - $versionarray=explode('.', $version); - //var_dump($newversionarray);var_dump($versionarray); - if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion; - } - $i++; - } + if ($action == 'getlastversion') + { + if ($sfurl) + { + $i=0; + while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) + { + $title=$sfurl->channel[0]->item[$i]->title; + if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) + { + $newversion=$reg[1]; + $newversionarray=explode('.', $newversion); + $versionarray=explode('.', $version); + //var_dump($newversionarray);var_dump($versionarray); + if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion; + } + $i++; + } - // Show version - print $langs->trans("LastStableVersion").' : '. (($version != '0.0')?$version:$langs->trans("Unknown")) .'
    '; - } - else - { - print $langs->trans("LastStableVersion").' : ' .$langs->trans("UpdateServerOffline").'
    '; - } - } - else - { - print $langs->trans("LastStableVersion").' : ' .$langs->trans("Check").'
    '; - } + // Show version + print $langs->trans("LastStableVersion").' : '. (($version != '0.0')?$version:$langs->trans("Unknown")) .'
    '; + } + else + { + print $langs->trans("LastStableVersion").' : ' .$langs->trans("UpdateServerOffline").'
    '; + } + } + else + { + print $langs->trans("LastStableVersion").' : ' .$langs->trans("Check").'
    '; + } } print '
    '; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 56602502715..fb15a57a87e 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -147,13 +147,13 @@ dol_fiche_head($head, 'card', $langs->trans("MenuUsersAndGroups"), -1, 'user'); print ''; print ''; -print ''; +print ''; print ''; print ''."\n"; print ''; -// Mail required for members +// Mail required for users print ''; print ''; @@ -206,6 +206,8 @@ else dol_print_error($db); } +print load_fiche_titre($langs->trans("UsersDocModules"), '', ''); + print '
    '.$langs->trans("Description").''.$langs->trans("Parameter").' '.$langs->trans("Value").'
    '.$langs->trans("UserMailRequired").'
    '; print ''; print ''; diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 43910bedb56..4f556ff19b3 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -152,6 +152,8 @@ else dol_print_error($db); } +print load_fiche_titre($langs->trans("GroupsDocModules"), '', ''); + print '
    '.$langs->trans("Name").'
    '; print ''; print ''; diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index d3543683db2..2afca6aedb5 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1401,6 +1401,39 @@ class Setup extends DolibarrApi return $this->_cleanObjectDatas($mysoc); } + + /** + * Get value of a setup variables + * + * Note that conf variables that stores security key or password hashes can't be loaded with API. + * + * @url GET /conf + * + * @param string $confname Name of conf variable to get + * @return array|mixed Data without useless information + * + * @throws RestException 403 Forbidden + * @throws RestException 500 Error Bad or unknown value for constname + */ + public function getConf($confname) + { + global $conf; + + if (!DolibarrApiAccess::$user->admin + && (empty($conf->global->API_LOGIN_ALLOWED_FOR_ADMIN_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_ADMIN_CHECK)) { + throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK'); + } + + if (! preg_match('/[^a-zA-Z0-9_]/', $confname) || ! isset($conf->global->$confname)) { + throw new RestException(500, 'Error Bad or unknown value for constname'); + } + if (preg_match('/(_pass|password|secret|_key|key$)/i', $confname)) { + throw new RestException(403, 'Forbidden'); + } + + return $conf->global->$confname; + } + /** * Do a test of integrity for files and setup. * @@ -1409,7 +1442,9 @@ class Setup extends DolibarrApi * * @url GET checkintegrity * - * @throws RestException + * @throws RestException 404 Signature file not found + * @throws RestException 500 Technical error + * @throws RestException 503 Forbidden */ public function getCheckIntegrity($target) { @@ -1418,7 +1453,7 @@ class Setup extends DolibarrApi if (!DolibarrApiAccess::$user->admin && (empty($conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK)) { - throw new RestException(503, 'Error API open to admin users only or to login user defined with constant API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK'); + throw new RestException(503, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK'); } require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/asset/admin/assets_extrafields.php b/htdocs/asset/admin/assets_extrafields.php index d4ae2bd2930..9d224fe079e 100644 --- a/htdocs/asset/admin/assets_extrafields.php +++ b/htdocs/asset/admin/assets_extrafields.php @@ -76,9 +76,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
    '; - print ''; - print "
    "; + print '
    '; + print ''; + print "
    "; } @@ -90,10 +90,10 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
    "; - print load_fiche_titre($langs->trans('NewAttribute')); + print "
    "; + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -103,10 +103,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
    "; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
    "; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 20f189dd99f..e298e0e6540 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -61,28 +61,28 @@ if (! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) $dir = dol_buildpath($dirroot, 0); $handle = @opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle))!==false) - { - if (preg_match('/^mod_barcode_product_.*php$/', $file)) - { - $file = substr($file, 0, dol_strlen($file)-4); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (preg_match('/^mod_barcode_product_.*php$/', $file)) + { + $file = substr($file, 0, dol_strlen($file)-4); - try { - dol_include_once($dirroot.$file.'.php'); - } - catch(Exception $e) - { - dol_syslog($e->getMessage(), LOG_ERR); - } + try { + dol_include_once($dirroot.$file.'.php'); + } + catch(Exception $e) + { + dol_syslog($e->getMessage(), LOG_ERR); + } - $modBarCodeProduct = new $file(); - break; - } - } - closedir($handle); - } + $modBarCodeProduct = new $file(); + break; + } + } + closedir($handle); + } } } diff --git a/htdocs/blockedlog/ajax/block-add.php b/htdocs/blockedlog/ajax/block-add.php index f38efde42b2..92ccd8af369 100644 --- a/htdocs/blockedlog/ajax/block-add.php +++ b/htdocs/blockedlog/ajax/block-add.php @@ -37,8 +37,8 @@ $element = GETPOST('element', 'alpha'); $action = GETPOST('action', 'alpha'); if ($element === 'facture') { - require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; - require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facture = new Facture($db); if($facture->fetch($id)>0) { diff --git a/htdocs/blockedlog/lib/blockedlog.lib.php b/htdocs/blockedlog/lib/blockedlog.lib.php index 13c7ac61d1a..998a97e9bab 100644 --- a/htdocs/blockedlog/lib/blockedlog.lib.php +++ b/htdocs/blockedlog/lib/blockedlog.lib.php @@ -53,13 +53,13 @@ function blockedlogadmin_prepare_head() $object=new stdClass(); - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'blockedlog'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'blockedlog', 'remove'); - return $head; + return $head; } diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 81b5f858c9b..aedef905b7b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -546,7 +546,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $result = $object->getLinesArray(); print ' - + diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 7122e1b6f59..fcfe9905bae 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -74,11 +74,11 @@ if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) { logo_small)) { - print 'Logo company'; + print 'Logo company'; } else { - print '
    '.$mysoc->name.'
    '; + print '
    '.$mysoc->name.'
    '; } ?> diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index b7b37054d91..7783bf7137a 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -305,6 +305,7 @@ switch ($action) $payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice(); $payment->paiementid=$invoice->mode_reglement_id; $payment->num_paiement=''; + $payment->num_payment=''; $paiement_id = $payment->create($user); if ($paiement_id > 0) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index e8296b96beb..2e8afdb0089 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -243,7 +243,49 @@ class Categorie extends CommonObject */ public function __construct($db) { + global $hookmanager; + $this->db = $db; + + if (is_object($hookmanager)) { + $hookmanager->initHooks(array('category')); + $parameters = array(); + $reshook = $hookmanager->executeHooks('constructCategory', $parameters, $this); // Note that $action and $object may have been modified by some hooks + if ($reshook >= 0 && !empty($hookmanager->resArray)) { + $mapList = $hookmanager->resArray; + $mapId = $mapList['id']; + $mapCode = $mapList['code']; + self::$MAP_ID_TO_CODE[$mapId] = $mapCode; + $this->MAP_ID[$mapCode] = $mapId; + $this->MAP_CAT_FK[$mapCode] = $mapList['cat_fk']; + $this->MAP_CAT_TABLE[$mapCode] = $mapList['cat_table']; + $this->MAP_OBJ_CLASS[$mapCode] = $mapList['obj_class']; + $this->MAP_OBJ_TABLE[$mapCode] = $mapList['obj_table']; + } + } + } + + /** + * Get map list + * + * @return array + */ + public function getMapList() + { + $mapList = array(); + + foreach ($this->MAP_ID as $mapCode => $mapId) { + $mapList[] = array( + 'id' => $mapId, + 'code' => $mapCode, + 'cat_fk' => $this->MAP_CAT_FK[$mapCode], + 'cat_table' => $this->MAP_CAT_TABLE[$mapCode], + 'obj_class' => $this->MAP_OBJ_CLASS[$mapCode], + 'obj_table' => $this->MAP_OBJ_TABLE[$mapCode] + ); + } + + return $mapList; } /** diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index d96fddca150..54a4ff9f1d2 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -40,6 +40,7 @@ $id = GETPOST('id', 'int'); $type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT); $catname = GETPOST('catname', 'alpha'); +$categstatic = new Categorie($db); if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility @@ -47,25 +48,13 @@ if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backwar * View */ -$categstatic = new Categorie($db); $form = new Form($db); -if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; } -elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; } -elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; } -elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; } -elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; } -elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; } -elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } -elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } -elseif ($type == Categorie::TYPE_WAREHOUSE) { $title=$langs->trans("StocksCategoriesArea"); $typetext='warehouse'; } -elseif ($type == Categorie::TYPE_ACTIONCOMM) { - $title = $langs->trans("ActionCommCategoriesArea"); - $typetext = 'actioncomm'; -} else { - $title = $langs->trans("CategoriesArea"); - $typetext = 'unknown'; -} +$typetext = $type; +if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea'); +elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea'); +elseif ($type == Categorie::TYPE_ACTIONCOMM) $title = $langs->trans('ActionCommCategoriesArea'); +else $title = $langs->trans(ucfirst($type). 'sCategoriesArea'); $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index ed6091e3568..b9fd23c1a3d 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -36,15 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; $langs->loadlangs(array('categories', 'bills')); -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref'); -$type = GETPOST('type'); -$action = GETPOST('action', 'aZ09'); +$id = GETPOST('id', 'int'); +$label = GETPOST('label', 'alpha'); +$type = GETPOST('type'); +$action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm'); -if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility - -if ($id == "") +if ($id == '' && $label == '') { dol_print_error('', 'Missing parameter id'); exit(); @@ -54,13 +52,17 @@ if ($id == "") $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); -if ($id > 0) -{ - $result = $object->fetch($id); - - $upload_dir = $conf->categorie->multidir_output[$object->entity]; +$result = $object->fetch($id, $label, $type); +if ($result <= 0) { + dol_print_error($db, $object->error); exit; } +$object->fetch_optionals(); +if ($result <= 0) { + dol_print_error($db, $object->error); exit; +} +$upload_dir = $conf->categorie->multidir_output[$object->entity]; +if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility /* * Actions @@ -126,7 +128,7 @@ if ($object->id) dol_fiche_head($head, 'photos', $title, -1, 'category'); $linkback = ''.$langs->trans("BackToList").''; - + $object->next_prev_filter = ' type = ' . $object->type; $object->ref = $object->label; $morehtmlref='
    '.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); @@ -136,7 +138,7 @@ if ($object->id) } $morehtmlref.='
    '; - dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); + dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1); /* * Confirmation de la suppression de photo diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 03ca6e977bd..697db116881 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -36,18 +36,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->loadLangs(array('categories', 'languages')); $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$label = GETPOST('label', 'alpha'); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $type = GETPOST('type', 'aZ09'); -if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility - -// Security check -$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); -$fieldtype = (!empty($ref) ? 'ref' : 'rowid'); - -if ($id == "") +if ($id == '' && $label == '') { dol_print_error('', 'Missing parameter id'); exit(); @@ -57,7 +51,16 @@ if ($id == "") $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); +$result = $object->fetch($id, $label, $type); +if ($result <= 0) { + dol_print_error($db, $object->error); exit; +} +$object->fetch_optionals(); +if ($result <= 0) { + dol_print_error($db, $object->error); exit; +} +if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility /* * Actions @@ -159,8 +162,6 @@ $cancel != $langs->trans("Cancel") && } } -$result = $object->fetch($id, $ref); - /* * View @@ -197,7 +198,7 @@ if (!empty($object->multilangs)) dol_fiche_head($head, 'translation', $title, -1, 'category'); $linkback = ''.$langs->trans("BackToList").''; - +$object->next_prev_filter = ' type = ' . $object->type; $object->ref = $object->label; $morehtmlref = '
    '.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); @@ -207,7 +208,7 @@ foreach ($ways as $way) } $morehtmlref .= '
    '; -dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); +dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1); print '
    '; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 62538da0273..727ef8b0610 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -71,7 +71,7 @@ if ($id == "" && $label == "") $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); -$result = $object->fetch($id, $label); +$result = $object->fetch($id, $label, $type); if ($result <= 0) { dol_print_error($db, $object->error); exit; } @@ -80,7 +80,6 @@ if ($result <= 0) { dol_print_error($db, $object->error); exit; } -$type = $object->type; if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility $extrafields = new ExtraFields($db); @@ -222,8 +221,8 @@ $head = categories_prepare_head($object, $type); dol_fiche_head($head, 'card', $title, -1, 'category'); $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); -$linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter=" type = ".$object->type; +$linkback = ''.$langs->trans("BackToList").''; +$object->next_prev_filter = ' type = ' . $object->type; $object->ref = $object->label; $morehtmlref='
    '.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); @@ -233,7 +232,7 @@ foreach ($ways as $way) } $morehtmlref.='
    '; -dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1); +dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1); /* diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 31f608a9ee0..b9ad3015adf 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -143,19 +143,19 @@ if ($object->id > 0) // Project if (! empty($conf->projet->enabled)) { - $langs->load("projects"); - //$morehtmlref.='
    '.$langs->trans('Project') . ' '; - $morehtmlref.=$langs->trans('Project') . ': '; - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - if ($proj->title) $morehtmlref.=' - '.$proj->title; - } else { - $morehtmlref.=''; - } + $langs->load("projects"); + //$morehtmlref.='
    '.$langs->trans('Project') . ' '; + $morehtmlref.=$langs->trans('Project') . ': '; + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + if ($proj->title) $morehtmlref.=' - '.$proj->title; + } else { + $morehtmlref.=''; + } } $morehtmlref.=''; @@ -253,9 +253,9 @@ if ($object->id > 0) print '
    '.$langs->trans("Name").'
    '; - print '
    '; + print '
    '; - dol_fiche_end(); + dol_fiche_end(); $modulepart = 'actions'; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index b1d0ddc7ccc..6dfbc6c7f9c 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -248,7 +248,7 @@ $nav .= "   ('; -$nav .= ''; +$nav .= ''; $nav .= ''; $nav .= ''; $nav .= ''; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index e8f7be097fa..f2cce5c8023 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -289,7 +289,7 @@ $nav .= "   ".$langs->trans("Today").")"; /*$nav.='   '; -$nav.=''; +$nav.=''; $nav.=''; $nav.=''; $nav.=''; diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index fc53f90ed55..a0530e8c262 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -85,9 +85,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
    '; - print "".$langs->trans("NewAttribute").""; - print "
    "; + print '
    '; + print "".$langs->trans("NewAttribute").""; + print "
    "; } @@ -100,9 +100,9 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { print '
    '; - print load_fiche_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -112,10 +112,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
    "; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
    "; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 0900c5b032c..a21ea9d7d0a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -992,7 +992,7 @@ else print ''.$langs->trans("SetToDraft").''; } - if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer) + if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer) { if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 9babe88fd0b..d8d9873b88b 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -48,8 +48,8 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortfield) $sortfield = "email"; -if (!$sortorder) $sortorder = "ASC"; +if (!$sortfield) $sortfield = "mc.statut,email"; +if (!$sortorder) $sortorder = "DESC,ASC"; $id = GETPOST('id', 'int'); $rowid = GETPOST('rowid', 'int'); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9430fce4634..279f72896f5 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1541,7 +1541,7 @@ if ($action == 'create') $object = new Propal($db); print ''; - print ''; + print ''; print ''; if ($origin != 'project' && $originid) { print ''; @@ -2052,7 +2052,7 @@ if ($action == 'create') print ''; if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdate' && $usercancreate) { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date, 're', '', '', 0, "editdate"); print ''; @@ -2078,7 +2078,7 @@ if ($action == 'create') print ''; if ($object->statut == Propal::STATUS_DRAFT && $action == 'editecheance' && $usercancreate) { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->fin_validite, 'ech', '', '', '', "editecheance"); print ''; @@ -2412,7 +2412,7 @@ if ($action == 'create') $result = $object->getLinesArray(); print ' - + diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 66f4aa94fd2..a931af375c5 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -302,7 +302,8 @@ if ($resql) print ''.$companystatic->getNomUrl(1, 'customer').''; print ''.dol_print_date($db->jdate($obj->datec), 'day').''; - print ''.$propalstatic->LibStatut($obj->fk_statut, 5).''; + + print ''.$propalstatic->LibStatut($obj->fk_statut, 3).''; print ''; $i++; } @@ -314,7 +315,7 @@ else dol_print_error($db); /* - * Opened proposals + * Open proposals */ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { @@ -381,9 +382,10 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) $companystatic->canvas = $obj->canvas; print ''.$companystatic->getNomUrl(1, 'customer', 44).''."\n"; - print ''; - print dol_print_date($db->jdate($obj->dp), 'day').''."\n"; + print ''.dol_print_date($db->jdate($obj->dp), 'day').''."\n"; + print ''.price($obj->total_ttc).''; + print ''.$propalstatic->LibStatut($obj->fk_statut, 3).''."\n"; print ''."\n"; $i++; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 4a2b8dea419..030db477631 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -242,7 +242,9 @@ print '
    '; //{ // Show filter box print ''; + print ''; print ''; + print ''; print ''; // Company diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7db4d3c9767..10ba69601c1 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -117,6 +117,9 @@ if (!empty($conf->expedition->enabled) && $conf->global->WAREHOUSE_ASK_WAREHOUSE if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; } +$error = 0; + + /* * Actions */ @@ -1599,7 +1602,7 @@ if ($action == 'create' && $usercancreate) } print ''; - print ''; + print ''; print ''; print ''."\n"; print ''; @@ -2181,7 +2184,7 @@ if ($action == 'create' && $usercancreate) print ''; print ''; diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 072abe9625b..8e1fa07c17a 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -72,7 +72,6 @@ print '
    '; if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo { // Search customer orders - $var = false; print ''; print ''; print '
    '; @@ -88,7 +87,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles * Statistics */ -$sql = "SELECT count(c.rowid), c.fk_statut"; +$sql = "SELECT count(c.rowid) as nb, c.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -117,7 +116,7 @@ if ($resql) //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) { if (! isset($vals[$row[1]])) $vals[$row[1]]=0; - $vals[$row[1].$bool]+=$row[0]; + $vals[$row[1]]+=$row[0]; $totalinprocess+=$row[0]; } $total+=$row[0]; @@ -125,13 +124,32 @@ if ($resql) $i++; } $db->free($resql); + + include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + print '
    '; print '
    '.$langs->trans("Filter").'
    '; if ($action == 'editdate') { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date, 'order_', '', '', '', "setdate"); print ''; @@ -2202,7 +2205,7 @@ if ($action == 'create' && $usercancreate) print ''; if ($action == 'editdate_livraison') { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date_livraison ? $object->date_livraison : - 1, 'liv_', '', '', '', "setdate_livraison"); print ''; @@ -2496,7 +2499,7 @@ if ($action == 'create' && $usercancreate) $result = $object->getLinesArray(); print ' - + '; diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index eb3c165d447..289bbea2c7e 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -150,7 +150,8 @@ class Orders extends DolibarrApi * @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 + * @throws RestException 404 Not found + * @throws RestException 503 Error */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 57eb78df405..b1b7b3c8fe5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3613,7 +3613,7 @@ class Commande extends CommonOrder if ($status == self::STATUS_CANCELED) { $labelStatus = $langs->trans('StatusOrderCanceled'); $labelStatusShort = $langs->trans('StatusOrderCanceledShort'); - $statusType = 'status5'; + $statusType = 'status9'; } elseif ($status == self::STATUS_DRAFT) { $labelStatus = $langs->trans('StatusOrderDraft'); @@ -3628,7 +3628,7 @@ class Commande extends CommonOrder elseif ($status == self::STATUS_SHIPMENTONPROCESS) { $labelStatus = $langs->trans('StatusOrderSentShort').$billedtext; $labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext; - $statusType = 'status3'; + $statusType = 'status4'; } elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderToBill'); diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index a3b754e0979..4da1ea48fd6 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -162,13 +162,13 @@ if ($resql) print '
    '; - $result=''; - $link=$linkend=''; - $link = ''; - $linkend=''; - $name=$obj->name; - $result.=($link.img_object($langs->trans("ShowCompany").': '.$name, 'company').$linkend); - $result.=$link.(dol_trunc($name, $maxlen)).$linkend; + $result=''; + $link=$linkend=''; + $link = ''; + $linkend=''; + $name=$obj->name; + $result.=($link.img_object($langs->trans("ShowCompany").': '.$name, 'company').$linkend); + $result.=$link.(dol_trunc($name, $maxlen)).$linkend; print $result; print '
    '; print ''."\n"; $listofstatus=array(0,1,2,3,-1); foreach ($listofstatus as $status) { - $dataseries[]=array($commandestatic->LibStatut($status, $bool, 1), (isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0)); + $dataseries[] = array($commandestatic->LibStatut($status, 0, 1, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); + if ($status == Commande::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == Commande::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; + if ($status == Commande::STATUS_SHIPMENTONPROCESS) $colorseries[$status] = $badgeStatus4; + if ($status == Commande::STATUS_CLOSED && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) $colorseries[$status] = $badgeStatus6; + if ($status == Commande::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) $colorseries[$status] = $badgeStatus6; + if ($status == Commande::STATUS_CANCELED) $colorseries[$status] = $badgeStatus9; + + if (empty($conf->use_javascript_ajax)) + { + print ''; + print ''; + print ''; + print "\n"; + } } if ($conf->use_javascript_ajax) { @@ -140,6 +158,7 @@ if ($resql) include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); @@ -149,19 +168,6 @@ if ($resql) print ''; } - else - { - foreach ($listofstatus as $status) - { - print ''; - print ''; - print ''; - print "\n"; - } - } //if ($totalinprocess != $total) print ''; print "
    '.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'
    '.$commandestatic->LibStatut($status, 0, 0, 1).''.(isset($vals[$status]) ? $vals[$status] : 0).' '; + print $commandestatic->LibStatut($status, 0, 3, 1); + print '
    '.$commandestatic->LibStatut($status, $bool, 0).''.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' '; - print $commandestatic->LibStatut($status, $bool, 3); - print ''; - print '
    '.$langs->trans("Total").''.$total.'

    "; @@ -202,7 +208,6 @@ if (!empty($conf->commande->enabled)) if ($num) { $i = 0; - $var = true; while ($i < $num) { $obj = $db->fetch_object($resql); @@ -241,7 +246,7 @@ print '
    '; $max = 5; /* - * Last modified orders + * Lattest modified orders */ $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,"; @@ -272,7 +277,6 @@ if ($resql) if ($num) { $i = 0; - $var = true; while ($i < $num) { $obj = $db->fetch_object($resql); @@ -311,7 +315,7 @@ if ($resql) print $companystatic->getNomUrl(1, 'company', 16); print ''; print ''.dol_print_date($db->jdate($obj->datem), 'day').''; - print ''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 5).''; + print ''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).''; print ''; $i++; } @@ -320,13 +324,14 @@ if ($resql) } else dol_print_error($db); +$max = 10; /* * Orders to process */ if (!empty($conf->commande->enabled)) { - $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; $sql .= ", s.canvas"; @@ -335,7 +340,7 @@ if (!empty($conf->commande->enabled)) if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('commande').")"; - $sql .= " AND c.fk_statut = 1"; + $sql .= " AND c.fk_statut = ".Commande::STATUS_VALIDATED; if ($socid) $sql .= " AND c.fk_soc = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " ORDER BY c.rowid DESC"; @@ -344,16 +349,16 @@ if (!empty($conf->commande->enabled)) if ($resql) { $num = $db->num_rows($resql); + print '
    '; print ''; print ''; - print ''; + print ''; if ($num) { $i = 0; - $var = true; - while ($i < $num) + while ($i < $num && $i < $max) { $obj = $db->fetch_object($resql); print ''; @@ -390,11 +395,16 @@ if (!empty($conf->commande->enabled)) print $companystatic->getNomUrl(1, 'company', 24); print ''; - print ''; + print ''."\n"; + + print ''; print ''; $i++; } + if ($i < $num) { + print ''; + } } print "
    '.$langs->trans("OrdersToProcess").' '.$num.'
    '.$langs->trans("OrdersToProcess").' '.$num.'
    '.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 5).''.dol_print_date($db->jdate($obj->date), 'day').''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).'
    '.$langs->trans("More").'...

    "; @@ -403,11 +413,11 @@ if (!empty($conf->commande->enabled)) } /* - * Orders thar are in a shipping process + * Orders that are in process */ if (!empty($conf->commande->enabled)) { - $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; $sql .= ", s.canvas"; @@ -416,7 +426,7 @@ if (!empty($conf->commande->enabled)) if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('commande').")"; - $sql .= " AND c.fk_statut = 2 "; + $sql .= " AND c.fk_statut = ".Commande::STATUS_ACCEPTED; if ($socid) $sql .= " AND c.fk_soc = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " ORDER BY c.rowid DESC"; @@ -429,13 +439,12 @@ if (!empty($conf->commande->enabled)) print '
    '; print ''; print ''; - print ''; + print ''; if ($num) { $i = 0; - $var = true; - while ($i < $num) + while ($i < $num && $i < $max) { $obj = $db->fetch_object($resql); print ''; @@ -472,11 +481,16 @@ if (!empty($conf->commande->enabled)) print $companystatic->getNomUrl(1, 'company'); print ''; - print ''; + print ''."\n"; + + print ''; print ''; $i++; } + if ($i < $num) { + print ''; + } } print "
    '.$langs->trans("OnProcessOrders").' '.$num.'
    '.$langs->trans("OnProcessOrders").' '.$num.'
    '.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 5).''.dol_print_date($db->jdate($obj->date), 'day').''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).'
    '.$langs->trans("More").'...

    "; } diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index e9eca9dafa9..c465cdcb8c9 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -255,7 +255,9 @@ print '
    '; // Show filter box print ''; +print ''; print ''; + print ''; print ''; // Company diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index ff9f573bcc9..318db920a52 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -16,11 +16,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -/** + + /** * \file htdocs/compta/accounting-files.php * \ingroup compta * \brief Page to show portoflio and files of a thirdparty and download it */ + +if ($_GET['action'] == 'dl' || $_POST['action'] == 'dl') { // To not replace token when downloading file + if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +} + require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -113,7 +119,7 @@ $error = 0; $filesarray = array(); $result = false; -if (($action == "searchfiles" || $action == "dl")) { +if (($action == 'searchfiles' || $action == 'dl')) { if (empty($date_start)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart")), null, 'errors'); @@ -259,7 +265,7 @@ if (($action == "searchfiles" || $action == "dl")) { { $result = true; - $files = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); + $files = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', '', SORT_ASC, 1); //var_dump($upload_dir); //var_dump($files); if (count($files) < 1) @@ -512,7 +518,7 @@ if (!empty($date_start) && !empty($date_stop)) $param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0); } print ''."\n"; - print ''; + print ''; echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day'); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 39bad992620..26563f98dd4 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1157,14 +1157,14 @@ if ($resql) } else { $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR1; } - $backgroundcolor = 'style="background-color: '.$color.';"'; + $backgroundcolor = 'style="background: '.$color.';"'; } else { if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR2)) { $color = '#7fdb86'; } else { $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR2; } - $backgroundcolor = 'style="background-color: '.$color.';"'; + $backgroundcolor = 'style="background: '.$color.';"'; } } print ''; diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 57d81c625fe..8dd3eca5e33 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -363,7 +363,7 @@ if ($action == "create" || $action == "start" || $action == 'close') print load_fiche_titre($langs->trans("CashControl")." - ".$langs->trans("New"), '', 'cash-register'); print ''; - print ''; + print ''; if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; @@ -680,7 +680,7 @@ if (empty($action) || $action == "view" || $action == "close") print '
    '; } else { print ''; - print ''; + print ''; if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index cabc3510ea4..c08be32242b 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -281,7 +281,7 @@ if ($action == 'create') print ''; print ''; @@ -293,7 +293,7 @@ if ($action == 'create') print ''; print ''; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index c9c48fd9b93..cf745b784fc 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -227,7 +227,9 @@ print '
    '; // Show filter box print ''; +print ''; print ''; + print '
    '.$langs->trans("Filter").'
    '.$langs->trans('NotePublic').''; - $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); + $doleditor = new DolEditor('note_public', GETPOST('note_public', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); print '
    '.$langs->trans('NotePrivate').''; - $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); + $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); print '
    '; print ''; // Company diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index dd295fa3112..26eee81375f 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1680,7 +1680,7 @@ else // Lines print ' - + diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8d2de29ca21..fbff955db47 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1713,7 +1713,17 @@ if (empty($reshook)) $object->fk_facture_source = $_POST['situations']; $object->type = Facture::TYPE_SITUATION; - if (!empty($origin) && !empty($originid)) + + $object->retained_warranty = GETPOST('retained_warranty', 'int'); + $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + + $retained_warranty_date_limit = GETPOST('retained_warranty_date_limit'); + if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) { + $object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit); + } + $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement); + + if (!empty($origin) && !empty($originid)) { $object->origin = $origin; $object->origin_id = $originid; @@ -2555,7 +2565,12 @@ if (empty($reshook)) $pa_ht = $originLine->pa_ht; $label = $originLine->label; $array_options = $originLine->array_options; - $situation_percent = 100; + if($object->type == Facture::TYPE_SITUATION){ + $situation_percent = 0; + } + else{ + $situation_percent = 100; + } $fk_prev_id = ''; $fk_unit = $originLine->fk_unit; $pu_ht_devise = $originLine->multicurrency_subprice; @@ -2839,7 +2854,7 @@ if ($action == 'create') } print ''; - print ''; + print ''; print ''; if ($soc->id > 0) print ''."\n"; print ''; @@ -3035,7 +3050,7 @@ if ($action == 'create') // First situation invoice print '
    '; $tmp = ' '; - $tmp = $tmp.''; + $tmp = $tmp.''; $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); print $desc; print '
    '; @@ -3322,14 +3337,28 @@ if ($action == 'create') } $retained_warranty = GETPOST('retained_warranty', 'int'); - $retained_warranty = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + if(empty($retained_warranty)){ + if(!empty($objectsrc->retained_warranty)){ // use previous situation value + $retained_warranty = $objectsrc->retained_warranty; + }else{ + $retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + } + } + print ''; @@ -4430,7 +4459,7 @@ elseif ($id > 0 || !empty($ref)) print ''; } + + print "
    '.$langs->trans("Filter").'
    '.$langs->trans('RetainedWarranty').''; print '%'; // Retained warranty payment term print '
    '.$langs->trans('PaymentConditionsShortRetainedWarranty').''; $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + if(empty($retained_warranty_fk_cond_reglement)){ + $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value + $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; + }else{ + $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + } + } $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); print '
    '; if ($action == 'editrevenuestamp') { print ''; - print ''; + print ''; print ''; print ''; print $formother->select_revenue_stamp('', 'revenuestamp_type', $mysoc->country_code); @@ -4934,7 +4963,7 @@ elseif ($id > 0 || !empty($ref)) } print ' - + diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 969d351d1bb..961d07eda2e 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -158,7 +158,8 @@ class Invoices extends DolibarrApi * @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 invoice objects * - * @throws RestException + * @throws RestException 404 Not found + * @throws RestException 503 Error */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b0b78b3bf03..ec7348723c5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -279,8 +279,8 @@ class Facture extends CommonInvoice 'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>105), 'close_note' =>array('type'=>'varchar(128)', 'label'=>'EarlyClosingComment', 'enabled'=>1, 'visible'=>-1, 'position'=>110), 'tva' =>array('type'=>'double(24,8)', 'label'=>'TotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1), - 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1), - 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1), + 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LT1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1), + 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LT2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1), 'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1), 'total' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), @@ -1067,6 +1067,11 @@ class Facture extends CommonInvoice $facture->situation_cycle_ref = $this->situation_cycle_ref; $facture->situation_final = $this->situation_final; + $facture->retained_warranty = $this->retained_warranty; + $facture->retained_warranty_fk_cond_reglement = $this->retained_warranty_fk_cond_reglement; + $facture->retained_warranty_date_limit = $this->retained_warranty_date_limit; + + // Loop on each line of new invoice foreach ($facture->lines as $i => $tmpline) { @@ -1647,8 +1652,8 @@ class Facture extends CommonInvoice $this->lines = array(); $sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; - $sql .= ' l.situation_percent, l.fk_prev_id,'; $sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,'; + $sql .= ' l.situation_percent, l.fk_prev_id,'; $sql .= ' l.rang, l.special_code,'; $sql .= ' l.date_start as date_start, l.date_end as date_end,'; $sql .= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; @@ -2251,10 +2256,10 @@ class Facture extends CommonInvoice // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1 - * ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 + * Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1 + * or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 * - * @param User $user Objet utilisateur qui modifie + * @param User $user Object user that modify * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple) * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @return int <0 if KO, >0 if OK diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index bd749e02dee..a72b03b47a3 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -235,7 +235,9 @@ print '
    '; // Show filter box print ''; +print ''; print ''; + print ''; print ''; // Company diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index c9a77e5cc26..4c7e0714caa 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -348,7 +348,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $sql .= " GROUP BY f.rowid, f.ref, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; $sql .= " s.nom, s.rowid, s.code_client, s.code_compta, s.email,"; $sql .= " cc.rowid, cc.code"; - $sql .= " ORDER BY f.tms DESC "; + $sql .= " ORDER BY f.tms DESC"; $sql .= $db->plimit($max, 0); $resql = $db->query($sql); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 926c0bfc87e..c78a010777a 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -115,7 +115,7 @@ if (GETPOST("orphelins", "alpha")) { // Payments not linked to an invoice. Should not happend. For debug only. $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; - $sql.= " p.statut, p.num_paiement,"; + $sql.= " p.statut, p.num_paiement as num_payment,"; $sql.= " c.code as paiement_code"; // Add fields from hooks $parameters=array(); @@ -133,7 +133,7 @@ if (GETPOST("orphelins", "alpha")) else { $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives - $sql.= " p.statut, p.num_paiement,"; + $sql.= " p.statut, p.num_paiement as num_payment,"; $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,"; $sql.= " s.rowid as socid, s.nom as name, s.email"; @@ -323,7 +323,7 @@ if ($resql) if (!$i) $totalarray['nbfield']++; // Payment number - print ''; + print ''; if (!$i) $totalarray['nbfield']++; // Account diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php index 7539d6165ea..c14c29f3179 100644 --- a/htdocs/compta/paiement/tovalidate.php +++ b/htdocs/compta/paiement/tovalidate.php @@ -64,7 +64,7 @@ if (! $sortfield) $sortfield="p.rowid"; llxHeader(); $sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut"; -$sql.=", c.libelle as paiement_type, p.num_paiement"; +$sql.=", c.libelle as paiement_type, p.num_paiement as num_payment"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id"; if ($socid) { @@ -119,7 +119,7 @@ if ($resql) print ''; print ''; print '\n"; - print "\n"; + print "\n"; print ''; print ''; - print ''."\n"; + print ''."\n"; print ''; print ''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 4050d081fe4..41f1ebf5a62 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -484,7 +484,7 @@ class BonPrelevement extends CommonObject $paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice $paiement->paiementid = 3; // $paiement->num_payment = $this->ref; // Set ref of direct debit note - $paiement->num_paiement = $this->ref; // For bacward compatibility + $paiement->num_paiement = $this->ref; // For backward compatibility $paiement->id_prelevement = $this->id; $paiement_id = $paiement->create($user); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 740a1e47784..c78dbd06259 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -154,6 +154,7 @@ class RejetPrelevement $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal $pai->num_paiement = $fac->ref; + $pai->num_payment = $fac->ref; if ($pai->create($this->user) < 0) // we call with no_commit { diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 55bf5e1f022..fdc1d622e90 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -54,15 +54,15 @@ $sql.= " AND pb.entity = ".$conf->entity; $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - if ( $num > 0 ) - { - $row = $db->fetch_row($resql); - $total = $row[0]; - $nbtotal = $row[1]; - } + if ( $num > 0 ) + { + $row = $db->fetch_row($resql); + $total = $row[0]; + $nbtotal = $row[1]; + } } @@ -150,15 +150,15 @@ $sql.= " AND pl.statut = 3"; $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - if ( $num > 0 ) - { - $row = $db->fetch_row($resql); - $total = $row[0]; - $nbtotal = $row[1]; - } + if ( $num > 0 ) + { + $row = $db->fetch_row($resql); + $total = $row[0]; + $nbtotal = $row[1]; + } } /* diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 69ad435c64c..d7f20622a43 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -603,7 +603,7 @@ if ($id > 0) /* * Payments */ - $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; + $sql = "SELECT p.rowid, p.num_paiement as num_payment, datep as dp, p.amount,"; $sql .= " c.code as type_code,c.libelle as paiement_type,"; $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal'; $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; @@ -647,7 +647,7 @@ if ($id > 0) print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''; print '\n"; $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; - print "\n"; + print "\n"; if (!empty($conf->banque->enabled)) { $bankaccountstatic->id = $objp->baid; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 629a73578b2..02c15b099b9 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -69,8 +69,17 @@ class PaymentSocialContribution extends CommonObject */ public $fk_typepaiement; + /** + * @var string + * @deprecated + */ public $num_paiement; + /** + * @var string + */ + public $num_payment; + /** * @var int ID */ @@ -125,7 +134,8 @@ class PaymentSocialContribution extends CommonObject if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge; if (isset($this->amount)) $this->amount = trim($this->amount); if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); + if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated + if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; @@ -149,11 +159,11 @@ class PaymentSocialContribution extends CommonObject if ($totalamount != 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,"; - $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)"; + $sql .= " fk_typepaiement, num_paiement as num_payment, note, fk_user_creat, fk_bank)"; $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datepaye)."',"; $sql .= " ".$totalamount.","; - $sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.","; + $sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.","; $sql .= " 0)"; $resql = $this->db->query($sql); @@ -231,7 +241,7 @@ class PaymentSocialContribution extends CommonObject $sql.= " t.datep,"; $sql.= " t.amount,"; $sql.= " t.fk_typepaiement,"; - $sql.= " t.num_paiement,"; + $sql.= " t.num_paiement as num_payment,"; $sql.= " t.note,"; $sql.= " t.fk_bank,"; $sql.= " t.fk_user_creat,"; @@ -260,7 +270,8 @@ class PaymentSocialContribution extends CommonObject $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; $this->fk_typepaiement = $obj->fk_typepaiement; - $this->num_paiement = $obj->num_paiement; + $this->num_paiement = $obj->num_payment; + $this->num_payment = $obj->num_payment; $this->note = $obj->note; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; @@ -301,7 +312,8 @@ class PaymentSocialContribution extends CommonObject if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge; if (isset($this->amount)) $this->amount = trim($this->amount); if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); + if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated + if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; @@ -511,8 +523,9 @@ class PaymentSocialContribution extends CommonObject $this->datep = ''; $this->amount = ''; $this->fk_typepaiement = ''; - $this->num_paiement = ''; - $this->note = ''; + $this->num_payment = ''; + $this->note_private = ''; + $this->note_public = ''; $this->fk_bank = ''; $this->fk_user_creat = ''; $this->fk_user_modif = ''; diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index e449f907bc8..7806e3e4cc1 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -27,8 +27,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (! empty($conf->projet->enabled)) { - include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } // Load translation files required by the page @@ -51,10 +51,10 @@ $object = new ChargeSociales($db); if ($action == 'setlib' && $user->rights->tax->charges->creer) { - $object->fetch($id); - $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); + $object->fetch($id); + $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); } @@ -84,17 +84,17 @@ $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user // Project if (! empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref.='
    '.$langs->trans('Project') . ' : '; - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - } else { - $morehtmlref.=''; - } + $langs->load("projects"); + $morehtmlref.='
    '.$langs->trans('Project') . ' : '; + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } } $morehtmlref.=''; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index a742c5c45fd..32c37301a0e 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -218,7 +218,7 @@ $dolibarr_main_authentication='dolibarr'; // 0 = No forced redirect // 1 = Force redirect to https, until SCRIPT_URI start with https into response // 2 = Force redirect to https, until SERVER["HTTPS"] is 'on' into response -// 'https://my.domain.com' = Force reditect to https using this domain name. +// 'https://my.domain.com' = Force redirect to https using this domain name. // Warning: If you enable this parameter, your web server must be configured to // respond URL with https protocol. // According to your web server setup, some values may works and other not. Try @@ -226,7 +226,7 @@ $dolibarr_main_authentication='dolibarr'; // Default value: 0 // Possible values: 0, 1, 2 or 'https://my.domain.com' // Examples: -// $dolibarr_main_force_https='0'; +// $dolibarr_main_force_https='1'; // $dolibarr_main_force_https='0'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 0335e203049..d7a8d025e21 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -108,7 +108,7 @@ $userid = GETPOST('userid', 'int'); $begin = GETPOST('begin'); if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "p.lastname"; -if (empty($page) || $page < 0) { $page = 0; } +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } $offset = $limit * $page; $titre = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); @@ -497,11 +497,11 @@ print ''; print ''; print ''; print ''; -print ''; +//print ''; print ''; print ''; -print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit); +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "contact"; diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php index 5f6bea09a3d..7696e3365d2 100644 --- a/htdocs/contrat/admin/contract_extrafields.php +++ b/htdocs/contrat/admin/contract_extrafields.php @@ -80,9 +80,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
    '; - print "".$langs->trans("NewAttribute").""; - print "
    "; + print '
    '; + print "".$langs->trans("NewAttribute").""; + print "
    "; } @@ -95,9 +95,9 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { print '
    '; - print load_fiche_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -108,9 +108,9 @@ if ($action == 'create') if ($action == 'edit' && ! empty($attrname)) { print '

    '; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/contrat/admin/contractdet_extrafields.php b/htdocs/contrat/admin/contractdet_extrafields.php index 3a8340dfecc..a78669bec22 100644 --- a/htdocs/contrat/admin/contractdet_extrafields.php +++ b/htdocs/contrat/admin/contractdet_extrafields.php @@ -80,9 +80,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
    '; - print "".$langs->trans("NewAttribute").""; - print "
    "; + print '
    '; + print "".$langs->trans("NewAttribute").""; + print "
    "; } @@ -97,7 +97,7 @@ if ($action == 'create') print '
    '; print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -107,10 +107,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
    "; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
    "; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 71458e76050..ecd03ade1a6 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -99,7 +99,8 @@ class Contracts extends DolibarrApi * @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 contract objects * - * @throws RestException + * @throws RestException 404 Not found + * @throws RestException 503 Error */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0aee2ed876d..58bd029f8de 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2785,7 +2785,7 @@ class ContratLigne extends CommonObjectLine elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); } $statusType = 'status'.$status; - if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status3'; + if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status1'; if ($status == self::STATUS_CLOSED) $statusType = 'status6'; $params = array(); $reg = array(); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 1061d47a888..3c306453c00 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -109,7 +109,7 @@ $dataseries = array(); $vals = array(); // Search by status (except expired) -$sql = "SELECT count(cd.rowid), cd.statut"; +$sql = "SELECT count(cd.rowid) as nb, cd.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -126,16 +126,16 @@ if ($resql) $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); - if ($row) + $obj = $db->fetch_object($resql); + if ($obj) { - $nb[$row[1]] = $row[0]; - if ($row[1] != 5) + $nb[$obj->status] = $obj->nb; + if ($obj->status != 5) { - $vals[$row[1]] = $row[0]; - $totalinprocess += $row[0]; + $vals[$obj->status] = $obj->nb; + $totalinprocess += $obj->nb; } - $total += $row[0]; + $total += $obj->nb; } $i++; } @@ -146,7 +146,7 @@ else dol_print_error($db); } // Search by status (only expired) -$sql = "SELECT count(cd.rowid), cd.statut"; +$sql = "SELECT count(cd.rowid) as nb, cd.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -165,16 +165,16 @@ if ($resql) $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); - if ($row) + $obj = $db->fetch_object($resql); + if ($obj) { - $nb[$row[1].true] = $row[0]; - if ($row[1] != 5) + $nb[$obj->status.true] = $obj->nb; + if ($obj->status != 5) { - $vals[$row[1]] = $row[0]; - $totalinprocess += $row[0]; + $vals[$obj->status.true] = $obj->nb; + $totalinprocess += $obj->nb; } - $total += $row[0]; + $total += $obj->nb; } $i++; } @@ -185,6 +185,10 @@ else dol_print_error($db); } +$colorseries = array(); + +include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + print '
    '; print '
    '.$langs->trans("Filter").'
    '.$objp->num_paiement.''.$objp->num_payment.'
    '.img_object($langs->trans("ShowPayment"), "payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp), 'day')."$objp->paiement_type $objp->num_paiement$objp->paiement_type $objp->num_payment'.price($objp->amount).''; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 561120aead6..31e13a9d356 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -108,9 +108,10 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y $paiement->chid = $chid; $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Tableau de montant - $paiement->paiementtype = $_POST["paiementtype"]; - $paiement->num_paiement = $_POST["num_paiement"]; - $paiement->note = $_POST["note"]; + $paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml'); + $paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); + $paiement->note = GETPOST("note", 'none'); + $paiement->note_private = GETPOST("note", 'none'); if (!$error) { @@ -243,7 +244,7 @@ if ($action == 'create') print '
    '.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print '
    '.$langs->trans("Comments").''.dol_print_date($db->jdate($objp->dp), 'day')."".$labeltype.' '.$objp->num_paiement."".$labeltype.' '.$objp->num_payment."
    '; print ''."\n"; @@ -192,6 +196,11 @@ $listofstatus = array(0, 4, 4, 5); $bool = false; foreach ($listofstatus as $status) { $dataseries[] = array($staticcontratligne->LibStatut($status, 1, ($bool ? 1 : 0)), (isset($nb[$status.$bool]) ? (int) $nb[$status.$bool] : 0)); + if ($status == ContratLigne::STATUS_INITIAL) $colorseries[$status.$bool] = '-'.$badgeStatus0; + if ($status == ContratLigne::STATUS_OPEN && !$bool) $colorseries[$status.$bool] = $badgeStatus4; + if ($status == ContratLigne::STATUS_OPEN && $bool) $colorseries[$status.$bool] = $badgeStatus1; + if ($status == ContratLigne::STATUS_CLOSED) $colorseries[$status.$bool] = $badgeStatus6; + if (empty($conf->use_javascript_ajax)) { print ''; @@ -209,6 +218,7 @@ if (!empty($conf->use_javascript_ajax)) include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index 9fca4502dcf..ca5f05f5f4d 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -32,9 +32,9 @@ $addlinkid = GETPOST('idtolinkto', 'int'); // Link invoice to order if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel', 'alpha') && $id > 0 && $addlinkid > 0) { - $object->fetch($id); - $object->fetch_thirdparty(); - $result = $object->add_object_linked(GETPOST('addlink', 'alpha'), $addlinkid); + $object->fetch($id); + $object->fetch_thirdparty(); + $result = $object->add_object_linked(GETPOST('addlink', 'alpha'), $addlinkid); } // Delete link diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index c3f046431b0..17e063244df 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1215,6 +1215,8 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permissio $db->rollback(); } } + + // Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before) if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permissiontodelete) { diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index fc0f25a1297..0671e998684 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -29,63 +29,63 @@ // Print file if ($action == 'print_file' && $user->rights->printing->read) { - $langs->load("printing"); - require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php'; - $objectprint = new PrintingDriver($db); - $list = $objectprint->listDrivers($db, 10); - if (! empty($list)) { - $errorprint=0; - $printerfound=0; - foreach ($list as $driver) { - require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; - $langs->load($driver); - $classname = 'printing_'.$driver; - $printer = new $classname($db); - //print '
    '.print_r($printer, true).'
    '; + $langs->load("printing"); + require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php'; + $objectprint = new PrintingDriver($db); + $list = $objectprint->listDrivers($db, 10); + if (! empty($list)) { + $errorprint=0; + $printerfound=0; + foreach ($list as $driver) { + require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; + $langs->load($driver); + $classname = 'printing_'.$driver; + $printer = new $classname($db); + //print '
    '.print_r($printer, true).'
    '; - if (! empty($conf->global->{$printer->active})) - { - $printerfound++; + if (! empty($conf->global->{$printer->active})) + { + $printerfound++; - $subdir=''; - $module = GETPOST('printer', 'alpha'); - switch ($module ) - { - case 'livraison' : - $subdir = 'receipt'; - $module = 'expedition'; - break; - case 'expedition' : - $subdir = 'sending'; - break; - case 'commande_fournisseur' : - $module = 'fournisseur'; - $subdir = 'commande'; - break; - } - try { - $ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir); - if ($ret > 0) { - //print '
    '.print_r($printer->errors, true).'
    '; - setEventMessages($printer->error, $printer->errors, 'errors'); - } - if ($ret==0) - { - //print '
    '.print_r($printer->errors, true).'
    '; - setEventMessages($printer->error, $printer->errors); - setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); - } - } - catch(Exception $e) - { - $ret = 1; - setEventMessages($e->getMessage(), null, 'errors'); - } - } - } - if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound", $langs->transnoentities("Module64000Name")), null, 'warnings'); - } else { - setEventMessages($langs->trans("NoModuleFound"), null, 'warnings'); - } - $action = ''; + $subdir=''; + $module = GETPOST('printer', 'alpha'); + switch ($module ) + { + case 'livraison' : + $subdir = 'receipt'; + $module = 'expedition'; + break; + case 'expedition' : + $subdir = 'sending'; + break; + case 'commande_fournisseur' : + $module = 'fournisseur'; + $subdir = 'commande'; + break; + } + try { + $ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir); + if ($ret > 0) { + //print '
    '.print_r($printer->errors, true).'
    '; + setEventMessages($printer->error, $printer->errors, 'errors'); + } + if ($ret==0) + { + //print '
    '.print_r($printer->errors, true).'
    '; + setEventMessages($printer->error, $printer->errors); + setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); + } + } + catch(Exception $e) + { + $ret = 1; + setEventMessages($e->getMessage(), null, 'errors'); + } + } + } + if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound", $langs->transnoentities("Module64000Name")), null, 'warnings'); + } else { + setEventMessages($langs->trans("NoModuleFound"), null, 'warnings'); + } + $action = ''; } diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 425204e00a4..8c8f23f9b0e 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -60,8 +60,8 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel } } } elseif ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('cancel', 'alpha')) { - // Set public note - if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before'); + // Set public note + if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before'); if (empty($object->id)) $object->fetch($id); // Fetch may not be already done $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private', 'none'), ENT_QUOTES), '_private'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/core/ajax/bankconciliate.php b/htdocs/core/ajax/bankconciliate.php index 690ebc80f85..f3e6c379392 100644 --- a/htdocs/core/ajax/bankconciliate.php +++ b/htdocs/core/ajax/bankconciliate.php @@ -51,46 +51,46 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ { // Increase date $al = new AccountLine($db); - $al->datev_next(GETPOST('rowid', 'int')); - $al->fetch(GETPOST('rowid', 'int')); + $al->datev_next(GETPOST('rowid', 'int')); + $al->fetch(GETPOST('rowid', 'int')); - print ''.dol_print_date($db->jdate($al->datev), "day").''; + print ''.dol_print_date($db->jdate($al->datev), "day").''; - exit; + exit; } if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvprev') { // Decrease date $al =new AccountLine($db); - $al->datev_previous(GETPOST('rowid', 'int')); - $al->fetch(GETPOST('rowid', 'int')); + $al->datev_previous(GETPOST('rowid', 'int')); + $al->fetch(GETPOST('rowid', 'int')); - print ''.dol_print_date($db->jdate($al->datev), "day").''; + print ''.dol_print_date($db->jdate($al->datev), "day").''; - exit; + exit; } if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'donext') { // Increase date $al = new AccountLine($db); - $al->dateo_next(GETPOST('rowid', 'int')); - $al->fetch(GETPOST('rowid', 'int')); + $al->dateo_next(GETPOST('rowid', 'int')); + $al->fetch(GETPOST('rowid', 'int')); - print ''.dol_print_date($db->jdate($al->dateo), "day").''; + print ''.dol_print_date($db->jdate($al->dateo), "day").''; - exit; + exit; } if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'doprev') { // Decrease date $al =new AccountLine($db); - $al->dateo_previous(GETPOST('rowid', 'int')); - $al->fetch(GETPOST('rowid', 'int')); + $al->dateo_previous(GETPOST('rowid', 'int')); + $al->fetch(GETPOST('rowid', 'int')); - print ''.dol_print_date($db->jdate($al->dateo), "day").''; + print ''.dol_print_date($db->jdate($al->dateo), "day").''; - exit; + exit; } diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index 5a3b18da55e..4e2252cee56 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -53,23 +53,23 @@ header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size'); switch ($_SERVER['REQUEST_METHOD']) { case 'OPTIONS': break; - case 'HEAD': - case 'GET': - $upload_handler->get(); - break; - case 'POST': - if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { - $upload_handler->delete(); - } else { - $upload_handler->post(); - } - break; - case 'DELETE': - $upload_handler->delete(); - break; - default: - header('HTTP/1.0 405 Method Not Allowed'); - exit; + case 'HEAD': + case 'GET': + $upload_handler->get(); + break; + case 'POST': + if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { + $upload_handler->delete(); + } else { + $upload_handler->post(); + } + break; + case 'DELETE': + $upload_handler->delete(); + break; + default: + header('HTTP/1.0 405 Method Not Allowed'); + exit; } $db->close(); diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index 0d662b6a0bd..e1a5c451ba5 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -68,4 +68,4 @@ else // Registering new values if (($action == 'set') && ! empty($id)) - $object->setValueFrom($field, $value, $element, $id); + $object->setValueFrom($field, $value, $element, $id); diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index 1cbede80339..39c2bf7b07f 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -44,8 +44,8 @@ if (isset($_GET['action']) && ! empty($_GET['action'])) { if ($_GET['action'] == 'getrandompassword' && $user->admin) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $generic = $_GET['generic'] ? true : false; + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; + $generic = $_GET['generic'] ? true : false; echo getRandomPassword($generic); } } diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php index df9f70da1df..72eb73f84e0 100644 --- a/htdocs/core/ajax/ziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -62,36 +62,36 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) if (! empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) // Use zip-town table { - $sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country"; - $sql.= ", c.rowid as fk_country, c.code as country_code, c.label as country"; - $sql.= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_ziptown as z"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON z.fk_county = d.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region,"; - $sql.= " ".MAIN_DB_PREFIX."c_country as c"; - $sql.= " WHERE z.fk_pays = c.rowid"; - $sql.= " AND z.active = 1 AND c.active = 1"; - if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'"; - if ($town) $sql.=" AND z.town LIKE '%" . $db->escape($town) . "%'"; - $sql.= " ORDER BY z.zip, z.town"; - $sql.= $db->plimit(100); // Avoid pb with bad criteria + $sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country"; + $sql.= ", c.rowid as fk_country, c.code as country_code, c.label as country"; + $sql.= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_ziptown as z"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON z.fk_county = d.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region,"; + $sql.= " ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE z.fk_pays = c.rowid"; + $sql.= " AND z.active = 1 AND c.active = 1"; + if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'"; + if ($town) $sql.=" AND z.town LIKE '%" . $db->escape($town) . "%'"; + $sql.= " ORDER BY z.zip, z.town"; + $sql.= $db->plimit(100); // Avoid pb with bad criteria } else // Use table of third parties { - $sql = "SELECT DISTINCT s.zip, s.town, s.fk_departement as fk_county, s.fk_pays as fk_country"; - $sql.= ", c.code as country_code, c.label as country"; - $sql.= ", d.code_departement as county_code , d.nom as county"; - $sql.= " FROM ".MAIN_DB_PREFIX.'societe as s'; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON s.fk_departement = d.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; - $sql.= " WHERE"; - if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'"; - if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'"; - $sql.= " ORDER BY s.fk_pays, s.zip, s.town"; - $sql.= $db->plimit(100); // Avoid pb with bad criteria + $sql = "SELECT DISTINCT s.zip, s.town, s.fk_departement as fk_county, s.fk_pays as fk_country"; + $sql.= ", c.code as country_code, c.label as country"; + $sql.= ", d.code_departement as county_code , d.nom as county"; + $sql.= " FROM ".MAIN_DB_PREFIX.'societe as s'; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON s.fk_departement = d.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; + $sql.= " WHERE"; + if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'"; + if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'"; + $sql.= " ORDER BY s.fk_pays, s.zip, s.town"; + $sql.= $db->plimit(100); // Avoid pb with bad criteria } - //print $sql; + //print $sql; $resql=$db->query($sql); //var_dump($db); if ($resql) @@ -103,11 +103,11 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) $row_array['label'] = $row['zip'].' '.$row['town']; $row_array['label'] .= ($county || $country)?' (':''; - $row_array['label'] .= $county; + $row_array['label'] .= $county; $row_array['label'] .= ($county && $country?' - ':''); - $row_array['label'] .= $country; - $row_array['label'] .= ($county || $country)?')':''; - if ($zipcode) + $row_array['label'] .= $country; + $row_array['label'] .= ($county || $country)?')':''; + if ($zipcode) { $row_array['value'] = $row['zip']; $row_array['town'] = $row['town']; diff --git a/htdocs/core/antispamimage.php b/htdocs/core/antispamimage.php index 015f4597d12..38bb261e068 100644 --- a/htdocs/core/antispamimage.php +++ b/htdocs/core/antispamimage.php @@ -43,7 +43,7 @@ $number = strlen($letters); $string = ''; for($i = 0; $i < $length; $i++) { - $string .= $letters{mt_rand(0, $number - 1)}; + $string .= $letters{mt_rand(0, $number - 1)}; } //print $string; @@ -54,8 +54,8 @@ $_SESSION[$sessionkey]=$string; $img = imagecreate(80, 32); if (empty($img)) { - dol_print_error('', "Problem with GD creation"); - exit; + dol_print_error('', "Problem with GD creation"); + exit; } // Define mime type diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index a02f00fbac9..7c1713b9453 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -47,6 +47,11 @@ class CSMSFile public $message; public $nostop; + public $socid; + public $contactid; + + public $fk_project; + /** * CSMSFile @@ -125,7 +130,12 @@ class CSMSFile $sms->class=$this->class; $sms->nostop=$this->nostop; + $sms->socid=$this->socid; + $sms->contactid=$this->contactid; + $sms->project=$this->fk_project; + $res=$sms->SmsSend(); + if ($res <= 0) { $this->error=$sms->error; @@ -155,7 +165,12 @@ class CSMSFile $sms->message=$this->message; $sms->nostop=$this->nostop; + $sms->socid=$this->socid; + $sms->contactid=$this->contactid; + $sms->fk_project=$this->fk_project; + $res=$sms->SmsSend(); + $this->error = $sms->error; $this->errors = $sms->errors; if ($res <= 0) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 04d7fc1f4a4..e1246d8bc3f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4083,6 +4083,7 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer + // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook 'formAddObjectLine'. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { @@ -4125,7 +4126,7 @@ abstract class CommonObject */ public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0, $defaulttpldir = '/core/tpl') { - global $conf, $hookmanager, $langs, $user, $object, $form, $extrafields; + global $conf, $hookmanager, $langs, $user, $form, $extrafields, $object; // TODO We should not use global var for this global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $outputalsopricetotalwithtax; @@ -4149,6 +4150,7 @@ abstract class CommonObject { // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer + // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { @@ -4215,7 +4217,7 @@ abstract class CommonObject * @param string $buyer Object of buyer third party * @param int $selected Object line selected * @param Extrafields $extrafields Object of extrafields - * @param string $defaulttpldir Directory where to find the template + * @param string $defaulttpldir Directory where to find the template (deprecated) * @return void */ public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafields = null, $defaulttpldir = '/core/tpl') @@ -4228,15 +4230,9 @@ abstract class CommonObject $element = $this->element; - $text = ''; $description = ''; $type = 0; + $text = ''; $description = ''; - // Show product and description - $type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type); - // Try to enhance type detection using date_start and date_end for free lines where type was not saved. - if (!empty($line->date_start)) $type = 1; // deprecated - if (!empty($line->date_end)) $type = 1; // deprecated - - // Ligne en mode visu + // Line in view mode if ($action != 'editline' || $selected != $line->id) { // Product @@ -4287,6 +4283,7 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer + // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook printObjectLine and printObjectSubLine. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { @@ -4312,12 +4309,12 @@ abstract class CommonObject if ($this->statut == 0 && $action == 'editline' && $selected == $line->id) { $label = (!empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : '')); - $placeholder = ' placeholder="'.$langs->trans("Label").'"'; $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer + // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook printObjectLine and printObjectSubLine. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 023a2e6dc6d..448d1ffdf8d 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -50,13 +50,13 @@ abstract class CommonObjectLine extends CommonObject public $fk_unit; - /** - * Returns the translation key from units dictionary. - * A langs->trans() must be called on result to get translated value. - * - * @param string $type Label type (long or short) - * @return string|int <0 if ko, label if ok - */ + /** + * Returns the translation key from units dictionary. + * A langs->trans() must be called on result to get translated value. + * + * @param string $type Label type (long or short) + * @return string|int <0 if ko, label if ok + */ public function getLabelOfUnit($type = 'long') { global $langs; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index a9b908203fe..94504686718 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1944,6 +1944,10 @@ class ExtraFields { $align = "right"; } + elseif ($type == 'price') + { + $align="right"; + } elseif ($type == 'double') { $align = "right"; diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 0eed1a56580..10015e3c363 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -1,5 +1,7 @@ +/* Copyright (C) 2014-2020 Alexandre Spangaro + * Copyright (C) 2020 OScss-Shop + * * * 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 @@ -381,13 +383,19 @@ class Fiscalyear extends CommonObject * @param int $dateend Date end to scan * @return string Number of entries */ - public function getAccountancyEntriesByFiscalYear($datestart, $dateend) + public function getAccountancyEntriesByFiscalYear($datestart = '', $dateend = '') { global $conf; + if(empty($datestart) ) + $datestart = $this->date_start; + if(empty($dateend) ) + $dateend = $this->date_end; + $sql = "SELECT count(DISTINCT piece_num) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping "; - $sql.= " WHERE doc_date >= '".$datestart."' and doc_date <= '".$dateend."'"; + $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; + $sql.= " WHERE entity IN (".getEntity('bookkeeping', 0).")"; + $sql.= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'"; $resql=$this->db->query($sql); if ($resql) @@ -407,13 +415,19 @@ class Fiscalyear extends CommonObject * @param int $dateend Date end to scan * @return string Number of movements */ - public function getAccountancyMovementsByFiscalYear($datestart, $dateend) + public function getAccountancyMovementsByFiscalYear($datestart = '', $dateend = '') { global $conf; + if(empty($datestart) ) + $datestart = $this->date_start; + if(empty($dateend) ) + $dateend = $this->date_end; + $sql = "SELECT count(rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping "; - $sql.= " WHERE doc_date >= '".$datestart."' AND doc_date <= '".$dateend."'"; + $sql.= " WHERE entity IN (".getEntity('bookkeeping', 0).")"; + $sql.= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'"; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 02b8529257d..f3615d4180f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -316,6 +316,33 @@ class Form return $ret; } + /** + * Output edit in place form + * + * @param string $fieldname Name of the field + * @param object $object Object + * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) + * @return string HTML code for the edit of alternative language + */ + public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string') + { + global $conf, $langs; + + $result = ''; + + if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) { + $result ='
    '; + + $s=picto_from_langcode($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); + $result .= $s; + + $result .= '
    '; + } + + return $result; + } + /** * Output edit in place form * @@ -1618,7 +1645,7 @@ class Form public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false) { // phpcs:enable - global $conf, $user, $langs; + global $conf, $user, $langs, $hookmanager; // If no preselected user defined, we take current user if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected = $user->id; @@ -1679,6 +1706,10 @@ class Form if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql .= " AND u.statut <> 0"; if (!empty($morefilter)) $sql .= " ".$morefilter; + //Add hook to filter on user (for exemple on usergroup define in custom modules) + $reshook = $hookmanager->executeHooks('addSQLWhereFilterOnSelectUsers', array(), $this, $action); + if (!empty($reshook)) $sql .= $hookmanager->resPrint; + if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname { $sql .= " ORDER BY u.firstname ASC"; @@ -3510,11 +3541,11 @@ class Form * Return list of payment methods * Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want. * - * @param string $selected Id du mode de paiement pre-selectionne - * @param string $htmlname Nom de la zone select + * @param string $selected Id or code or preselected payment mode + * @param string $htmlname Name of select field * @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz)) - * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code - * @param int $empty 1=peut etre vide, 0 sinon + * @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code + * @param int $empty 1=can be empty, 0 otherwise * @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $maxlength Max length of label * @param int $active Active or not, -1 = all @@ -3555,9 +3586,12 @@ class Form elseif ($format == 1) print '
    '.$langs->trans("Statistics").' - '.$langs->trans("Services").'
    '; + $out .= '
    '; $out .= ''; if (!empty($options)) $out .= ''; @@ -168,7 +168,7 @@ class FormFile $out .= ''; } - $out .= 'global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic') ? ' name="userfile"' : ' name="userfile[]" multiple'); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""'); diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index cc4d0d0b8e5..8abfe1470d1 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -424,7 +424,7 @@ class FormOther public function select_salesrepresentatives($selected, $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '', $norepresentative = 0) { // phpcs:enable - global $conf, $langs; + global $conf, $langs, $hookmanager; $langs->load('users'); @@ -440,6 +440,9 @@ class FormOther $out .= $comboenhancement; } } + + $reshook = $hookmanager->executeHooks('addSQLWhereFilterOnSelectSalesRep', array(), $this, $action); + // Select each sales and print them in a select input $out .= '\n"; } diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 4406d421745..c37041967c2 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -67,18 +67,18 @@ else // Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8) $tradTemp=array( - $langs->trans("January"), - $langs->trans("February"), - $langs->trans("March"), - $langs->trans("April"), - $langs->trans("May"), - $langs->trans("June"), - $langs->trans("July"), - $langs->trans("August"), - $langs->trans("September"), - $langs->trans("October"), - $langs->trans("November"), - $langs->trans("December") + $langs->trans("January"), + $langs->trans("February"), + $langs->trans("March"), + $langs->trans("April"), + $langs->trans("May"), + $langs->trans("June"), + $langs->trans("July"), + $langs->trans("August"), + $langs->trans("September"), + $langs->trans("October"), + $langs->trans("November"), + $langs->trans("December") ); print ''."\n"; - } + $pageurl = $websitepage->pageurl; + $title = $websitepage->title; + $image = $websitepage->image; + $companyname = $mysoc->name; + $description = $websitepage->description; + + $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl); + $title = str_replace('__WEBSITE_KEY__', $website->ref, $title); + $image = str_replace('__WEBSITE_KEY__', $website->ref, $image); + $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname); + $description = str_replace('__WEBSITE_KEY__', $website->ref, $description); + + $ret = ''."\n"; + $ret .= ''."\n"; } } elseif ($type == 'product') @@ -611,19 +619,19 @@ function getStructuredData($type, $data = array()) $ret .= '{ "@context": "https://schema.org/", "@type": "Product", - "name": "'.$data['label'].'", + "name": "'.dol_escape_json($data['label']).'", "image": [ - "'.$data['image'].'", + "'.dol_escape_json($data['image']).'", ], - "description": "'.$data['description'].'", - "sku": "'.$data['ref'].'", + "description": "'.dol_escape_json($data['description']).'", + "sku": "'.dol_escape_json($data['ref']).'", "brand": { "@type": "Thing", - "name": "'.$data['brand'].'" + "name": "'.dol_escape_json($data['brand']).'" }, "author": { "@type": "Person", - "name": "'.$data['author'].'" + "name": "'.dol_escape_json($data['author']).'" } }, "offers": { @@ -635,7 +643,7 @@ function getStructuredData($type, $data = array()) "availability": "https://schema.org/InStock", "seller": { "@type": "Organization", - "name": "'.$mysoc->name.'" + "name": "'.dol_escape_json($mysoc->name).'" } } }'."\n"; @@ -644,17 +652,72 @@ function getStructuredData($type, $data = array()) return $ret; } +/** + * Return HTML content to add structured data for an article, news or Blog Post. + * + * @return string HTML content + */ +function getSocialNetworkSharingLinks() +{ + global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers. + + $fullurl = $website->alias.'/'.$websitepage->pageurl.'.php'; + $hashtags = trim(join(' #', array_map('trim', explode(',', $websitepage->keywords)))); + + $out = ''."\n"; + $out.= '\n"; + $out.= ''."\n"; + + return $out; +} + /** * Return list of containers object that match a criteria. * WARNING: This function can be used by websites. * - * @param string $type Type of container to search into (Example: 'page') - * @param string $algo Algorithm used for search (Example: 'meta' is searching into meta information like title and description, 'content', 'sitefiles', or any combination, ...) + * @param string $type Type of container to search into (Example: '', 'page', 'blogpost', 'page,blogpost', ...) + * @param string $algo Algorithm used for search (Example: 'meta' is searching into meta information like title and description, 'content', 'sitefiles', or any combination 'meta,content,...') * @param string $searchstring Search string * @param int $max Max number of answers + * @param string $sortfield Sort Fields + * @param string $sortorder Sort order ('DESC' or 'ASC') * @return string HTML content */ -function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25) +function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC') { global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers. @@ -676,11 +739,17 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25) $arrayresult['code'] = 'KO'; $arrayresult['message'] = $weblangs->trans("ErrorSearchCriteriaTooSmall"); } - elseif (!in_array($type, array('', 'page'))) + else { - $error++; - $arrayresult['code'] = 'KO'; - $arrayresult['message'] = 'Bad value for parameter $type'; + $tmparrayoftype = explode(',', $type); + foreach($tmparrayoftype as $tmptype) { + if (!in_array($tmptype, array('', 'page', 'blogpost'))) { + $error++; + $arrayresult['code'] = 'KO'; + $arrayresult['message'] = 'Bad value for parameter type'; + break; + } + } } $searchdone = 0; @@ -690,7 +759,14 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25) { $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page'; $sql .= " WHERE fk_website = ".$website->id; - if ($type) $sql .= " AND type_container = '".$db->escape($type)."'"; + if ($type) { + $tmparrayoftype = explode(',', $type); + $typestring = ''; + foreach($tmparrayoftype as $tmptype) { + $typestring .= ($typestring ? ", ": "")."'".trim($tmptype)."'"; + } + $sql .= " AND type_container IN (".$typestring.")"; + } $sql .= " AND ("; $searchalgo = ''; if (preg_match('/meta/', $algo)) @@ -704,6 +780,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25) } $sql .= $searchalgo; $sql .= ")"; + $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($max); $resql = $db->query($sql); @@ -822,6 +899,7 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify $urltograb = dirname($urltograb); // So urltograb is now http://www.nltechno.com or http://www.nltechno.com/dir1 // Search X in "img...src=X" + $regs = array(); preg_match_all('/]*)>/i', $tmp, $regs); foreach ($regs[0] as $key => $val) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 89df263b026..ff0fdcae67e 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -49,7 +49,8 @@ function dolSaveMasterFile($filemaster) } /** - * Save content of a page on disk + * Save content of a page on disk. + * It can save file into root directory or into language subdirectory. * * @param string $filealias Full path of filename to generate * @param Website $object Object website @@ -98,7 +99,8 @@ function dolSavePageAlias($filealias, $object, $objectpage) /** - * Save content of a page on disk + * Save content of a page on disk. + * Page contents are always saved into root directory. * * @param string $filetpl Full path of filename to generate * @param Website $object Object website @@ -113,6 +115,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) // Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header) dol_syslog("We regenerate the tpl page filetpl=".$filetpl); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_delete_file($filetpl); $shortlangcode = ''; @@ -245,18 +248,19 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper) $indexcontent .= "include_once './".basename($filetpl)."'\n"; $indexcontent .= '// END PHP ?>'."\n"; $result1 = file_put_contents($fileindex, $indexcontent); - if (!empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) { @chmod($fileindex, octdec($conf->global->MAIN_UMASK)); + } + dol_delete_file($filewrapper); - dol_delete_file($filewrapper); + $wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.php'); - $wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.html'); + $result2 = file_put_contents($filewrapper, $wrappercontent); + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($filewrapper, octdec($conf->global->MAIN_UMASK)); + } - $result2 = file_put_contents($filewrapper, $wrappercontent); - if (!empty($conf->global->MAIN_UMASK)) - @chmod($filewrapper, octdec($conf->global->MAIN_UMASK)); - - return ($result1 && $result2); + return ($result1 && $result2); } @@ -417,7 +421,6 @@ function dolSaveReadme($file, $content) function showWebsiteTemplates(Website $website) { global $conf, $langs, $db, $form; - global $bc; $dirthemes = array('/doctemplates/websites'); if (!empty($conf->modules_parts['websitetemplates'])) // Using this feature slow down application diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index 7e7cbd9672e..ef81ecda5bf 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -330,12 +330,13 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) * @param string $format "rss" * @param string $title Title of export * @param string $desc Description of export - * @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category") + * @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category") or Array of WebsitePage * @param string $outputfile Output file * @param string $filter (optional) Filter + * @param string $url Url * @return int < 0 if ko, Nb of events in file if ok */ -function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = "") +function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '') { global $user, $conf, $langs; global $dolibarr_main_url_root; @@ -355,7 +356,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt $date = date("r"); // Print header - fwrite($fichier, 'charset_output.""?>'); + fwrite($fichier, 'charset_output.'"?>'); fwrite($fichier, "\n"); fwrite($fichier, ''); @@ -363,19 +364,22 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt fwrite($fichier, "\n".$title."\n"); - $form = ""."\n". + /* + fwrite($fichier, ""."\n". // "fr"."\n". "Dolibarr"."\n". "".$date.""."\n". - "Dolibarr"."\n"; + "Dolibarr"."\n"); + */ - // Define $urlwithroot - $urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root)); + if (empty($url)) { + // Define $urlwithroot + $urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - - $url=$urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY); + $url = $urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY); + } fwrite($fichier, ""."\n"); @@ -392,6 +396,19 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt if ($eventqualified) { + if (is_object($event) && get_class($event) == 'WebsitePage') { + // Convert object into an array + $tmpevent = array(); + $tmpevent['uid'] = $event->id; + $tmpevent['startdate'] = $event->date_creation; + $tmpevent['summary'] = $event->title; + $tmpevent['url'] = $event->urlpage.'.php'; + $tmpevent['author'] = $event->author_alias ? $event->author_alias : 'unknown'; + //$tmpevent['category'] = ''; + + $event = $tmpevent; + } + $uid = $event["uid"]; $startdate = $event["startdate"]; $summary = $event["summary"]; @@ -517,7 +534,7 @@ function calEncode($line) // Take char at position $j $char = substr($line, $j, 1); - if ((dol_strlen($newpara) + dol_strlen($char)) >= 75 ) + if ((dol_strlen($newpara) + dol_strlen($char)) >= 75) { // CRLF + Space for cal $out .= $newpara . "\r\n "; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 66ed948585f..02d97e34ee6 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -158,6 +158,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); +-- Commercial - Supplier's proposals +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'commercial', 'propals_supplier', 3__+MAX_llx_menu__, '/supplier_proposal/index.php?leftmenu=propals_supplier', 'SupplierProposalsShort', 0, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'commercial', '', 1600__+MAX_llx_menu__, '/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', 'SupplierProposalNew', 1, 'supplier_proposal', '$user->rights->supplier_proposal->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'commercial', '', 1600__+MAX_llx_menu__, '/supplier_proposal/list.php?leftmenu=supplier_proposals', 'List', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1610__+MAX_llx_menu__, 'commercial', '', 1600__+MAX_llx_menu__, '/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', 'Statistics', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 2, __ENTITY__); -- Commercial - Supplier's orders insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5100__+MAX_llx_menu__, 'commercial', 'orders_suppliers', 5__+MAX_llx_menu__, '/fourn/commande/index.php?mainmenu=commercial&leftmenu=orders_suppliers', 'SuppliersOrders', 0, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/card.php?mainmenu=commercial&action=create&leftmenu=orders_suppliers', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index eafbdaf5ddd..42b15114379 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -936,6 +936,16 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); } + // Supplier proposal + if (!empty($conf->supplier_proposal->enabled)) + { + $langs->load("supplier_proposal"); + $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300); + $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer); + $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->rights->supplier_proposal->lire); + $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->supplier_proposal->lire); + } + // Suppliers orders if (!empty($conf->supplier_order->enabled)) { diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index f2b96b2bea0..7899df494fc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -591,7 +591,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetXY($Xoff, $Yoff); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetTextColor(0, 0, 0); - $pdf->MultiCell(0, 3, $outputlangs->transnoentities("RefSending").': '.$outputlangs->convToOutputCharset($object->ref), '', 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $Xoff, 3, $outputlangs->transnoentities("RefSending").': '.$outputlangs->convToOutputCharset($object->ref), '', 'R'); //$this->Code39($Xoff+43, $Yoff+1, $object->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true); $origin = $object->origin; @@ -627,9 +627,9 @@ class pdf_merou extends ModelePdfExpedition { $Yoff += 3; $posy = $Yoff; - $pdf->SetXY(100, $posy); + $pdf->SetXY($Xoff, $posy); $pdf->SetTextColor(0, 0, 0); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $Xoff, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } // Date delivery diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 6448dcd74ef..21e636364e3 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -161,7 +161,7 @@ class modBanque extends DolibarrModules "s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company" ); $this->export_special_array[$r]=array('-b.amount'=>'NULLIFNEG','b.amount'=>'NULLIFNEG'); - if (empty($conf->fournisseur->enabled)) + if (empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || empty($conf->supplier_order->enabled) || empty($conf->supplier_invoice->enabled)) { unset($this->export_fields_array[$r]['s.code_compta_fournisseur']); unset($this->export_entities_array[$r]['s.code_compta_fournisseur']); diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 3b8a7aa3f8b..e50af779c5c 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -193,14 +193,20 @@ class modContrat extends DolibarrModules 'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); + $keyforselect='contrat'; $keyforelement='contract'; $keyforaliasextra='coextra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='contratdet'; $keyforelement='contract_line'; $keyforaliasextra='codextra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contrat as co,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contratdet as cod'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cod.fk_product = p.rowid)'; - $this->export_sql_end[$r] .=' WHERE co.fk_soc = s.rowid and co.rowid = cod.fk_contrat'; - $this->export_sql_end[$r] .=' AND co.entity IN ('.getEntity('contract').')'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid'; + $this->export_sql_end[$r] .=' INNER JOIN '.MAIN_DB_PREFIX.'contrat as co ON co.fk_soc = s.rowid'; + $this->export_sql_end[$r] .=' INNER JOIN '.MAIN_DB_PREFIX.'contratdet as cod ON co.rowid = cod.fk_contrat'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (cod.fk_product = p.rowid)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'contrat_extrafields as coextra on (co.rowid = coextra.fk_object)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'contratdet_extrafields as codextra on (cod.rowid = codextra.fk_object)'; + $this->export_sql_end[$r] .=' WHERE co.entity IN ('.getEntity('contract').')'; } diff --git a/htdocs/core/modules/modDav.class.php b/htdocs/core/modules/modDav.class.php index c4c38898566..011448395ae 100644 --- a/htdocs/core/modules/modDav.class.php +++ b/htdocs/core/modules/modDav.class.php @@ -38,9 +38,9 @@ class modDav extends DolibarrModules */ public function __construct($db) { - global $langs,$conf; + global $langs,$conf; - $this->db = $db; + $this->db = $db; // Id for module (must be unique). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). @@ -116,13 +116,13 @@ class modDav extends DolibarrModules // Array to add new pages in new tabs - $this->tabs = array(); + $this->tabs = array(); // Example: // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@dav:$user->rights->dav->read:/dav/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 - // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@dav:$user->rights->othermodule->read:/dav/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. - // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname - // - // Where objecttype can be + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@dav:$user->rights->othermodule->read:/dav/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // + // Where objecttype can be // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) // 'contact' to add a tab in contact view // 'contract' to add a tab in contract view @@ -144,9 +144,9 @@ class modDav extends DolibarrModules // 'user' to add a tab in user view - // Dictionaries + // Dictionaries $this->dictionaries=array(); - /* Example: + /* Example: $this->dictionaries=array( 'langs'=>'mylangfile@dav', 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor @@ -162,13 +162,13 @@ class modDav extends DolibarrModules */ - // Boxes/Widgets + // Boxes/Widgets // Add here list of php file(s) stored in dav/core/boxes that contains class to show a widget. - $this->boxes = array( - //0=>array('file'=>'davwidget1.php@dav','note'=>'Widget provided by dav','enabledbydefaulton'=>'Home'), - //1=>array('file'=>'davwidget2.php@dav','note'=>'Widget provided by dav'), - //2=>array('file'=>'davwidget3.php@dav','note'=>'Widget provided by dav') - ); + $this->boxes = array( + //0=>array('file'=>'davwidget1.php@dav','note'=>'Widget provided by dav','enabledbydefaulton'=>'Home'), + //1=>array('file'=>'davwidget2.php@dav','note'=>'Widget provided by dav'), + //2=>array('file'=>'davwidget3.php@dav','note'=>'Widget provided by dav') + ); // Cronjobs (List of cron jobs entries to add when module is enabled) @@ -262,7 +262,7 @@ class modDav extends DolibarrModules * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * It also creates data directories * - * @param string $options Options when enabling module ('', 'noboxes') + * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ public function init($options = '') diff --git a/htdocs/core/modules/modExport.class.php b/htdocs/core/modules/modExport.class.php index fb066ef2057..cc0a4eba23c 100644 --- a/htdocs/core/modules/modExport.class.php +++ b/htdocs/core/modules/modExport.class.php @@ -45,7 +45,7 @@ class modExport extends DolibarrModules $this->family = "technic"; $this->module_position = '72'; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Outils d'exports de donnees Dolibarr (via un assistant)"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 984e28f4e31..991cd571f3e 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -216,7 +216,7 @@ class modFacture extends DolibarrModules 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT", - 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', + 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LT1', 'f.localtax2'=>'LT2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', 'none.rest'=>'Rest', 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", @@ -303,7 +303,7 @@ class modFacture extends DolibarrModules 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT", - 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', + 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LT1', 'f.localtax2'=>'LT2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', 'none.rest'=>'Rest', 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'p.rowid'=>'PaymentId', 'p.ref'=>'PaymentRef', diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 45a89032fa6..d35b5441468 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -51,7 +51,7 @@ class modHRM extends DolibarrModules $this->version = 'development'; $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); - // Name of image file used for this module. + // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' $this->picto='generic'; diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php index 6071f04fc44..3136d1554b0 100644 --- a/htdocs/core/modules/modImport.class.php +++ b/htdocs/core/modules/modImport.class.php @@ -44,8 +44,8 @@ class modImport extends DolibarrModules $this->numero = 250; $this->family = "technic"; - $this->module_position = '70'; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) + $this->module_position = '70'; + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Outils d'imports de donnees Dolibarr (via un assistant)"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version @@ -57,7 +57,7 @@ class modImport extends DolibarrModules $this->dirs = array("/import/temp"); // Config pages - $this->config_page_url = array(); + $this->config_page_url = array("import.php"); // Dependencies $this->hidden = false; // A condition to hide module diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index aca3f4686e5..226585010d0 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -105,17 +105,17 @@ class modMargin extends DolibarrModules // left menu entry $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>'Margins', - 'mainmenu'=>'billing', - 'leftmenu'=>'margins', - 'url'=>'/margin/index.php', - 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>100, - 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + 'type'=>'left', // This is a Top menu entry + 'titre'=>'Margins', + 'mainmenu'=>'billing', + 'leftmenu'=>'margins', + 'url'=>'/margin/index.php', + 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>100, + 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. + 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; // Permissions diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index e2d071ac730..5980ae73bab 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -144,58 +144,6 @@ class modSupplierProposal extends DolibarrModules // Main menu entries $this->menu = array(); // List of menus to add $r=0; - $this->menu[$r]=array( - 'fk_menu'=>'fk_mainmenu=commercial', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'SupplierProposalsShort', - 'leftmenu'=>'supplier_proposalsubmenu', - 'url'=>'/supplier_proposal/index.php', - 'langs'=>'supplier_proposal', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'enabled'=>'$conf->supplier_proposal->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->supplier_proposal->lire', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both - 'position'=>300 - ); - $r++; - - $this->menu[$r]=array( - 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', - 'type'=>'left', - 'titre'=>'SupplierProposalNew', - 'url'=>'/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', - 'langs'=>'supplier_proposal', - 'enabled'=>'$conf->supplier_proposal->enabled', - 'perms'=>'$user->rights->supplier_proposal->creer', - 'user'=>2, - 'position'=>301 - ); - $r++; - - $this->menu[$r]=array( - 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', - 'type'=>'left', - 'titre'=>'List', - 'url'=>'/supplier_proposal/list.php?leftmenu=supplier_proposals', - 'langs'=>'supplier_proposal', - 'enabled'=>'$conf->supplier_proposal->enabled', - 'perms'=>'$user->rights->supplier_proposal->lire', - 'user'=>2, - 'position'=>302 - ); - $r++; - - $this->menu[$r]=array( - 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', - 'type'=>'left', - 'titre'=>'Statistics', - 'url'=>'/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', - 'langs'=>'supplier_proposal', - 'enabled'=>'$conf->supplier_proposal->enabled', - 'perms'=>'$user->rights->supplier_proposal->lire', - 'user'=>2, - 'position'=>303 - ); - $r++; } diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 4671f40dd40..8357cb42b2d 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -217,7 +217,7 @@ class modTakePos extends DolibarrModules 'titre'=>'PointOfSaleShort', 'mainmenu'=>'takepos', 'leftmenu'=>'', - 'url'=>'/takepos/takepos.php', + 'url'=>'/takepos/index.php', 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>1000 + $r, 'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled. diff --git a/htdocs/core/modules/oauth/stripetest_oauthcallback.php b/htdocs/core/modules/oauth/stripetest_oauthcallback.php index e56f0dffa39..f31a38275f3 100644 --- a/htdocs/core/modules/oauth/stripetest_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripetest_oauthcallback.php @@ -65,9 +65,9 @@ $storage = new DoliStorage($db, $conf); // Setup the credentials for the requests $credentials = new Credentials( - $conf->global->OAUTH_STRIPE_TEST_ID, + $conf->global->OAUTH_STRIPE_TEST_ID, $conf->global->STRIPE_TEST_SECRET_KEY, - $currentUri->getAbsoluteUri() + $currentUri->getAbsoluteUri() ); $requestedpermissionsarray=array(); @@ -99,12 +99,12 @@ $langs->load("oauth"); if ($action == 'delete') { - $storage->clearToken('StripeTest'); + $storage->clearToken('StripeTest'); - setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); + setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); - header('Location: ' . $backtourl); - exit(); + header('Location: ' . $backtourl); + exit(); } if (! empty($_GET['code'])) // We are coming from oauth provider page @@ -113,60 +113,60 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) dol_syslog("We are coming from the oauth provider page"); - //llxHeader('',$langs->trans("OAuthSetup")); + //llxHeader('',$langs->trans("OAuthSetup")); - //$linkback=''.$langs->trans("BackToModuleList").''; - //print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); + //$linkback=''.$langs->trans("BackToModuleList").''; + //print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); - //dol_fiche_head(); - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - //print '
    '.$options.'
    '; + //dol_fiche_head(); + // retrieve the CSRF state parameter + $state = isset($_GET['state']) ? $_GET['state'] : null; + //print '
    '; - // This was a callback request from service, get the token - try { - //var_dump($_GET['code']); - //var_dump($state); - //var_dump($apiService); // OAuth\OAuth2\Service\GitHub + // This was a callback request from service, get the token + try { + //var_dump($_GET['code']); + //var_dump($state); + //var_dump($apiService); // OAuth\OAuth2\Service\GitHub - //$token = $apiService->requestAccessToken($_GET['code'], $state); - $token = $apiService->requestAccessToken($_GET['code']); - // Github is a service that does not need state to be stored. - // Into constructor of GitHub, the call - // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri) - // has not the ending parameter to true like the Google class constructor. + //$token = $apiService->requestAccessToken($_GET['code'], $state); + $token = $apiService->requestAccessToken($_GET['code']); + // Github is a service that does not need state to be stored. + // Into constructor of GitHub, the call + // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri) + // has not the ending parameter to true like the Google class constructor. - setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token + setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token - $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; - unset($_SESSION["backtourlsavedbeforeoauthjump"]); + $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; + unset($_SESSION["backtourlsavedbeforeoauthjump"]); - header('Location: ' . $backtourl); - exit(); - } catch (Exception $e) { - print $e->getMessage(); - } + header('Location: ' . $backtourl); + exit(); + } catch (Exception $e) { + print $e->getMessage(); + } } else // If entry on page with no parameter, we arrive here { - $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; + $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; - // This may create record into oauth_state before the header redirect. - // Creation of record with state in this tables depend on the Provider used (see its constructor). - if (GETPOST('state')) - { - $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); - } - else - { - //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated - //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write - $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_TEST_ID.'&scope=read_write'; - } + // This may create record into oauth_state before the header redirect. + // Creation of record with state in this tables depend on the Provider used (see its constructor). + if (GETPOST('state')) + { + $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); + } + else + { + //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated + //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write + $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_TEST_ID.'&scope=read_write'; + } - // we go on oauth provider authorization page - header('Location: ' . $url); - exit(); + // we go on oauth provider authorization page + header('Location: ' . $url); + exit(); } diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 7393f0e198d..163ba420fc7 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -181,8 +181,7 @@ class pdf_paiement switch ($this->doc_type) { case "client": $sql = "SELECT p.datep as dp, f.ref"; - //$sql .= ", c.libelle as paiement_type, p.num_paiement"; - $sql.= ", c.code as paiement_code, p.num_paiement"; + $sql.= ", c.code as paiement_code, p.num_paiement as num_payment"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", pf.amount as pf_amount"; if (! empty($conf->banque->enabled)) @@ -212,8 +211,7 @@ class pdf_paiement break; case "fourn": $sql = "SELECT p.datep as dp, f.ref as ref"; - //$sql .= ", c.libelle as paiement_type, p.num_paiement"; - $sql.= ", c.code as paiement_code, p.num_paiement"; + $sql.= ", c.code as paiement_code, p.num_paiement as num_payment"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", pf.amount as pf_amount"; if (! empty($conf->banque->enabled)) @@ -257,7 +255,7 @@ class pdf_paiement $lines[$i][0] = $objp->ref; $lines[$i][1] = dol_print_date($this->db->jdate($objp->dp), "day", false, $outputlangs, true); $lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code); - $lines[$i][3] = $objp->num_paiement; + $lines[$i][3] = $objp->num_payment; $lines[$i][4] = price($objp->paiement_amount); $lines[$i][5] = price($objp->facture_amount); $lines[$i][6] = price($objp->pf_amount); diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 3b4a39288ea..c97d2f94d63 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -330,11 +330,20 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } // Recipient name + $contactobject = null; if (!empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; - else $socobject = $object->thirdparty; + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) + { + $socobject = $object->contact; + } + else + { + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } } else { @@ -405,7 +414,10 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); $array_other = $this->get_substitutionarray_other($outputlangs); - $tmparray = array_merge($substitutionarray, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other); + $array_thirdparty_contact = array(); + if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); + + $tmparray = array_merge($substitutionarray, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook diff --git a/htdocs/core/modules/syslog/logHandler.php b/htdocs/core/modules/syslog/logHandler.php index 39593fc065d..ca213b537cf 100644 --- a/htdocs/core/modules/syslog/logHandler.php +++ b/htdocs/core/modules/syslog/logHandler.php @@ -90,7 +90,7 @@ class LogHandler /** * Set current ident. * - * @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1 + * @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1 * @return void */ public function setIdent($ident) diff --git a/htdocs/core/search.php b/htdocs/core/search.php index 1408aca1b70..b25b65b1c43 100644 --- a/htdocs/core/search.php +++ b/htdocs/core/search.php @@ -125,19 +125,19 @@ if (GETPOST('search_project') != '') } if (GETPOST('search_task') != '') { - header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task'))); - exit; + header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task'))); + exit; } if (GETPOST('search_user') != '') { - header("Location: ".DOL_URL_ROOT.'/user/list.php?mode=search&sall='.urlencode(GETPOST('search_user'))); - exit; + header("Location: ".DOL_URL_ROOT.'/user/list.php?mode=search&sall='.urlencode(GETPOST('search_user'))); + exit; } if (GETPOST('search_group') != '') { - header("Location: ".DOL_URL_ROOT.'/user/group/list.php?mode=search&sall='.urlencode(GETPOST('search_group'))); - exit; + header("Location: ".DOL_URL_ROOT.'/user/group/list.php?mode=search&sall='.urlencode(GETPOST('search_group'))); + exit; } diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 194afb86d92..1e25fb1ef7d 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -71,34 +71,34 @@ $searchform = ''; if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile { - if (! is_object($form)) $form=new Form($db); - $selected=-1; - $searchform.='

    '.$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'minwidth300', 1, $langs->trans("Search"), 0); + if (! is_object($form)) $form=new Form($db); + $selected=-1; + $searchform.='

    '.$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'minwidth300', 1, $langs->trans("Search"), 0); } else { - $usedbyinclude = 1; // Used into next include + $usedbyinclude = 1; // Used into next include $showtitlebefore = GETPOST('showtitlebefore', 'int'); include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; $i=0; - $accesskeyalreadyassigned=array(); - foreach($arrayresult as $key => $val) - { - $tmp=explode('?', $val['url']); - $urlaction=$tmp[0]; - $keysearch='search_all'; + $accesskeyalreadyassigned=array(); + foreach($arrayresult as $key => $val) + { + $tmp=explode('?', $val['url']); + $urlaction=$tmp[0]; + $keysearch='search_all'; - $accesskey=''; - if (! $accesskeyalreadyassigned[$val['label'][0]]) - { - $accesskey=$val['label'][0]; - $accesskeyalreadyassigned[$accesskey]=$accesskey; - } - $searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('', $val['img'], '', 0, 1), $showtitlebefore, ($i>0?0:1)); + $accesskey=''; + if (! $accesskeyalreadyassigned[$val['label'][0]]) + { + $accesskey=$val['label'][0]; + $accesskeyalreadyassigned[$accesskey]=$accesskey; + } + $searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('', $val['img'], '', 0, 1), $showtitlebefore, ($i>0?0:1)); - $i++; - } + $i++; + } } // Execute hook printSearchForm diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index eca100731ac..d1b7dc429aa 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -19,6 +19,8 @@ * This template needs: * $object * $withproject (if we are on task contact) + * + * $preselectedtypeofcontact may be defined or not */ // Protection to avoid direct call of template @@ -28,6 +30,10 @@ if (empty($object) || !is_object($object)) exit; } +if (empty($preselectedtypeofcontact)) { + $preselectedtypeofcontact = 0; +} + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; @@ -60,14 +66,14 @@ $userstatic = new User($db); ?> -
    -
    -
    - + print '
    '."\n"; + print '
    '."\n"; + print '
    '."\n"; + + ?>
    trans("NatureOfContact"); ?>
    trans("ThirdParty"); ?>
    @@ -140,9 +146,10 @@ if ($permission)
    element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc; - $formcompany->selectTypeContact($tmpobject, '', 'type', 'external', 'position', 0, 'minwidth100imp'); ?> + $formcompany->selectTypeContact($tmpobject, $preselectedtypeofcontact, 'type', 'external', 'position', 0, 'minwidth100imp'); + ?>
     
    @@ -152,9 +159,11 @@ if ($permission) "; + print "
    "; } -print "
    "; /** * Prepare list diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 59f2e1ef57c..ee1d85e3b54 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -35,7 +35,7 @@ * $object_rights->creer initialized from = $object->getRights() * $disableedit, $disablemove, $disableremove * - * $type, $text, $description, $line + * $text, $description, $line */ // Protection to avoid direct call of template @@ -127,6 +127,7 @@ else } else { + $type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type); if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); diff --git a/htdocs/datapolicy/admin/setupmail.php b/htdocs/datapolicy/admin/setupmail.php index 790b69847d7..dbb55a71b52 100644 --- a/htdocs/datapolicy/admin/setupmail.php +++ b/htdocs/datapolicy/admin/setupmail.php @@ -34,13 +34,13 @@ $backtopage = GETPOST('backtopage', 'alpha'); $formadmin = new FormAdmin($db); if (GETPOST('l')) { - $l = GETPOST('l'); + $l = GETPOST('l'); } else { - $l = $langs->defaultlang; + $l = $langs->defaultlang; } // Access control if (!$user->admin) - accessforbidden(); + accessforbidden(); /* * Actions @@ -49,28 +49,28 @@ if (!$user->admin) include DOL_DOCUMENT_ROOT . '/core/actions_setmoduleoptions.inc.php'; if ($action == 'setvalue' && $user->admin) { - $db->begin(); - $sub = "DATAPOLICIESSUBJECT_" . $l; - $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); - $cont = "DATAPOLICIESCONTENT_" . $l; - $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); - $cont = "TXTLINKDATAPOLICIESACCEPT_" . $l; - $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); - $cont = "TXTLINKDATAPOLICIESREFUSE_" . $l; - $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); - $sub = "DATAPOLICIESACCEPT_" . $l; - $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); - $sub = "DATAPOLICIESREFUSE_" . $l; - $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); - if (!$result > 0) - $error++; - if (!$error) { - $db->commit(); - setEventMessage($langs->trans("SetupSaved")); - } else { - $db->rollback(); - dol_print_error($db); - } + $db->begin(); + $sub = "DATAPOLICIESSUBJECT_" . $l; + $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); + $cont = "DATAPOLICIESCONTENT_" . $l; + $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); + $cont = "TXTLINKDATAPOLICIESACCEPT_" . $l; + $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); + $cont = "TXTLINKDATAPOLICIESREFUSE_" . $l; + $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); + $sub = "DATAPOLICIESACCEPT_" . $l; + $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); + $sub = "DATAPOLICIESREFUSE_" . $l; + $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); + if (!$result > 0) + $error++; + if (!$error) { + $db->commit(); + setEventMessage($langs->trans("SetupSaved")); + } else { + $db->rollback(); + dol_print_error($db); + } } @@ -105,9 +105,9 @@ print '' print ''; print '
    '; if ($conf->global->MAIN_MULTILANGS) { - print ''; + print ''; } $subject = 'DATAPOLICIESSUBJECT_' . $l; $linka = 'TXTLINKDATAPOLICIESACCEPT_' . $l; diff --git a/htdocs/don/admin/donation_extrafields.php b/htdocs/don/admin/donation_extrafields.php index 20d44edbd83..5330bb71215 100644 --- a/htdocs/don/admin/donation_extrafields.php +++ b/htdocs/don/admin/donation_extrafields.php @@ -76,9 +76,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
    '; - print ''; - print "
    "; + print '
    '; + print ''; + print "
    "; } @@ -90,10 +90,10 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
    "; - print load_fiche_titre($langs->trans('NewAttribute')); + print "
    "; + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -103,10 +103,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
    "; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
    "; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 777320a9d96..8260656e4d0 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -178,7 +178,7 @@ class Don extends CommonObject } $statusType = 'status'.$status; - if ($status == self::STATUS_CANCELED) $statusType = 'status5'; + if ($status == self::STATUS_CANCELED) $statusType = 'status9'; if ($status == self::STATUS_PAID) $statusType = 'status6'; return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); diff --git a/htdocs/don/index.php b/htdocs/don/index.php index 39155dae768..3f74cfa53a1 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -118,6 +118,10 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles } } +$dataseries = array(); +$colorseries = array(); + +include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; print '
    ' . $form->editfieldkey('DefaultLang', 'default_lang', '', null, 0) . '' . "\n"; - print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); - print '
    ' . $form->editfieldkey('DefaultLang', 'default_lang', '', null, 0) . '' . "\n"; + print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); + print '
    '; print ''; @@ -128,6 +132,10 @@ $listofstatus = array(0, 1, -1, 2); foreach ($listofstatus as $status) { $dataseries[] = array($donstatic->LibStatut($status, 1), (isset($nb[$status]) ? (int) $nb[$status] : 0)); + if ($status == Don::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == Don::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; + if ($status == Don::STATUS_CANCELED) $colorseries[$status] = $badgeStatus9; + if ($status == Don::STATUS_PAID) $colorseries[$status] = $badgeStatus6; } if ($conf->use_javascript_ajax) @@ -137,6 +145,7 @@ if ($conf->use_javascript_ajax) include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); diff --git a/htdocs/ecm/ajax/ecmdatabase.php b/htdocs/ecm/ajax/ecmdatabase.php index 7841f17c1c9..754f68a9930 100644 --- a/htdocs/ecm/ajax/ecmdatabase.php +++ b/htdocs/ecm/ajax/ecmdatabase.php @@ -162,10 +162,10 @@ if (isset($action) && ! empty($action)) } } - // Loop now on each sql tree to check if dir exists - foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk - { - $dirtotest=$conf->$element->dir_output.'/'.$dirdesc['fullrelativename']; + // Loop now on each sql tree to check if dir exists + foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk + { + $dirtotest=$conf->$element->dir_output.'/'.$dirdesc['fullrelativename']; if (! dol_is_dir($dirtotest)) { $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
    \n"; @@ -173,7 +173,7 @@ if (isset($action) && ! empty($action)) $ecmdirtmp->delete($user, 'databaseonly'); //exit; } - } + } $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" dol_syslog("sql = ".$sql); diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index 55aeeda5f90..3793be8a784 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -108,27 +108,27 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 0, 0, $_FILES['userfile']['error']); if (is_numeric($resupload) && $resupload > 0) { - $result=$ecmdir->changeNbOfFiles('+'); - } - else - { + $result=$ecmdir->changeNbOfFiles('+'); + } + else + { $langs->load("errors"); if ($resupload < 0) // Unknown error { setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors'); } elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) { - // Files infected by a virus + // Files infected by a virus setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors'); } else // Known error { setEventMessages($langs->trans($resupload), null, 'errors'); } - } + } } else { - // Failed transfer (exceeding the limit file?) + // Failed transfer (exceeding the limit file?) $langs->load("errors"); setEventMessages($langs->trans("ErrorFailToCreateDir", $upload_dir), null, 'errors'); } @@ -137,13 +137,13 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) // Remove file if ($action == 'confirm_deletefile' && $confirm == 'yes') { - $langs->load("other"); - $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - $ret=dol_delete_file($file); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + $langs->load("other"); + $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $ret=dol_delete_file($file); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - $result=$ecmdir->changeNbOfFiles('-'); + $result=$ecmdir->changeNbOfFiles('-'); } // Remove dir @@ -197,21 +197,21 @@ if ($action == 'update' && ! GETPOST('cancel', 'alpha')) { $error=0; - if ($module == 'ecm') - { - $oldlabel=$ecmdir->label; + if ($module == 'ecm') + { + $oldlabel=$ecmdir->label; $olddir=$ecmdir->getRelativePath(0); $olddir=$conf->ecm->dir_output.'/'.$olddir; - } - else - { - $olddir=GETPOST('section', 'alpha'); - $olddir=$conf->medias->multidir_output[$conf->entity].'/'.$relativepath; - } + } + else + { + $olddir=GETPOST('section', 'alpha'); + $olddir=$conf->medias->multidir_output[$conf->entity].'/'.$relativepath; + } - if ($module == 'ecm') - { - $db->begin(); + if ($module == 'ecm') + { + $db->begin(); // Fetch was already done $ecmdir->label = dol_sanitizeFileName(GETPOST("label")); @@ -252,27 +252,27 @@ if ($action == 'update' && ! GETPOST('cancel', 'alpha')) $db->rollback(); setEventMessages($ecmdir->error, $ecmdir->errors, 'errors'); } - } - else - { - $newdir = $conf->medias->multidir_output[$conf->entity].'/'.GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha'); + } + else + { + $newdir = $conf->medias->multidir_output[$conf->entity].'/'.GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha'); - $result=@rename($olddir, $newdir); - if (! $result) - { - $langs->load('errors'); - setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors'); - $error++; - } + $result=@rename($olddir, $newdir); + if (! $result) + { + $langs->load('errors'); + setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors'); + $error++; + } - if (! $error) - { - // Set new value after renaming - $relativepath=GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha'); - $upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath; - $section = $relativepath; - } - } + if (! $error) + { + // Set new value after renaming + $relativepath=GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha'); + $upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath; + $section = $relativepath; + } + } } @@ -435,7 +435,7 @@ if ($ecmdir->id > 0) // Test if nb is same than in cache if ($nbofiles != $ecmdir->cachenbofdoc) { - $ecmdir->changeNbOfFiles((string) $nbofiles); + $ecmdir->changeNbOfFiles((string) $nbofiles); } } print ''; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index b465297fe34..d539835d309 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2012,7 +2012,7 @@ elseif ($id || $ref) if ($action == 'editline') { print ' - + diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 146f4b54962..8c624f4a0fa 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -260,6 +260,7 @@ if ($id > 0 || !empty($ref)) // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl')); + $preselectedtypeofcontact = dol_getIdFromCode($db, 'SHIPPING', 'c_type_contact', 'code', 'rowid'); foreach ($dirtpls as $reldir) { $res = @include dol_buildpath($reldir.'/contacts.tpl.php'); diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 8c60c194c8b..0411004c6d5 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -68,6 +68,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele /* * Shipments to validate */ + $clause = " WHERE "; $sql = "SELECT e.rowid, e.ref, e.ref_customer,"; @@ -91,12 +92,14 @@ $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); + + print '
    '; + print '
    '; + print ''; + print ''; + if ($num) { - print '
    '; - print '
    '.$langs->trans("SendingsToValidate").'
    '; - print ''; - print ''; $i = 0; while ($i < $num) { @@ -117,132 +120,23 @@ if ($resql) print ''; $i++; } - print "
    '.$langs->trans("SendingsToValidate").'

    "; - } -} - - -/* - * Commandes a traiter - */ -$sql = "SELECT c.rowid, c.ref, c.ref_client as ref_customer, c.fk_statut, s.nom as name, s.rowid as socid"; -$sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; -$sql.= " ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE c.fk_soc = s.rowid"; -$sql.= " AND c.entity = ".$conf->entity; -$sql.= " AND c.fk_statut = 1"; -if ($socid) $sql.= " AND c.fk_soc = ".$socid; -if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -$sql.= " ORDER BY c.rowid ASC"; - -$resql=$db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - if ($num) + } else { - $langs->load("orders"); - - $i = 0; - print '
    '; - print ''; - print ''; - print ''; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $orderstatic->id=$obj->rowid; - $orderstatic->ref=$obj->ref; - $orderstatic->ref_customer=$obj->ref_customer; - $orderstatic->statut=$obj->fk_statut; - $orderstatic->billed=0; - - $companystatic->name=$obj->name; - $companystatic->id=$obj->socid; - - print ''; - print ''; - print ''; - print ''; - print ''; - $i++; - } - print "
    '.$langs->trans("OrdersToProcess").'
    '; - print $orderstatic->getNomUrl(1); - print ''; - print $companystatic->getNomUrl(1, 'customer', 32); - print ''; - print $orderstatic->getLibStatut(3); - print '

    "; + print '
    '.$langs->trans("None").'

    "; } + //print ''; print '
    '; +$max = 5; /* - * Commandes en traitement - */ -$sql = "SELECT c.rowid, c.ref, c.ref_client as ref_customer, c.fk_statut as status, c.facture as billed, s.nom as name, s.rowid as socid"; -$sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; -$sql.= " ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE c.fk_soc = s.rowid"; -$sql.= " AND c.entity = ".$conf->entity; -$sql.= " AND c.fk_statut = 2"; -if ($socid) $sql.= " AND c.fk_soc = ".$socid; -if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - -$resql = $db->query($sql); -if ( $resql ) -{ - $langs->load("orders"); - - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - print '
    '; - print ''; - print ''; - print ''; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $orderstatic->id=$obj->rowid; - $orderstatic->ref=$obj->ref; - $orderstatic->ref_customer=$obj->ref_customer; - $orderstatic->statut=$obj->status; - $orderstatic->billed=$obj->billed; - - $companystatic->name=$obj->name; - $companystatic->id=$obj->socid; - - print ''; - print ''; - print ''; - print ''; - $i++; - } - print "
    '.$langs->trans("OrdersInProcess").'
    '; - print $orderstatic->getNomUrl(1); - print ''; - print $companystatic->getNomUrl(1, 'customer'); - print ''; - print $orderstatic->getLibStatut(3); - print '

    "; - } -} -else dol_print_error($db); - - -/* - * Last shipments + * Latest shipments */ $sql = "SELECT e.rowid, e.ref, e.ref_customer,"; $sql.= " s.nom as name, s.rowid as socid,"; @@ -254,10 +148,10 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; $sql.= " WHERE e.entity IN (".getEntity('expedition').")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND sc.fk_user = " .$user->id; -$sql.= " AND e.fk_statut = 1"; +$sql.= " AND e.fk_statut = ".Expedition::STATUS_VALIDATED; if ($socid) $sql.= " AND c.fk_soc = ".$socid; $sql.= " ORDER BY e.date_delivery DESC"; -$sql.= $db->plimit(5, 0); +$sql.= $db->plimit($max, 0); $resql = $db->query($sql); if ($resql) @@ -266,10 +160,10 @@ if ($resql) if ($num) { $i = 0; - print '
    '; + print '
    '; print ''; print ''; - print ''; + print ''; while ($i < $num) { $obj = $db->fetch_object($resql); @@ -289,8 +183,11 @@ if ($resql) $orderstatic->ref=$obj->commande_ref; print $orderstatic->getNomUrl(1); } - else print ' '; - print ''; + print ''; + print ''; + print ''; $i++; } print "
    '.$langs->trans("LastSendings", $num).'
    '.$langs->trans("LastSendings", $num).'
    '; + + print '

    "; @@ -299,6 +196,72 @@ if ($resql) } else dol_print_error($db); +/* + * Open orders + */ +$sql = "SELECT c.rowid, c.ref, c.ref_client as ref_customer, c.fk_statut as status, c.facture as billed, s.nom as name, s.rowid as socid"; +$sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; +$sql.= " ".MAIN_DB_PREFIX."societe as s"; +if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= " WHERE c.fk_soc = s.rowid"; +$sql.= " AND c.entity IN (".getEntity('order').")"; +$sql.= " AND c.fk_statut IN (".Commande::STATUS_VALIDATED.", ".Commande::STATUS_ACCEPTED.")"; +if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid; +if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +$sql.= " ORDER BY c.rowid ASC"; + +$resql = $db->query($sql); +if ( $resql ) +{ + $langs->load("orders"); + + $num = $db->num_rows($resql); + if ($num) + { + $i = 0; + print '
    '; + print ''; + print ''; + print ''; + while ($i < $num && $i < 10) + { + $obj = $db->fetch_object($resql); + + $orderstatic->id=$obj->rowid; + $orderstatic->ref=$obj->ref; + $orderstatic->ref_customer=$obj->ref_customer; + $orderstatic->statut=$obj->status; + $orderstatic->billed=$obj->billed; + + $companystatic->name=$obj->name; + $companystatic->id=$obj->socid; + + print ''; + print ''; + print ''; + print ''; + $i++; + } + + if ($i < $num) { + print ''; + print ''; + print ''; + print ''; + print ''; + } + + print "
    '.$langs->trans("OrdersToProcess").' '.$num.'
    '; + print $orderstatic->getNomUrl(1); + print ''; + print $companystatic->getNomUrl(1, 'customer', 32); + print ''; + print $orderstatic->getLibStatut(3); + print '
    '.$langs->trans("More").'...

    "; + } +} +else dol_print_error($db); + print '
    '; diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index f6642de917f..3204e5361ec 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -341,7 +341,7 @@ print ''; */ print '
    '; -print ''.$langs->trans("StatsOnShipmentsOnlyValidated").''; +print ''.$langs->trans("StatsOnShipmentsOnlyValidated").''; // End of page llxFooter(); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 79e418206a5..77c2cf07f8e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2029,7 +2029,8 @@ else $paymentexpensereportstatic->id = $objp->rowid; $paymentexpensereportstatic->datepaye = $db->jdate($objp->dp); $paymentexpensereportstatic->ref = $objp->rowid; - $paymentexpensereportstatic->num_paiement = $objp->num_paiement; + $paymentexpensereportstatic->num_paiement = $objp->num_payment; + $paymentexpensereportstatic->num_payment = $objp->num_payment; $paymentexpensereportstatic->payment_code = $objp->payment_code; print ''; diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php index 715530e9199..bb48b8cf70a 100644 --- a/htdocs/expensereport/info.php +++ b/htdocs/expensereport/info.php @@ -60,7 +60,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $morehtmlref='
    '; - $morehtmlref.='
    '; + $morehtmlref.='
    '; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -71,12 +71,12 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; - dol_print_object_info($object); - print '
    '; + dol_print_object_info($object); + print ''; - print '
    '; + print '
    '; - dol_fiche_end(); + dol_fiche_end(); } // End of page diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php index a5038b32b0e..d01e2a56ba3 100644 --- a/htdocs/expensereport/note.php +++ b/htdocs/expensereport/note.php @@ -81,13 +81,13 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; $morehtmlref='
    '; - $morehtmlref.='
    '; + $morehtmlref.=''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
    '; - print '
    '; + print '
    '; + print '
    '; $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 60ab9001972..359f49f2dea 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -211,7 +211,9 @@ print '
    '; // Show filter box print ''; +print ''; print ''; + print ''; print ''; // Company diff --git a/htdocs/externalsite/admin/externalsite.php b/htdocs/externalsite/admin/externalsite.php index 92eaeee2188..aedf86927d1 100644 --- a/htdocs/externalsite/admin/externalsite.php +++ b/htdocs/externalsite/admin/externalsite.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; if (!$user->admin) - accessforbidden(); + accessforbidden(); // Load translation files required by the page $langs->loadLangs(array('admin', 'other', 'externalsite')); @@ -45,26 +45,26 @@ $action = GETPOST('action', 'alpha'); // Sauvegardes parametres if ($action == 'update') { - $i=0; + $i=0; - $db->begin(); + $db->begin(); $label = GETPOST('EXTERNALSITE_LABEL', 'alpha'); - $exturl = GETPOST('EXTERNALSITE_URL', 'none'); + $exturl = GETPOST('EXTERNALSITE_URL', 'none'); - $i+=dolibarr_set_const($db, 'EXTERNALSITE_LABEL', trim($label), 'chaine', 0, '', $conf->entity); - $i+=dolibarr_set_const($db, 'EXTERNALSITE_URL', trim($exturl), 'chaine', 0, '', $conf->entity); + $i+=dolibarr_set_const($db, 'EXTERNALSITE_LABEL', trim($label), 'chaine', 0, '', $conf->entity); + $i+=dolibarr_set_const($db, 'EXTERNALSITE_URL', trim($exturl), 'chaine', 0, '', $conf->entity); - if ($i >= 2) - { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - $db->rollback(); - setEventMessages($db->lasterror(), null, 'errors'); - } + if ($i >= 2) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($db->lasterror(), null, 'errors'); + } } diff --git a/htdocs/externalsite/frames.php b/htdocs/externalsite/frames.php index 259d8b3b50d..9d68e626613 100644 --- a/htdocs/externalsite/frames.php +++ b/htdocs/externalsite/frames.php @@ -129,7 +129,7 @@ else "; print ''; print " diff --git a/htdocs/fichinter/admin/fichinter_extrafields.php b/htdocs/fichinter/admin/fichinter_extrafields.php index 9ccf2cf56f4..b4c4d2c6325 100644 --- a/htdocs/fichinter/admin/fichinter_extrafields.php +++ b/htdocs/fichinter/admin/fichinter_extrafields.php @@ -79,9 +79,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '<div class="tabsAction">'; - print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; - print "</div>"; + print '<div class="tabsAction">'; + print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; + print "</div>"; } @@ -96,7 +96,7 @@ if ($action == 'create') print '<br><div id="newattrib"></div>'; print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -106,10 +106,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "<br>"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "<br>"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php index a6f12835420..0697027a027 100644 --- a/htdocs/fichinter/info.php +++ b/htdocs/fichinter/info.php @@ -47,8 +47,8 @@ $object = new Fichinter($db); if (! $object->fetch($id, $ref) > 0) { - dol_print_error($db); - exit; + dol_print_error($db); + exit; } diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 78f3289d638..d2efb5bb3ed 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -225,7 +225,9 @@ print '<div class="fichecenter"><div class="fichethirdleft">'; //{ // Show filter box print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; + print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="mode" value="'.$mode.'">'; + print '<table class="noborder centpercent">'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; // Company diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 204471bc9e7..65ae5677c87 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -388,7 +388,7 @@ class SupplierInvoices extends DolibarrApi * @param int $paiementid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} - * @param string $num_paiement {@from body} Payment number (optional) + * @param string $num_payment {@from body} Payment number (optional) * @param string $comment {@from body} Note (optional) * @param string $chqemetteur {@from body} Payment issuer (mandatory if paiementcode = 'CHQ') * @param string $chqbank {@from body} Issuer bank name (optional) @@ -400,7 +400,7 @@ class SupplierInvoices extends DolibarrApi * @throws RestException 401 * @throws RestException 404 */ - public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') + public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_payment = '', $comment = '', $chqemetteur = '', $chqbank = '') { global $conf; @@ -455,7 +455,7 @@ class SupplierInvoices extends DolibarrApi $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paiement->paiementid = $paiementid; $paiement->paiementcode = dol_getIdFromCode($this->db, $paiementid, 'c_paiement', 'id', 'code', 1); - $paiement->num_payment = $num_paiement; + $paiement->num_payment = $num_payment; $paiement->note_public = $comment; $paiement_id = $paiement->create(DolibarrApiAccess::$user, ($closepaidinvoices=='yes'?1:0)); // This include closing invoices diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9197c14be5c..9906a679ce1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -104,6 +104,8 @@ class CommandeFournisseur extends CommonOrder // Note: billed or not is on another field "billed" public $statuts; // List of status + public $billed; + public $socid; public $fourn_id; public $date; @@ -354,6 +356,7 @@ class CommandeFournisseur extends CommonOrder $this->socid = $obj->fk_soc; $this->fourn_id = $obj->fk_soc; $this->statut = $obj->fk_statut; + $this->status = $obj->fk_statut; $this->billed = $obj->billed; $this->user_author_id = $obj->fk_user_author; $this->user_valid_id = $obj->fk_user_valid; @@ -694,7 +697,7 @@ class CommandeFournisseur extends CommonOrder * Return label of a status * * @param int $status Id statut - * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto + * @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 * @param int $billed 1=Billed * @return string Label of status */ @@ -731,14 +734,14 @@ class CommandeFournisseur extends CommonOrder $statustrans = array( 0 => 'status0', - 1 => 'status1', - 2 => 'status3', - 3 => 'status3', - 4 => 'status3', - 5 => 'status4', - 6 => 'status5', - 7 => 'status5', - 9 => 'status5', + 1 => 'status1b', + 2 => 'status1', + 3 => 'status4', + 4 => 'status4b', + 5 => 'status6', + 6 => 'status9', + 7 => 'status9', + 9 => 'status9', ); $statusClass = 'status0'; @@ -747,9 +750,10 @@ class CommandeFournisseur extends CommonOrder } $billedtext = ''; - if ($mode == 4 && $billed) { - $billedtext = ' - '.$langs->trans("Billed"); + if ($billed) { + $billedtext = ' - '.$langs->trans("Billed"); } + if ($status == 5 && $billed) $statusClass = 'status6'; $statusLong = $langs->trans($this->statuts[$status]).$billedtext; $statusShort = $langs->trans($this->statutshort[$status]); @@ -1223,8 +1227,13 @@ class CommandeFournisseur extends CommonOrder { $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".self::STATUS_ORDERSENT.", fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."'"; - $sql .= " WHERE rowid = ".$this->id; + $newnoteprivate = $this->note_private; + if ($comment) $newnoteprivate = dol_concatdesc($newnoteprivate, $langs->trans("Comment").': '.$comment); + + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; + $sql .= " SET fk_statut=".self::STATUS_ORDERSENT.", fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."', "; + $sql .= " note_private='".$this->db->escape($newnoteprivate)."'"; + $sql .= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::commande", LOG_DEBUG); if ($this->db->query($sql)) @@ -1232,6 +1241,7 @@ class CommandeFournisseur extends CommonOrder $this->statut = self::STATUS_ORDERSENT; $this->methode_commande_id = $methode; $this->date_commande = $date; + $this->context = array('comments' => $comment); // Call trigger $result = $this->call_trigger('ORDER_SUPPLIER_SUBMIT', $user); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 16cc619949f..302cf3b47b7 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -55,14 +55,13 @@ if (!empty($conf->variants->enabled)) { require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; } -$langs->loadLangs(array('admin', 'orders', 'sendings', 'companies', 'bills', 'propal', 'supplier_proposal', 'deliveries', 'products', 'stocks', 'productbatch')); +$langs->loadLangs(array('admin', 'orders', 'sendings', 'companies', 'bills', 'propal', 'receptions', 'supplier_proposal', 'deliveries', 'products', 'stocks', 'productbatch')); if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); -$comclientid = GETPOST('comid', 'int'); $socid = GETPOST('socid', 'int'); $projectid = GETPOST('projectid', 'int'); $cancel = GETPOST('cancel', 'alpha'); @@ -917,7 +916,7 @@ if (empty($reshook)) // Force mandatory order method if ($action == 'commande') { - $methodecommande = GETPOST('methodecommande'); + $methodecommande = GETPOST('methodecommande', 'int'); if ($methodecommande <= 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("OrderMode")), null, 'errors'); @@ -927,7 +926,7 @@ if (empty($reshook)) if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) { - $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); + $result = $object->commande($user, GETPOST("datecommande"), GETPOST("methode", 'int'), GETPOST('comment', 'alphanohtml')); if ($result > 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) @@ -2484,11 +2483,14 @@ elseif (!empty($object->id)) if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { + $labelofbutton = $langs->trans('ReceiveProducts'); + if ($conf->reception->enabled) $labelofbutton = $langs->trans("CreateReception"); + if (in_array($object->statut, array(3, 4, 5))) { if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->receptionner) { - print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id.'">'.$langs->trans('ReceiveProducts').'</a></div>'; + print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id.'">'.$labelofbutton.'</a></div>'; } else { - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ReceiveProducts').'</a></div>'; + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$labelofbutton.'</a></div>'; } } } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index dd55bb36ffb..cc38abfc935 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -379,7 +379,7 @@ $warehouse_static = new Entrepot($db); $supplierorderdispatch = new CommandeFournisseurDispatch($db); $help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; -llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_dispatch.js')); +llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_dispatch.js.php')); if ($id > 0 || !empty($ref)) { $soc = new Societe($db); @@ -807,15 +807,13 @@ if ($id > 0 || !empty($ref)) { print '<td>'; if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) { $type = 'batch'; - //print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); - print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$i.', \''.$type.'\')"'); } else { $type = 'dispatch'; - print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$i.', \''.$type.'\')"'); } - print '</td>'; if (! empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { @@ -894,7 +892,8 @@ if ($id > 0 || !empty($ref)) { print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel; } - empty($conf->reception->enabled) ? $dispatchBt = $langs->trans("DispatchVerb") : $dispatchBt = $langs->trans("Receive"); + + $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive") : $langs->trans("CreateReception"); print '<br><input type="submit" class="button" name="dispatch" value="'.dol_escape_htmltag($dispatchBt).'"'; if (count($listwarehouses) <= 0) diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 25c4868fd5e..fd14deabb43 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -76,12 +76,12 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles * Statistics */ -$sql = "SELECT count(cf.rowid), fk_statut"; +$sql = "SELECT count(cf.rowid) as nb, fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE cf.fk_soc = s.rowid"; -$sql .= " AND cf.entity = ".$conf->entity; +$sql .= " AND cf.entity IN (".getEntity('supplier_order').")"; if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " GROUP BY cf.fk_statut"; @@ -93,7 +93,6 @@ if ($resql) $i = 0; $total = 0; - $totalinprocess = 0; $dataseries = array(); $vals = array(); // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially @@ -101,27 +100,36 @@ if ($resql) // -> 6=Canceled -> (reopen) 2=Approved while ($i < $num) { - $row = $db->fetch_row($resql); - if ($row) + $obj = $db->fetch_object($resql); + if ($obj) { - if ($row[1] != 7 && $row[1] != 6 && $row[1] != 5) - { - $vals[$row[1]] = $row[0]; - $totalinprocess += $row[0]; - } - $total += $row[0]; + $vals[($obj->status == CommandeFournisseur::STATUS_CANCELED_AFTER_ORDER ? CommandeFournisseur::STATUS_CANCELED : $obj->status)] = $obj->nb; + + $total += $obj->nb; } $i++; } $db->free($resql); + include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + print '<div class="div-table-responsive-no-min">'; print '<table class="noborder nohover centpercent">'; print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'</th></tr>'; print "</tr>\n"; - foreach (array(0, 1, 2, 3, 4, 5, 6) as $status) + $listofstatus=array(0, 1, 2, 3, 4, 5, 6, 9); + foreach ($listofstatus as $status) { $dataseries[] = array($commandestatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); + if ($status == CommandeFournisseur::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == CommandeFournisseur::STATUS_VALIDATED) $colorseries[$status] = '-'.$badgeStatus1; + if ($status == CommandeFournisseur::STATUS_ACCEPTED) $colorseries[$status] = $badgeStatus1; + if ($status == CommandeFournisseur::STATUS_REFUSED) $colorseries[$status] = $badgeStatus9; + if ($status == CommandeFournisseur::STATUS_ORDERSENT) $colorseries[$status] = $badgeStatus4; + if ($status == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY) $colorseries[$status] = '-'.$badgeStatus4; + if ($status == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $colorseries[$status] = $badgeStatus6; + if ($status == CommandeFournisseur::STATUS_CANCELED || $status == CommandeFournisseur::STATUS_CANCELED_AFTER_ORDER) $colorseries[$status] = $badgeStatus9; + if (!$conf->use_javascript_ajax) { print '<tr class="oddeven">'; @@ -137,6 +145,7 @@ if ($resql) include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); @@ -157,53 +166,6 @@ else dol_print_error($db); } -/* - * Legends / Status - */ - -$sql = "SELECT count(cf.rowid) as nb, cf.fk_statut"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " WHERE cf.fk_soc = s.rowid"; -$sql .= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing -if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; -$sql .= " GROUP BY cf.fk_statut"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print '<div class="div-table-responsive-no-min">'; - print '<table class="liste centpercent">'; - - print '<tr class="liste_titre"><th>'.$langs->trans("Status").'</th>'; - print '<th class="right">'.$langs->trans("Nb").'</th>'; - print "</tr>\n"; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - print '<tr class="oddeven">'; - print '<td>'.$commandestatic->LibStatut($obj->nb).'</td>'; - print '<td class="right"><a href="list.php?statut='.$obj->fk_statut.'">'.$obj->nb.' '.$commandestatic->LibStatut($obj->fk_statut, 3).'</a></td>'; - - print "</tr>\n"; - $i++; - } - print "</table></div><br>"; - $db->free($resql); -} -else -{ - dol_print_error($db); -} - - /* * Draft orders */ @@ -267,7 +229,7 @@ if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_T } else { - $sql .= " WHERE (u.entity IN (".getEntity('user').")"; + $sql .= " WHERE (u.entity IN (".getEntity('user')."))"; } $sql .= " AND u.fk_soc IS NULL"; // An external user can not approved @@ -322,7 +284,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; */ $max = 5; -$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.tms, s.nom as name, s.rowid as socid"; +$sql = "SELECT c.rowid, c.ref, c.fk_statut as status, c.tms, c.billed, s.nom as name, s.rowid as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -376,7 +338,7 @@ if ($resql) print '<td><a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.'</a></td>'; print '<td>'.dol_print_date($db->jdate($obj->tms), 'day').'</td>'; - print '<td class="right">'.$commandestatic->LibStatut($obj->fk_statut, 5).'</td>'; + print '<td class="right">'.$commandestatic->LibStatut($obj->status, 3, $obj->billed).'</td>'; print '</tr>'; $i++; } diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 6c4f5ff95b1..f45160b427e 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -299,10 +299,12 @@ if (empty($reshook)) $paiement->multicurrency_amounts = $multicurrency_amounts; $paiement->paiementid = GETPOST('paiementid', 'int'); - $paiement->num_payment = GETPOST('num_paiement', 'alpha'); + $paiement->num_payment = GETPOST('num_paiement', 'alphanohtml'); $paiement->note_private = GETPOST('comment', 'alpha'); - $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility - $paiement->note = $paiement->note_private; // For bacward compatibility + $paiement->num_paiement = $paiement->num_payment; // For backward compatibility + $paiement->num_payment = $paiement->num_payment; + $paiement->note = $paiement->note_private; // For backward compatibility + $paiement->note_private = $paiement->note_private; if (!$error) { diff --git a/htdocs/fourn/js/lib_dispatch.js b/htdocs/fourn/js/lib_dispatch.js.php similarity index 71% rename from htdocs/fourn/js/lib_dispatch.js rename to htdocs/fourn/js/lib_dispatch.js.php index 49372d3378c..dda12313bc9 100644 --- a/htdocs/fourn/js/lib_dispatch.js +++ b/htdocs/fourn/js/lib_dispatch.js.php @@ -1,3 +1,4 @@ +<?php // Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> // Copyright (C) 2017 Francis Appels <francis.appels@z-application.com> // @@ -15,14 +16,33 @@ // along with this program. If not, see <https://www.gnu.org/licenses/>. // or see https://www.gnu.org/ -// -// \file htdocs/core/js/lib_dispatch.js -// \brief File that include javascript functions used dispatch.php -// +/** + * \file htdocs/fourn/js/lib_dispatch.js.php + * \brief File that include javascript functions used for dispatching qty/stock/lot + */ +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); +if (! defined('NOLOGIN')) define('NOLOGIN', 1); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); + +session_cache_limiter('public'); + +require_once '../../main.inc.php'; + +// Define javascript type +top_httphead('text/javascript; charset=UTF-8'); +// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. +if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); +else header('Cache-Control: no-cache'); + +?> /** * addDispatchLine - * Adds new table row for dispatching to multiple stock locations + * Adds new table row for dispatching to multiple stock locations or multiple lot/serial * * @param index int index of product line. 0 = first product line * @param type string type of dispatch (batch = batch dispatch, dispatch = non batch dispatch) @@ -32,12 +52,12 @@ function addDispatchLine(index, type, mode) { mode = mode || 'qtymissing' - console.log("fourn/js/lib_dispatch.js Split line type="+type+" index="+index+" mode="+mode); - var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object - nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length, // position of line for batch - qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows - qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()), - qtyDispatched; + console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); + var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true); // clone first batch line to jQuery object + var nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length; // position of line for batch + var qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()); // Qty ordered is same for all rows + var qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()); + var qtyDispatched; if (mode === 'lessone') { @@ -46,8 +66,17 @@ function addDispatchLine(index, type, mode) else { qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + qty; + // If user did not reduced the qty to dispatch on old line, we keep only 1 on old line and the rest on new line + if (qtyDispatched == qtyOrdered && qtyDispatched > 1) { + qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + 1; + mode = 'lessone'; + } } + console.log("qtyDispatched="+qtyDispatched+" qtyOrdered="+qtyOrdered); + if (qtyOrdered <= 1) { + window.alert("Quantity can't be split"); + } if (qtyDispatched < qtyOrdered) { //replace tr suffix nbr @@ -97,7 +126,7 @@ function addDispatchLine(index, type, mode) * * Change event handler for dispatch qty input field, * recalculate qty dispatched when qty input has changed. - * If qty is more then qty ordered reset input qty to max qty to dispatch. + * If qty is more than qty ordered reset input qty to max qty to dispatch. * * element requires arbitrary data qty (value before change), type (type of dispatch) and index (index of product line) */ diff --git a/htdocs/ftp/admin/ftpclient.php b/htdocs/ftp/admin/ftpclient.php index 5dc537908c2..b039dd64427 100644 --- a/htdocs/ftp/admin/ftpclient.php +++ b/htdocs/ftp/admin/ftpclient.php @@ -47,18 +47,18 @@ $sql.=" WHERE name like 'FTP_SERVER_%'"; $result=$db->query($sql); if ($result) { - $obj = $db->fetch_object($result); - preg_match('/([0-9]+)$/i', $obj->name, $reg); + $obj = $db->fetch_object($result); + preg_match('/([0-9]+)$/i', $obj->name, $reg); if ($reg[1]) $lastftpentry = $reg[1]; } else { - dol_print_error($db); + dol_print_error($db); } if ($action == 'add' || GETPOST('modify', 'alpha')) { - $ftp_name = "FTP_NAME_" . $entry;// $_POST["numero_entry"]; + $ftp_name = "FTP_NAME_" . $entry;// $_POST["numero_entry"]; $ftp_server = "FTP_SERVER_" . $entry; //$_POST["numero_entry"]; $error=0; @@ -75,14 +75,14 @@ if ($action == 'add' || GETPOST('modify', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Server")), null, 'errors'); } - if (! $error) - { - $ftp_port = "FTP_PORT_" . $entry; - $ftp_user = "FTP_USER_" . $entry; - $ftp_password = "FTP_PASSWORD_" . $entry; - $ftp_passive = "FTP_PASSIVE_" . $entry; + if (! $error) + { + $ftp_port = "FTP_PORT_" . $entry; + $ftp_user = "FTP_USER_" . $entry; + $ftp_password = "FTP_PASSWORD_" . $entry; + $ftp_passive = "FTP_PASSIVE_" . $entry; - $db->begin(); + $db->begin(); $result1=dolibarr_set_const($db, "FTP_PORT_" . $entry, GETPOST($ftp_port, 'alpha'), 'chaine', 0, '', $conf->entity); if ($result1) $result2=dolibarr_set_const($db, "FTP_SERVER_" . $entry, GETPOST($ftp_server, 'alpha'), 'chaine', 0, '', $conf->entity); @@ -91,25 +91,25 @@ if ($action == 'add' || GETPOST('modify', 'alpha')) if ($result4) $result5=dolibarr_set_const($db, "FTP_NAME_" . $entry, GETPOST($ftp_name, 'alpha'), 'chaine', 0, '', $conf->entity); if ($result5) $result6=dolibarr_set_const($db, "FTP_PASSIVE_" . $entry, GETPOST($ftp_passive, 'alpha'), 'chaine', 0, '', $conf->entity); - if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) - { - $db->commit(); - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - $db->rollback(); - dol_print_error($db); - } - } + if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) + { + $db->commit(); + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + $db->rollback(); + dol_print_error($db); + } + } } if (GETPOST('delete', 'alpha')) { - if($entry) - { - $db->begin(); + if($entry) + { + $db->begin(); $result1=dolibarr_del_const($db, "FTP_PORT_" . $entry, $conf->entity); if ($result1) $result2=dolibarr_del_const($db, "FTP_SERVER_" . $entry, $conf->entity); @@ -228,7 +228,7 @@ else { $obj = $db->fetch_object($resql); - preg_match('/([0-9]+)$/i', $obj->name, $reg); + preg_match('/([0-9]+)$/i', $obj->name, $reg); $idrss = $reg[0]; //print "x".join(',',$reg)."=".$obj->name."=".$idrss; diff --git a/htdocs/hrm/establishment/info.php b/htdocs/hrm/establishment/info.php index 1c5a85ecd50..f8fbb1459b0 100644 --- a/htdocs/hrm/establishment/info.php +++ b/htdocs/hrm/establishment/info.php @@ -46,11 +46,11 @@ if ($id) dol_fiche_head($head, 'info', $langs->trans("Establishment"), -1, 'building'); - print '<table width="100%"><tr><td>'; - dol_print_object_info($object); - print '</td></tr></table>'; + print '<table width="100%"><tr><td>'; + dol_print_object_info($object); + print '</td></tr></table>'; - print '</div>'; + print '</div>'; } // End of page diff --git a/htdocs/includes/adodbtime/README.txt b/htdocs/includes/adodbtime/README.txt new file mode 100644 index 00000000000..3e2969a2868 --- /dev/null +++ b/htdocs/includes/adodbtime/README.txt @@ -0,0 +1,7 @@ +README +====== + +ADOdb Date Library, part of the ADOdb abstraction library + +See Wiki: https://adodb.org/dokuwiki/doku.php?id=v5:datetime:datetime_index +Download: https://github.com/ADOdb/ADOdb/blob/master/adodb-time.inc.php diff --git a/htdocs/includes/adodbtime/adodb-time.inc.php b/htdocs/includes/adodbtime/adodb-time.inc.php index c74778bb991..030196db275 100644 --- a/htdocs/includes/adodbtime/adodb-time.inc.php +++ b/htdocs/includes/adodbtime/adodb-time.inc.php @@ -1,7 +1,8 @@ <?php /** -ADOdb Date Library, part of the ADOdb abstraction library -Download: http://phplens.com/phpeverywhere/ +ADOdb Date Library, part of the ADOdb abstraction library +See Wiki: https://adodb.org/dokuwiki/doku.php?id=v5:datetime:datetime_index +Download: https://github.com/ADOdb/ADOdb/blob/master/adodb-time.inc.php PHP native date functions use integer timestamps for computations. Because of this, dates are restricted to the years 1901-2038 on Unix diff --git a/htdocs/includes/geoip2/README.txt b/htdocs/includes/geoip2/README.txt new file mode 100644 index 00000000000..5b311efb5a1 --- /dev/null +++ b/htdocs/includes/geoip2/README.txt @@ -0,0 +1,5 @@ +README + +https://dev.maxmind.com/geoip/geoip2/geolite2/ + +License: https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/htdocs/includes/jquery/README.txt b/htdocs/includes/jquery/README.txt new file mode 100644 index 00000000000..536f413ef04 --- /dev/null +++ b/htdocs/includes/jquery/README.txt @@ -0,0 +1,5 @@ +README: +jQuery is a JavaScript library + +https://jquery.com/ +https://jquery.com/download/ diff --git a/htdocs/includes/tcpdi/tcpdi.php b/htdocs/includes/tcpdi/tcpdi.php index 675e2226b4a..f4c0bd00391 100644 --- a/htdocs/includes/tcpdi/tcpdi.php +++ b/htdocs/includes/tcpdi/tcpdi.php @@ -9,7 +9,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/htdocs/install/index.php b/htdocs/install/index.php index 909e30722cc..40a7d2eb1d9 100644 --- a/htdocs/install/index.php +++ b/htdocs/install/index.php @@ -34,8 +34,8 @@ $err = 0; // If the config file exists and is filled, we're not on first install so we skip the language selection page if (file_exists($conffile) && isset($dolibarr_main_url_root)) { - header("Location: check.php?testget=ok"); - exit; + header("Location: check.php?testget=ok"); + exit; } $langs->load("admin"); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 0a61a6d9c58..f5c4dee3f15 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -45,6 +45,7 @@ UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version -- For v12 +DELETE FROM llx_menu where module='supplier_proposal'; UPDATE llx_website SET lang = 'en' WHERE lang like 'en_%'; UPDATE llx_website SET lang = 'fr' WHERE lang like 'fr_%'; @@ -193,4 +194,9 @@ ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype; ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER accountancy_code_buy; ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_export varchar(32) AFTER accountancy_code_buy_intra; -ALTER TABLE llx_accounting_account ADD COLUMN reconciliable tinyint DEFAULT 0 NOT NULL after active; +ALTER TABLE llx_entrepot ADD COLUMN fax varchar(20) DEFAULT NULL; +ALTER TABLE llx_entrepot ADD COLUMN phone varchar(20) DEFAULT NULL; + +ALTER TABLE llx_accounting_account ADD COLUMN reconcilable tinyint DEFAULT 0 NOT NULL after active; + +ALTER TABLE llx_categorie MODIFY type integer NOT NULL DEFAULT 1; diff --git a/htdocs/install/mysql/tables/llx_accounting_account.sql b/htdocs/install/mysql/tables/llx_accounting_account.sql index a3bf8b90b79..7af83585c7f 100644 --- a/htdocs/install/mysql/tables/llx_accounting_account.sql +++ b/htdocs/install/mysql/tables/llx_accounting_account.sql @@ -35,7 +35,7 @@ create table llx_accounting_account fk_user_author integer DEFAULT NULL, fk_user_modif integer DEFAULT NULL, active tinyint DEFAULT 1 NOT NULL, - reconciliable tinyint DEFAULT 0 NOT NULL, + reconcilable tinyint DEFAULT 0 NOT NULL, import_key varchar(14), extraparams varchar(255) -- for other parameters with json format )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_categorie.sql b/htdocs/install/mysql/tables/llx_categorie.sql index ed1cb828363..c57c2adaa10 100644 --- a/htdocs/install/mysql/tables/llx_categorie.sql +++ b/htdocs/install/mysql/tables/llx_categorie.sql @@ -26,7 +26,7 @@ create table llx_categorie fk_parent integer DEFAULT 0 NOT NULL, label varchar(180) NOT NULL, -- category ref/name ref_ext varchar(255), -- reference into an external system (not used by dolibarr) - type tinyint DEFAULT 1 NOT NULL, -- category type (product, supplier, customer, member) + type integer DEFAULT 1 NOT NULL, -- category type (product, supplier, customer, member) description text, -- description of the category color varchar(8), -- color fk_soc integer DEFAULT NULL, -- not used by default. Used when option CATEGORY_ASSIGNED_TO_A_CUSTOMER is set. diff --git a/htdocs/install/mysql/tables/llx_entrepot.sql b/htdocs/install/mysql/tables/llx_entrepot.sql index 831e1f4a58e..2cabb457016 100644 --- a/htdocs/install/mysql/tables/llx_entrepot.sql +++ b/htdocs/install/mysql/tables/llx_entrepot.sql @@ -32,6 +32,8 @@ create table llx_entrepot town varchar(50), fk_departement integer, fk_pays integer DEFAULT 0, + phone varchar(20), -- phone number + fax varchar(20), -- fax number statut tinyint DEFAULT 1, -- 1 open, 0 close fk_user_author integer, model_pdf varchar(255), diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index b1069618414..fcb19b91421 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -44,12 +44,12 @@ $action=GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):(empty($argv[4])?' $targetversion=DOL_VERSION; // If it's latest upgrade if (! empty($action) && preg_match('/upgrade/i', $action)) // If it's an old upgrade { - $tmp=explode('_', $action, 2); - if ($tmp[0]=='upgrade') - { - if (! empty($tmp[1])) $targetversion=$tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta' - else $targetversion=DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION - } + $tmp=explode('_', $action, 2); + if ($tmp[0]=='upgrade') + { + if (! empty($tmp[1])) $targetversion=$tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta' + else $targetversion=DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION + } } $langs->loadLangs(array("admin", "install")); @@ -112,241 +112,241 @@ print '<br>'; // Test if we can run a first install process if (empty($versionfrom) && empty($versionto) && ! is_writable($conffile)) { - print $langs->trans("ConfFileIsNotWritable", $conffiletoshow); - pFooter(1, $setuplang, 'jscheckparam'); - exit; + print $langs->trans("ConfFileIsNotWritable", $conffiletoshow); + pFooter(1, $setuplang, 'jscheckparam'); + exit; } if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { - $error=0; + $error=0; - // If password is encoded, we decode it - if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass)) - { - require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; - if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) - { - $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); - $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); - $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted - } - else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); - } + // If password is encoded, we decode it + if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass)) + { + require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; + if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) + { + $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); + $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); + $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted + } + else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); + } - $conf->db->type = $dolibarr_main_db_type; - $conf->db->host = $dolibarr_main_db_host; - $conf->db->port = $dolibarr_main_db_port; - $conf->db->name = $dolibarr_main_db_name; - $conf->db->user = $dolibarr_main_db_user; - $conf->db->pass = $dolibarr_main_db_pass; - $conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption)?$dolibarr_main_db_encryption:''; - $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey)?$dolibarr_main_db_cryptkey:''; + $conf->db->type = $dolibarr_main_db_type; + $conf->db->host = $dolibarr_main_db_host; + $conf->db->port = $dolibarr_main_db_port; + $conf->db->name = $dolibarr_main_db_name; + $conf->db->user = $dolibarr_main_db_user; + $conf->db->pass = $dolibarr_main_db_pass; + $conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption)?$dolibarr_main_db_encryption:''; + $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey)?$dolibarr_main_db_cryptkey:''; - $db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); + $db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); - // Create the global $hookmanager object - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($db); + // Create the global $hookmanager object + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($db); - $ok = 0; + $ok = 0; - // If first install - if ($action == "set") - { - // Active module user - $modName='modUser'; - $file = $modName . ".class.php"; - dolibarr_install_syslog('step5: load module user ' . DOL_DOCUMENT_ROOT . "/core/modules/" . $file, LOG_INFO); - include_once DOL_DOCUMENT_ROOT ."/core/modules/".$file; - $objMod = new $modName($db); - $result=$objMod->init(); - if (! $result) print 'ERROR in activating module file='.$file; + // If first install + if ($action == "set") + { + // Active module user + $modName='modUser'; + $file = $modName . ".class.php"; + dolibarr_install_syslog('step5: load module user ' . DOL_DOCUMENT_ROOT . "/core/modules/" . $file, LOG_INFO); + include_once DOL_DOCUMENT_ROOT ."/core/modules/".$file; + $objMod = new $modName($db); + $result=$objMod->init(); + if (! $result) print 'ERROR in activating module file='.$file; - if ($db->connected) - { - $conf->setValues($db); - // Reset forced setup after the setValues - if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE'); - $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; + if ($db->connected) + { + $conf->setValues($db); + // Reset forced setup after the setValues + if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE'); + $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; - // Create admin user - include_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php'; + // Create admin user + include_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php'; - // Set default encryption to yes, generate a salt and set default encryption algorythm (but only if there is no user yet into database) - $sql = "SELECT u.rowid, u.pass, u.pass_crypted"; - $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $resql=$db->query($sql); - if ($resql) - { - $numrows=$db->num_rows($resql); - if ($numrows == 0) - { - // Define default setup for password encryption - dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities - if (function_exists('password_hash')) - dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities - else - dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities - } + // Set default encryption to yes, generate a salt and set default encryption algorythm (but only if there is no user yet into database) + $sql = "SELECT u.rowid, u.pass, u.pass_crypted"; + $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; + $resql=$db->query($sql); + if ($resql) + { + $numrows=$db->num_rows($resql); + if ($numrows == 0) + { + // Define default setup for password encryption + dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities + if (function_exists('password_hash')) + dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities + else + dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities + } - dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO); - } + dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO); + } - // Create user used to create the admin user - $createuser=new User($db); - $createuser->id=0; - $createuser->admin=1; + // Create user used to create the admin user + $createuser=new User($db); + $createuser->id=0; + $createuser->admin=1; - // Set admin user - $newuser = new User($db); - $newuser->lastname='SuperAdmin'; - $newuser->firstname=''; - $newuser->login = $login; - $newuser->pass = $pass; - $newuser->admin=1; - $newuser->entity=0; + // Set admin user + $newuser = new User($db); + $newuser->lastname='SuperAdmin'; + $newuser->firstname=''; + $newuser->login = $login; + $newuser->pass = $pass; + $newuser->admin=1; + $newuser->entity=0; - $conf->global->USER_MAIL_REQUIRED=0; // Force global option to be sure to create a new user with no email - $result=$newuser->create($createuser, 1); - if ($result > 0) - { - print $langs->trans("AdminLoginCreatedSuccessfuly", $login) . "<br>"; - $success = 1; - } - else - { - if ($newuser->error == 'ErrorLoginAlreadyExists') - { - dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING); - print '<br><div class="warning">' . $langs->trans("AdminLoginAlreadyExists", $login) . "</div><br>"; - $success = 1; - } - else - { - dolibarr_install_syslog('step5: FailedToCreateAdminLogin ' . $newuser->error, LOG_ERR); - print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'</div><br><br>'; - } - } + $conf->global->USER_MAIL_REQUIRED=0; // Force global option to be sure to create a new user with no email + $result=$newuser->create($createuser, 1); + if ($result > 0) + { + print $langs->trans("AdminLoginCreatedSuccessfuly", $login) . "<br>"; + $success = 1; + } + else + { + if ($newuser->error == 'ErrorLoginAlreadyExists') + { + dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING); + print '<br><div class="warning">' . $langs->trans("AdminLoginAlreadyExists", $login) . "</div><br>"; + $success = 1; + } + else + { + dolibarr_install_syslog('step5: FailedToCreateAdminLogin ' . $newuser->error, LOG_ERR); + print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'</div><br><br>'; + } + } - if ($success) - { - // Insert MAIN_VERSION_FIRST_INSTALL in a dedicated transaction. So if it fails (when first install was already done), we can do other following requests. - $db->begin(); - dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to ' . $targetversion, LOG_DEBUG); - $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when first install',0)"); - if ($resql) - { - $conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion; - $db->commit(); - } - else - { - //if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists - $db->commit(); - } + if ($success) + { + // Insert MAIN_VERSION_FIRST_INSTALL in a dedicated transaction. So if it fails (when first install was already done), we can do other following requests. + $db->begin(); + dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to ' . $targetversion, LOG_DEBUG); + $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when first install',0)"); + if ($resql) + { + $conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion; + $db->commit(); + } + else + { + //if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists + $db->commit(); + } - $db->begin(); + $db->begin(); - dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG); - $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'"); - if (! $resql) dol_print_error($db, 'Error in setup program'); - $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when last install',0)"); - if (! $resql) dol_print_error($db, 'Error in setup program'); - $conf->global->MAIN_VERSION_LAST_INSTALL=$targetversion; + dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG); + $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'"); + if (! $resql) dol_print_error($db, 'Error in setup program'); + $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when last install',0)"); + if (! $resql) dol_print_error($db, 'Error in setup program'); + $conf->global->MAIN_VERSION_LAST_INSTALL=$targetversion; - if ($useforcedwizard) - { - dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG); - $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_REMOVE_INSTALL_WARNING'"); - if (! $resql) dol_print_error($db, 'Error in setup program'); - $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING', 1).",".$db->encrypt(1, 1).",'chaine',1,'Disable install warnings',0)"); - if (! $resql) dol_print_error($db, 'Error in setup program'); - $conf->global->MAIN_REMOVE_INSTALL_WARNING=1; - } + if ($useforcedwizard) + { + dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG); + $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_REMOVE_INSTALL_WARNING'"); + if (! $resql) dol_print_error($db, 'Error in setup program'); + $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING', 1).",".$db->encrypt(1, 1).",'chaine',1,'Disable install warnings',0)"); + if (! $resql) dol_print_error($db, 'Error in setup program'); + $conf->global->MAIN_REMOVE_INSTALL_WARNING=1; + } - // If we ask to force some modules to be enabled - if (! empty($force_install_module)) - { - if (! defined('DOL_DOCUMENT_ROOT') && ! empty($dolibarr_main_document_root)) define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); + // If we ask to force some modules to be enabled + if (! empty($force_install_module)) + { + if (! defined('DOL_DOCUMENT_ROOT') && ! empty($dolibarr_main_document_root)) define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); - $tmparray=explode(',', $force_install_module); - foreach ($tmparray as $modtoactivate) - { - $modtoactivatenew=preg_replace('/\.class\.php$/i', '', $modtoactivate); - print $langs->trans("ActivateModule", $modtoactivatenew).'<br>'; + $tmparray=explode(',', $force_install_module); + foreach ($tmparray as $modtoactivate) + { + $modtoactivatenew=preg_replace('/\.class\.php$/i', '', $modtoactivate); + print $langs->trans("ActivateModule", $modtoactivatenew).'<br>'; - $file=$modtoactivatenew.'.class.php'; - dolibarr_install_syslog('step5: activate module file=' . $file); - $res=dol_include_once("/core/modules/".$file); + $file=$modtoactivatenew.'.class.php'; + dolibarr_install_syslog('step5: activate module file=' . $file); + $res=dol_include_once("/core/modules/".$file); - $res=activateModule($modtoactivatenew, 1); - if (! empty($res['errors'])) print 'ERROR in activating module file='.$file; - } - } + $res=activateModule($modtoactivatenew, 1); + if (! empty($res['errors'])) print 'ERROR in activating module file='.$file; + } + } - dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const'); - $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'"); - if (! $resql) dol_print_error($db, 'Error in setup program'); + dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const'); + $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'"); + if (! $resql) dol_print_error($db, 'Error in setup program'); - $db->commit(); - } - } - else - { - print $langs->trans("ErrorFailedToConnect")."<br>"; - } - } - // If upgrade - elseif (empty($action) || preg_match('/upgrade/i', $action)) - { - if ($db->connected) - { - $conf->setValues($db); - // Reset forced setup after the setValues - if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE'); - $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; + $db->commit(); + } + } + else + { + print $langs->trans("ErrorFailedToConnect")."<br>"; + } + } + // If upgrade + elseif (empty($action) || preg_match('/upgrade/i', $action)) + { + if ($db->connected) + { + $conf->setValues($db); + // Reset forced setup after the setValues + if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE'); + $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; - // Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database - $tagdatabase=false; - if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) $tagdatabase=true; // We don't know what it was before, so now we consider we are version choosed. - else - { - $mainversionlastupgradearray=preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE); - $targetversionarray=preg_split('/[.-]/', $targetversion); - if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) $tagdatabase=true; - } + // Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database + $tagdatabase=false; + if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) $tagdatabase=true; // We don't know what it was before, so now we consider we are version choosed. + else + { + $mainversionlastupgradearray=preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE); + $targetversionarray=preg_split('/[.-]/', $targetversion); + if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) $tagdatabase=true; + } - if ($tagdatabase) - { - dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value ' . $targetversion); - $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_UPGRADE'"); - if (! $resql) dol_print_error($db, 'Error in setup program'); - $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version for last upgrade',0)"); - if (! $resql) dol_print_error($db, 'Error in setup program'); - $conf->global->MAIN_VERSION_LAST_UPGRADE=$targetversion; - } - else - { - dolibarr_install_syslog('step5: we run an upgrade to version ' . $targetversion . ' but database was already upgraded to ' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '. We keep MAIN_VERSION_LAST_UPGRADE as it is.'); - } - } - else - { - print $langs->trans("ErrorFailedToConnect")."<br>"; - } - } - else - { - dol_print_error('', 'step5.php: unknown choice of action'); - } + if ($tagdatabase) + { + dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value ' . $targetversion); + $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_UPGRADE'"); + if (! $resql) dol_print_error($db, 'Error in setup program'); + $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version for last upgrade',0)"); + if (! $resql) dol_print_error($db, 'Error in setup program'); + $conf->global->MAIN_VERSION_LAST_UPGRADE=$targetversion; + } + else + { + dolibarr_install_syslog('step5: we run an upgrade to version ' . $targetversion . ' but database was already upgraded to ' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '. We keep MAIN_VERSION_LAST_UPGRADE as it is.'); + } + } + else + { + print $langs->trans("ErrorFailedToConnect")."<br>"; + } + } + else + { + dol_print_error('', 'step5.php: unknown choice of action'); + } - // May fail if parameter already defined - $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_LANG_DEFAULT', 1).",".$db->encrypt($setuplang, 1).",'chaine',0,'Default language',1)"); - //if (! $resql) dol_print_error($db,'Error in setup program'); + // May fail if parameter already defined + $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_LANG_DEFAULT', 1).",".$db->encrypt($setuplang, 1).",'chaine',0,'Default language',1)"); + //if (! $resql) dol_print_error($db,'Error in setup program'); - $db->close(); + $db->close(); } @@ -356,104 +356,104 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) // If first install if ($action == "set" && $success) { - if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) - { - // Install is finished - print $langs->trans("SystemIsInstalled")."<br>"; + if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) + { + // Install is finished + print $langs->trans("SystemIsInstalled")."<br>"; - $createlock=0; + $createlock=0; - if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) - { - // Install is finished, we create the lock file - $lockfile=DOL_DATA_ROOT.'/install.lock'; - $fp = @fopen($lockfile, "w"); - if ($fp) - { - if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility - fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); - fclose($fp); - @chmod($lockfile, octdec($force_install_lockinstall)); - $createlock=1; - } - } - if (empty($createlock)) - { - print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>"; - } + if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) + { + // Install is finished, we create the lock file + $lockfile=DOL_DATA_ROOT.'/install.lock'; + $fp = @fopen($lockfile, "w"); + if ($fp) + { + if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility + fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); + fclose($fp); + @chmod($lockfile, octdec($force_install_lockinstall)); + $createlock=1; + } + } + if (empty($createlock)) + { + print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>"; + } - print "<br>"; + print "<br>"; - print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>"; + print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>"; - print '<div class="center"><a href="../admin/index.php?mainmenu=home&leftmenu=setup' . (isset($login) ? '&username=' . urlencode($login) : '') . '">'; - print $langs->trans("GoToSetupArea"); - print '</a></div>'; - } - else - { - // If here MAIN_VERSION_LAST_UPGRADE is not empty - print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>'; - print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>'; - print $langs->trans("MigrationNotFinished").'<br>'; - print "<br>"; + print '<div class="center"><a href="../admin/index.php?mainmenu=home&leftmenu=setup' . (isset($login) ? '&username=' . urlencode($login) : '') . '">'; + print $langs->trans("GoToSetupArea"); + print '</a></div>'; + } + else + { + // If here MAIN_VERSION_LAST_UPGRADE is not empty + print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>'; + print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>'; + print $langs->trans("MigrationNotFinished").'<br>'; + print "<br>"; - print '<div class="center"><a href="'.$dolibarr_main_url_root .'/install/index.php">'; - print $langs->trans("GoToUpgradePage"); - print '</a></div>'; - } + print '<div class="center"><a href="'.$dolibarr_main_url_root .'/install/index.php">'; + print $langs->trans("GoToUpgradePage"); + print '</a></div>'; + } } // If upgrade elseif (empty($action) || preg_match('/upgrade/i', $action)) { - if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) - { - // Upgrade is finished - print $langs->trans("SystemIsUpgraded")."<br>"; + if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) + { + // Upgrade is finished + print $langs->trans("SystemIsUpgraded")."<br>"; - $createlock=0; + $createlock=0; - if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) - { - // Upgrade is finished, we create the lock file - $lockfile=DOL_DATA_ROOT.'/install.lock'; - $fp = @fopen($lockfile, "w"); - if ($fp) - { - if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility - fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); - fclose($fp); - @chmod($lockfile, octdec($force_install_lockinstall)); - $createlock=1; - } - } - if (empty($createlock)) - { - print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>"; - } + if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) + { + // Upgrade is finished, we create the lock file + $lockfile=DOL_DATA_ROOT.'/install.lock'; + $fp = @fopen($lockfile, "w"); + if ($fp) + { + if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility + fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); + fclose($fp); + @chmod($lockfile, octdec($force_install_lockinstall)); + $createlock=1; + } + } + if (empty($createlock)) + { + print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>"; + } - print "<br><br>"; + print "<br><br>"; - print '<div class="center"><a href="../index.php?mainmenu=home' . (isset($login) ? '&username=' . urlencode($login) : '') . '">'; - print $langs->trans("GoToDolibarr").'...'; - print '</a></div><br>'; - } - else - { - // If here MAIN_VERSION_LAST_UPGRADE is not empty - print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>'; - print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>'; + print '<div class="center"><a href="../index.php?mainmenu=home' . (isset($login) ? '&username=' . urlencode($login) : '') . '">'; + print $langs->trans("GoToDolibarr").'...'; + print '</a></div><br>'; + } + else + { + // If here MAIN_VERSION_LAST_UPGRADE is not empty + print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>'; + print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>'; - print "<br>"; + print "<br>"; - print '<div class="center"><a href="../install/index.php">'; - print $langs->trans("GoToUpgradePage"); - print '</a></div>'; - } + print '<div class="center"><a href="../install/index.php">'; + print $langs->trans("GoToUpgradePage"); + print '</a></div>'; + } } else { - dol_print_error('', 'step5.php: unknown choice of action'); + dol_print_error('', 'step5.php: unknown choice of action'); } // Clear cache files diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 66d53398f96..d2f03580391 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -5115,7 +5115,7 @@ function migrate_members_socialnetworks() $obj->socialnetworks = '[]'; } $socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true)); - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'adherent SET socialnetworks="'.$db->escape(json_encode($socialnetworks, true)).'"'; + $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."adherent SET socialnetworks='".$db->escape(json_encode($socialnetworks, true))."'"; $sqlupd.= ', skype=null'; $sqlupd.= ', twitter=null'; $sqlupd.= ', facebook=null'; @@ -5209,7 +5209,7 @@ function migrate_contacts_socialnetworks() $obj->socialnetworks = '[]'; } $socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true)); - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'socpeople SET socialnetworks="'.$db->escape(json_encode($socialnetworks, true)).'"'; + $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."socpeople SET socialnetworks='".$db->escape(json_encode($socialnetworks, true))."'"; $sqlupd.= ', jabberid=null'; $sqlupd.= ', skype=null'; $sqlupd.= ', twitter=null'; @@ -5300,7 +5300,7 @@ function migrate_thirdparties_socialnetworks() $obj->socialnetworks = '[]'; } $socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true)); - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'societe SET socialnetworks="'.$db->escape(json_encode($socialnetworks, true)).'"'; + $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."societe SET socialnetworks='".$db->escape(json_encode($socialnetworks, true))."'"; $sqlupd.= ', skype=null'; $sqlupd.= ', twitter=null'; $sqlupd.= ', facebook=null'; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 36b5fbcf55c..ba34d38f36e 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -239,7 +239,7 @@ HideOpeningBalance=Hide opening balance Pcgtype=Group of account PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report. -Reconciliable=Reconcilable +Reconcilable=Reconcilable TotalVente=Total turnover before tax TotalMarge=Total sales margin diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7a4de856ba2..51ff5f4e2f7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1108,8 +1108,8 @@ Delays_MAIN_DELAY_EXPENSEREPORTS=Expense report to approve Delays_MAIN_DELAY_HOLIDAYS=Leave requests to approve SetupDescription1=Before starting to use Dolibarr some initial parameters must be defined and modules enabled/configured. SetupDescription2=The following two sections are mandatory (the two first entries in the Setup menu): -SetupDescription3=<a href="%s">%s -> %s</a><br>Basic parameters used to customize the default behavior of your application (e.g for country-related features). -SetupDescription4=<a href="%s">%s -> %s</a><br>This software is a suite of many modules/applications, all more or less independent. The modules relevant to your needs must be enabled and configured. New items/options are added to menus with the activation of a module. +SetupDescription3=<a href="%s">%s -> %s</a><br><br>Basic parameters used to customize the default behavior of your application (e.g for country-related features). +SetupDescription4=<a href="%s">%s -> %s</a><br><br>This software is a suite of many modules/applications. The modules related to your needs must be enabled and configured. Menu entries will appears with the activation of these modules. SetupDescription5=Other Setup menu entries manage optional parameters. LogEvents=Security audit events Audit=Audit @@ -1128,7 +1128,7 @@ LogEventDesc=Enable logging for specific security events. Administrators the log AreaForAdminOnly=Setup parameters can be set by <b>administrator users</b> only. SystemInfoDesc=System information is miscellaneous technical information you get in read only mode and visible for administrators only. SystemAreaForAdminOnly=This area is available to administrator users only. Dolibarr user permissions cannot change this restriction. -CompanyFundationDesc=Edit the information of the company/entity. Click on "%s" button at the bottom of the page. +CompanyFundationDesc=Edit the information of your company/organization. Click on "%s" button at the bottom of the page when done. AccountantDesc=If you have an external accountant/bookkeeper, you can edit here its information. AccountantFileNumber=Accountant code DisplayDesc=Parameters affecting the look and behaviour of Dolibarr can be modified here. @@ -1264,6 +1264,8 @@ RuleForGeneratedPasswords=Rules to generate and validate passwords DisableForgetPasswordLinkOnLogonPage=Do not show the "Password Forgotten" link on the Login page UsersSetup=Users module setup UserMailRequired=Email required to create a new user +UsersDocModules=Document templates for documents generated from user record +GroupsDocModules=Document templates for documents generated from a group record ##### HRM setup ##### HRMSetup=HRM module setup ##### Company setup ##### @@ -1959,6 +1961,7 @@ WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramatical ModuleActivated=Module %s is activated and slows the interface EXPORTS_SHARE_MODELS=Export models are share with everybody ExportSetup=Setup of module Export +ImportSetup=Setup of module Import InstanceUniqueID=Unique ID of the instance SmallerThan=Smaller than LargerThan=Larger than @@ -1979,5 +1982,5 @@ MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled EmailTemplate=Template for email EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax -PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some text title in your PDF duplicated in 2 different languages in the same generate PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF. +PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some texts in your PDF duplicated in 2 different languages in the same generated PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF. FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book. diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 8fe1f84b149..bd62684421a 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -27,8 +27,8 @@ BoxTitleLastSuppliers=Latest %s recorded suppliers BoxTitleLastModifiedSuppliers=Vendors: last %s modified BoxTitleLastModifiedCustomers=Customers: last %s modified BoxTitleLastCustomersOrProspects=Latest %s customers or prospects -BoxTitleLastCustomerBills=Latest %s Customer invoices -BoxTitleLastSupplierBills=Latest %s Vendor invoices +BoxTitleLastCustomerBills=Latest %s modified Customer invoices +BoxTitleLastSupplierBills=Latest %s modified Vendor invoices BoxTitleLastModifiedProspects=Prospects: last %s modified BoxTitleLastModifiedMembers=Latest %s members BoxTitleLastFicheInter=Latest %s modified interventions diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 1d32b77e267..c492417e2a8 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -16,6 +16,7 @@ AddThisArticle=Add this article RestartSelling=Go back on sell SellFinished=Sale complete PrintTicket=Print ticket +SendTicket=Send ticket NoProductFound=No article found ProductFound=product found NoArticle=No article @@ -58,8 +59,9 @@ TakeposNeedsCategories=TakePOS needs product categories to work OrderNotes=Order Notes CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration -TicketVatGrouped=Group VAT by rate in tickets -AutoPrintTickets=Automatically print tickets +TicketVatGrouped=Group VAT by rate in tickets|receipts +AutoPrintTickets=Automatically print tickets|receipts +PrintCustomerOnReceipts=Print customer on tickets|receipts EnableBarOrRestaurantFeatures=Enable features for Bar or Restaurant ConfirmDeletionOfThisPOSSale=Do your confirm the deletion of this current sale ? ConfirmDiscardOfThisPOSSale=Do you want to discard this current sale ? @@ -94,3 +96,5 @@ ByTerminal=By terminal TakeposNumpadUsePaymentIcon=Use payment icon on numpad CashDeskRefNumberingModules=Numbering module for cash desk CashDeskGenericMaskCodes6 = <br><b>{TN}</b> tag is used to add the terminal number +TakeposGroupSameProduct=Group same products lines +StartAParallelSale=Start a new parallel sale \ No newline at end of file diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index 2dcf4317e00..3549e3f8b23 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -26,6 +26,8 @@ FieldTitle=Field title NowClickToGenerateToBuildExportFile=Now, select the file format in the combo box and click on "Generate" to build the export file... AvailableFormats=Available Formats LibraryShort=Library +ExportCsvSeparator=Csv caracter separator +ImportCsvSeparator=Csv caracter separator Step=Step FormatedImport=Import Assistant FormatedImportDesc1=This module allows you to update existing data or add new objects into the database from a file without technical knowledge, using an assistant. diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index acf44920aa9..106630d5b17 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -90,6 +90,7 @@ BrowserMethodDescription=Simple and easy receipt printing. Only a few parameters TakeposNumpadUsePaymentIcon=Utilisation d'icônes sur les touches des modes de règlement du pavé numérique CashDeskRefNumberingModules=Modèles de numérotation des caisses CashDeskGenericMaskCodes6 = <br>La balise <b>{TN}</b> permet de rajouter le numéro du terminal +TakeposGroupSameProduct=Regrouper les mêmes lignes de produits PrintMethod=Print method ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud. ByTerminal=By terminal diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1cea53ae2a7..8d3812d5553 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -210,7 +210,7 @@ $sessionname = 'DOLSESSID_'.$prefix; $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; if (!empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); session_name($sessionname); -session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start. +session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start. // This create lock, released when session_write_close() or end of page. // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished. if (!defined('NOSESSION')) @@ -257,7 +257,7 @@ if (isset($_SERVER["HTTP_USER_AGENT"])) } -// Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url) +// Force HTTPS if required ($conf->file->main_force_https is 0/1 or 'https dolibarr root url') // $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off' if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on')) { @@ -284,6 +284,7 @@ if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERV // Start redirect if ($newurl) { + header_remove(); // Clean header already set to be sure to remove any header like "Set-Cookie: DOLSESSID_..." from non HTTPS answers dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl); header("Location: ".$newurl); exit; @@ -625,7 +626,7 @@ if (!defined('NOLOGIN')) dol_syslog('User not found, connexion refused'); session_destroy(); session_name($sessionname); - session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie + session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie session_start(); if ($resultFetchUser == 0) @@ -682,7 +683,7 @@ if (!defined('NOLOGIN')) dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING); session_destroy(); session_name($sessionname); - session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie + session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie session_start(); if ($resultFetchUser == 0) diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 84218b40a89..afef8de5cff 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -41,66 +41,66 @@ $action=GETPOST('action', 'alpha'); */ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { - $code=$reg[1]; - if (dolibarr_set_const($db, $code, 1, 'yesno', 0, '', $conf->entity) > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } + $code=$reg[1]; + if (dolibarr_set_const($db, $code, 1, 'yesno', 0, '', $conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { - $code=$reg[1]; - if (dolibarr_del_const($db, $code, $conf->entity) > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } + $code=$reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } if ($action == 'remises') { - if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', $_POST['MARGIN_METHODE_FOR_DISCOUNT'], 'chaine', 0, '', $conf->entity) > 0) - { - setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); - } - else - { - dol_print_error($db); - } + if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', $_POST['MARGIN_METHODE_FOR_DISCOUNT'], 'chaine', 0, '', $conf->entity) > 0) + { + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + } + else + { + dol_print_error($db); + } } if ($action == 'typemarges') { - if (dolibarr_set_const($db, 'MARGIN_TYPE', $_POST['MARGIN_TYPE'], 'chaine', 0, '', $conf->entity) > 0) - { - setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); - } - else - { - dol_print_error($db); - } + if (dolibarr_set_const($db, 'MARGIN_TYPE', $_POST['MARGIN_TYPE'], 'chaine', 0, '', $conf->entity) > 0) + { + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + } + else + { + dol_print_error($db); + } } if ($action == 'contact') { - if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0) - { - setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); - } - else - { - dol_print_error($db); - } + if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0) + { + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + } + else + { + dol_print_error($db); + } } /* diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index cc87e83d5c0..93eb7560aaa 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -401,7 +401,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $result = $object->getLinesArray(); print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST"> - <input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'"> + <input type="hidden" name="token" value="' . newToken().'"> <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> <input type="hidden" name="mode" value=""> <input type="hidden" name="id" value="' . $object->id.'"> diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index e451a627d69..6697fd15da1 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -86,7 +86,7 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -367,7 +367,7 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value= 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="page" value="'.$page.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); diff --git a/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php b/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php index fdcd7ecc4fd..48ed6b4b2c6 100644 --- a/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php +++ b/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php @@ -32,7 +32,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase { /** * Global test setup - * @return void + * @return void */ public static function setUpBeforeClass() { @@ -41,7 +41,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase /** * Unit test setup - * @return void + * @return void */ protected function setUp() { @@ -50,7 +50,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase /** * Verify pre conditions - * @return void + * @return void */ protected function assertPreConditions() { @@ -59,7 +59,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase /** * A sample test - * @return bool + * @return bool */ public function testSomething() { @@ -70,7 +70,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase /** * Verify post conditions - * @return void + * @return void */ protected function assertPostConditions() { @@ -79,7 +79,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase /** * Unit test teardown - * @return void + * @return void */ protected function tearDown() { @@ -88,7 +88,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase /** * Global test teardown - * @return void + * @return void */ public static function tearDownAfterClass() { @@ -99,7 +99,7 @@ class MyObjectTest extends \PHPUnit_Framework_TestCase * Unsuccessful test * * @param Exception $e Exception - * @return void + * @return void * @throws Exception */ protected function onNotSuccessfulTest(Exception $e) diff --git a/htdocs/mrp/js/lib_dispatch.js.php b/htdocs/mrp/js/lib_dispatch.js.php new file mode 100644 index 00000000000..dc7c079a024 --- /dev/null +++ b/htdocs/mrp/js/lib_dispatch.js.php @@ -0,0 +1,136 @@ +<?php +// Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> +// Copyright (C) 2017 Francis Appels <francis.appels@z-application.com> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// 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 <https://www.gnu.org/licenses/>. +// or see https://www.gnu.org/ + +/** + * \file htdocs/mrp/js/lib_dispatch.js.php + * \brief File that include javascript functions used for dispatching qty/stock/lot + */ + +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); +if (! defined('NOLOGIN')) define('NOLOGIN', 1); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); + +session_cache_limiter('public'); + +require_once '../../main.inc.php'; + +// Define javascript type +top_httphead('text/javascript; charset=UTF-8'); +// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. +if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); +else header('Cache-Control: no-cache'); + +?> +/** + * addDispatchLine + * Adds new table row for dispatching to multiple stock locations or multiple lot/serial + * + * @param index int index of product line. 0 = first product line + * @param type string type of dispatch (batch = batch dispatch, dispatch = non batch dispatch) + * @param mode string 'qtymissing' will create new line with qty missing, 'lessone' will keep 1 in old line and the rest in new one + */ +function addDispatchLine(index, type, mode) +{ + mode = mode || 'qtymissing' + + console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); + var nbrTrs = $("tr[name^='"+type+"_"+index+"']").length; // position of line for batch + var $row = $("tr[name='"+type+'_'+index+"_1']").clone(true); // clone last batch line to jQuery object + var qtyOrdered = parseFloat($("#qty_ordered_"+index).val()); // Qty ordered is same for all rows + var qty = parseFloat($("#qtytoproduce-"+index+"-"+nbrTrs).val()); + var qtyDispatched; + + if (mode === 'lessone') + { + qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + 1; + } + else + { + qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + qty; + console.log(qty); + // If user did not reduced the qty to dispatch on old line, we keep only 1 on old line and the rest on new line + if (qtyDispatched == qtyOrdered && qtyDispatched > 1) { + qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + 1; + mode = 'lessone'; + } + } + console.log("qtyDispatched="+qtyDispatched+" qtyOrdered="+qtyOrdered); + + if (qtyOrdered <= 1) { + window.alert("Quantity can't be split"); + } + if (qtyDispatched < qtyOrdered) + { + //replace tr suffix nbr + var re1 = new RegExp('_'+index+'_1', 'g'); + var re2 = new RegExp('-'+index+'-1', 'g'); + $row.html($row.html().replace(re1, '_'+index+'_'+(nbrTrs+1))); + $row.html($row.html().replace(re2, '-'+index+'-'+(nbrTrs+1))); + //create new select2 to avoid duplicate id of cloned one + $row.find("select[name='"+'idwarehousetoproduce-'+index+'-'+(nbrTrs+1)+"']").select2(); + // TODO find solution to copy selected option to new select + // TODO find solution to keep new tr's after page refresh + //clear value + $row.find("input[name^='qtytoproduce']").val(''); + //change name of new row + $row.attr('name',type+'_'+index+'_'+(nbrTrs+1)); + //insert new row before last row + $("tr[name^='"+type+"_"+index+"_"+nbrTrs+"']:last").after($row); + + //remove cloned select2 with duplicate id. + $("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); // old way to find duplicated select2 component + $(".csswarehouse_"+index+"_"+(nbrTrs+1)+":first-child").parent("span.selection").parent(".select2").detach(); + + /* Suffix of lines are: index _ trs.length */ + $("#qtytoproduce-"+index+"-"+(nbrTrs+1)).focus(); + if ($("#qtytoproduce-"+index+"-"+(nbrTrs)).val() == 0) { + $("#qtytoproduce-"+index+"-"+(nbrTrs)).val(1); + } + var totalonallines = 0; + for (let i = 1; i <= nbrTrs; i++) { + console.log(i+" = "+parseFloat($("#qtytoproduce-"+index+"-"+i).val())); + totalonallines = totalonallines + parseFloat($("#qtytoproduce-"+index+"-"+i).val()); + } + console.log("totalonallines="+totalonallines); + if (totalonallines == qtyOrdered && qtyOrdered > 1) { + var prevouslineqty = $("#qtytoproduce-"+index+"-"+nbrTrs).val(); + $("#qtytoproduce-"+index+"-"+(nbrTrs)).val(1); + $("#qtytoproduce-"+index+"-"+(nbrTrs+1)).val(prevouslineqty - 1); + } + $("#qty_dispatched_"+index).val(qtyDispatched); + + //hide all buttons then show only the last one + $("tr[name^='"+type+"_'][name$='_"+index+"'] .splitbutton").hide(); + $("tr[name^='"+type+"_'][name$='_"+index+"']:last .splitbutton").show(); + + if (mode === 'lessone') + { + qty = 1; // keep 1 in old line + $("#qty_"+(nbrTrs-1)+"_"+index).val(qty); + } + // Store arbitrary data for dispatch qty input field change event + $("#qtytoproduce-"+index+(nbrTrs)).data('qty', qty); + $("#qtytoproduce-"+index+(nbrTrs)).data('type', type); + $("#qtytoproduce-"+index+(nbrTrs)).data('index', index); + } +} + diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 572b5d8a2f7..ca17ce7677e 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -497,7 +497,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $object->fetchLines(); print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST"> - <input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'"> + <input type="hidden" name="token" value="' . newToken().'"> <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> <input type="hidden" name="mode" value=""> <input type="hidden" name="id" value="' . $object->id.'"> diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index a065cc922fe..b25f5093cb9 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -57,7 +57,7 @@ dol_include_once('/mrp/class/mo.class.php'); dol_include_once('/mrp/lib/mrp_mo.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("mrp", "stocks", "other")); +$langs->loadLangs(array("mrp", "stocks", "other", "productbatch")); // Get parameters $id = GETPOST('id', 'int'); @@ -397,7 +397,8 @@ $formproduct = new FormProduct($db); $tmpwarehouse = new Entrepot($db); $tmpbatch = new Productlot($db); -llxHeader('', $langs->trans('Mo'), ''); +$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication'; +llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, array('/mrp/js/lib_dispatch.js.php')); // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) @@ -621,11 +622,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (in_array($action, array('consumeorproduce', 'consumeandproduceall', 'addconsumeline'))) { - print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" class="formconsumeproduce">'; + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" class="'.(in_array($action, array('consumeorproduce', 'consumeandproduceall')) ? 'formconsumeproduce' : '').'">'; print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="confirm_'.$action.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="id" value="'.$id.'">'; + // Note: closing form is add end of page if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); @@ -686,7 +688,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '<td>'; print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'maxwidth300'); print '</td>'; - print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50"></td>'; + print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50 right"></td>'; print '<td class="right"></td>'; print '<td>'; print '<input type="submit" class="button" name="addconsumelinebutton" value="'.$langs->trans("Add").'">'; @@ -773,8 +775,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '<td class="right">'.$line2['qty'].'</td>'; print '<td>'; if ($line2['fk_warehouse'] > 0) { - $tmpwarehouse->fetch($line2['fk_warehouse']); - print $tmpwarehouse->getNomUrl(1); + $result = $tmpwarehouse->fetch($line2['fk_warehouse']); + if ($result > 0) print $tmpwarehouse->getNomUrl(1); } print '</td>'; // Lot Batch @@ -793,7 +795,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '<td>'.$langs->trans("ToConsume").'</td>'; $preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed)); if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0; - print '<td class="right"><input type="text" class="width50" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>'; + print '<td class="right"><input type="text" class="width50 right" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>'; print '<td></td>'; print '<td>'; if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { @@ -845,6 +847,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '<td>'; if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch"); print '</td>'; + print '<td></td>'; } print '</tr>'; @@ -860,6 +863,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $nblinetoproducecursor = 0; foreach ($object->lines as $line) { if ($line->role == 'toproduce') { + $i=1; + $nblinetoproducecursor++; $tmpproduct = new Product($db); @@ -871,6 +876,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $alreadyproduced += $line2['qty']; } + $suffix = '_'.$line->id; + print '<!-- Line to dispatch '.$suffix.' -->'."\n"; + // hidden fields for js function + print '<input id="qty_ordered'.$suffix.'" type="hidden" value="'.$line->qty.'">'; + print '<input id="qty_dispatched'.$suffix.'" type="hidden" value="'.$alreadyproduced.'">'; + print '<tr>'; print '<td>'.$tmpproduct->getNomUrl(1).'</td>'; print '<td class="right">'.$line->qty.'</td>'; @@ -898,6 +909,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '</td>'; if ($conf->productbatch->enabled) { print '<td></td>'; // Lot + print '<td></td>'; } print '</tr>'; @@ -911,30 +923,33 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '<td class="right">'.$line2['qty'].'</td>'; print '<td>'; if ($line2['fk_warehouse'] > 0) { - $tmpwarehouse->fetch($line2['fk_warehouse']); - print $tmpwarehouse->getNomUrl(1); + $result = $tmpwarehouse->fetch($line2['fk_warehouse']); + if ($result > 0) print $tmpwarehouse->getNomUrl(1); } print '</td>'; - print '<td>'; - if ($line2['batch'] != '') { - $tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']); - print $tmpbatch->getNomUrl(1); + if ($conf->productbatch->enabled) { + print '<td>'; + if ($line2['batch'] != '') { + $tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']); + print $tmpbatch->getNomUrl(1); + } + print '</td>'; + print '<td></td>'; } - print '</td>'; print '</tr>'; } if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { - print '<tr>'; + print '<tr name="batch_'.$line->id.'_'.$i.'">'; print '<td>'.$langs->trans("ToProduce").'</td>'; $preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced)); if ($action == 'consumeorproduce' && !GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0; - print '<td class="right"><input type="text" class="width50" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>'; + print '<td class="right"><input type="text" class="width50 right" id="qtytoproduce-'.$line->id.'-'.$i.'" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>'; print '<td></td>'; print '<td>'; if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $preselected = (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i) ? GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) : ($object->fk_warehouse > 0 ? $object->fk_warehouse : 'ifone')); - print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1); + print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'csswarehouse_'.$line->id.'_'.$i); } else { print '<span class="opacitymedium">'.$langs->trans("NoStockChangeOnServices").'</span>'; } @@ -946,6 +961,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '<input type="text" class="width50" name="batchtoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'">'; } print '</td>'; + print '<td>'; + if ($tmpproduct->status_batch) { + $type = 'batch'; + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$line->id.', \''.$type.'\', \'qtymissing\')"'); + } + print '</td>'; } print '</tr>'; } diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 302ecf5f1ff..32dde7ddb3e 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -113,8 +113,8 @@ if (empty($reshook)) if (!$error) { $object->titre = GETPOST('nouveautitre', 'nohtml'); - $object->commentaires = GETPOST('nouveauxcommentaires', 'nohtml'); - $object->description = GETPOST('nouveauxcommentaires', 'nohtml'); + $object->commentaires = GETPOST('nouveauxcommentaires', 'restricthtml'); + $object->description = GETPOST('nouveauxcommentaires', 'restricthtml'); $object->mail_admin = GETPOST('nouvelleadresse', 'alpha'); $object->date_fin = $expiredate; $object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? true : false; @@ -208,6 +208,7 @@ $toutsujet = str_replace("@", "<br>", $toutsujet); $toutsujet = str_replace("°", "'", $toutsujet); print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'" method="POST">'."\n"; +print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="update">'; $head = opensurvey_prepare_head($object); @@ -248,12 +249,12 @@ print '</td></tr>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="2">'; if ($action == 'edit') { - $doleditor = new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires), '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); + $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); $doleditor->Create(0, ''); } else { - print (dol_textishtml($object->commentaires) ? $object->commentaires : dol_nl2br($object->commentaires, 1, true)); + print (dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)); } print '</td></tr>'; @@ -263,7 +264,7 @@ if (!$object->fk_user_creat) { print '<tr><td>'.$langs->trans("EMail").'</td><td colspan="2">'; if ($action == 'edit') { - print '<input type="text" name="nouvelleadresse" size="40" value="'.$object->mail_admin.'">'; + print '<input type="text" name="nouvelleadresse" class="minwith200" value="'.$object->mail_admin.'">'; } else print dol_print_email($object->mail_admin, 0, 0, 1); print '</td></tr>'; @@ -391,10 +392,9 @@ if ($action == 'delete') -print '<br>'; - print '<form name="formulaire5" action="#" method="POST">'."\n"; +print '<input type="hidden" name="token" value="'.newToken().'">'; print load_fiche_titre($langs->trans("CommentsOfVoters"), '', ''); @@ -404,7 +404,7 @@ $comments = $object->getComments(); if ($comments) { foreach ($comments as $comment) { if ($user->rights->opensurvey->write) { - print '<a href="'.dol_buildpath('/opensurvey/card.php', 1).'?deletecomment='.$comment->id_comment.'&id='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> '; + print '<a href="'.dol_buildpath('/opensurvey/card.php', 1).'?deletecomment='.$comment->id_comment.'&id='.$numsondage.'"> '.img_picto('', 'delete.png', '', false, 0, 0, '', '', 0).'</a> '; } print dol_htmlentities($comment->usercomment).': '.dol_nl2br(dol_htmlentities($comment->comment))." <br>"; @@ -421,7 +421,7 @@ print '<br>'; if ($object->allow_comments) { print $langs->trans("AddACommentForPoll").'<br>'; print '<textarea name="comment" rows="2" class="quatrevingtpercent"></textarea><br>'."\n"; - print $langs->trans("Name").': <input type="text" size="50" name="commentuser" value="'.$user->getFullName($langs).'"><br>'."\n"; + print $langs->trans("Name").': <input type="text" class="minwidth300" name="commentuser" value="'.$user->getFullName($langs).'"> '."\n"; print '<input type="submit" class="button" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans("AddComment")).'"><br>'."\n"; if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide == "yes") { print "<font color=#FF0000>".$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."</font>"; diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 69dd0d4e0a7..51e5fdc5dac 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -47,11 +47,11 @@ function opensurvey_prepare_head(Opensurveysondage $object) $head[1][2] = 'preview'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'opensurveypoll'); + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'opensurveypoll'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'opensurveypoll', 'remove'); @@ -67,31 +67,70 @@ function opensurvey_prepare_head(Opensurveysondage $object) * @param int $disablehead More content into html header * @param array $arrayofjs Array of complementary js files * @param array $arrayofcss Array of complementary css files + * @param string $numsondage Num survey * @return void */ -function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') +function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $numsondage = '') { - global $conf, $mysoc; + global $conf, $langs, $mysoc; + global $dolibarr_main_url_root; + + //$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>'; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers - print '<body id="mainbody" class="publicnewmemberform" style="margin-top: 10px;">'; + print '<body id="mainbody" class="publicnewmemberform">'; - // Print logo - if ($mysoc->logo) { - if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small); - } - } - if (!$urllogo && (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))) + + print '<span id="dolpaymentspan"></span>'."\n"; + print '<div class="center">'."\n"; + print '<form name="formulaire" action="studs.php?sondage='.$numsondage.'"'.'#bas" method="POST">'."\n"; + print '<input type="hidden" name="sondage" value="'.$numsondage.'"/>'; + print '<input type="hidden" name="token" value="'.newToken().'">'."\n"; + print "\n"; + + + // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) + $width = 0; + // Define logo and logosmall + $logosmall = $mysoc->logo_small; + $logo = $mysoc->logo; + $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; + if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo; + elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall = $conf->global->ONLINE_PAYMENT_LOGO; + //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n"; + // Define urllogo + $urllogo = ''; + $urllogofull = ''; + if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $width = 150; + } + elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) + { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $width = 150; } - print '<div style="text-align:center"><img alt="Logo" id="logosubscribe" title="" src="'.$urllogo.'"/></div>'; - print '<br>'; + // Output html code for logo + if ($urllogo) + { + print '<div class="backgreypublicpayment">'; + print '<div class="logopublicpayment">'; + print '<img id="dolpaymentlogo" src="'.$urllogo.'"'; + if ($width) print ' width="'.$width.'"'; + print '>'; + print '</div>'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.png" width="80px"></a></div>'; + } + print '</div>'; + } - print '<div style="margin-left: 50px; margin-right: 50px;">'; + print '<div style="margin-left: 50px; margin-right: 50px; text-align: start;"><br>'; } /** @@ -102,6 +141,8 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ function llxFooterSurvey() { print '</div>'; + print '</form>'; + print '</div>'; printCommonFooter('public'); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index a9b726a646b..fd5ff463eb8 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2013-2020 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * @@ -503,6 +503,8 @@ dol_fiche_end(); print '</form>'."\n"; +// Buttons + print '<div class="tabsAction">'; print '<a class="butAction" href="exportcsv.php?id='.$numsondage.'">'.$langs->trans("ExportSpreadsheet").' (.CSV)'.'</a>'; @@ -546,7 +548,7 @@ if (GETPOST('ajoutsujet')) for ($i = 1; $i < 32; $i++) { print '<OPTION VALUE="'.$i.'">'.$i.'</OPTION>'."\n"; } - print '</SELECT>'."\n"; + print '</select>'."\n"; print $formother->select_month('', 'nouveaumois', 1); @@ -560,14 +562,14 @@ if (GETPOST('ajoutsujet')) for ($i = 0; $i < 24; $i++) { print '<OPTION VALUE="'.$i.'">'.$i.' H</OPTION>'."\n"; } - print '</SELECT>'."\n"; + print '</select>'."\n"; print '<select name="nouvelleminutedebut"> '."\n"; print '<OPTION VALUE="vide">&nbsp;</OPTION>'."\n"; print '<OPTION VALUE="00">00</OPTION>'."\n"; print '<OPTION VALUE="15">15</OPTION>'."\n"; print '<OPTION VALUE="30">30</OPTION>'."\n"; print '<OPTION VALUE="45">45</OPTION>'."\n"; - print '</SELECT>'."\n"; + print '</select>'."\n"; print '<br><br>'.$langs->trans("AddEndHour").': <br><br>'."\n"; print '<select name="nouvelleheurefin"> '."\n"; print '<OPTION VALUE="vide">&nbsp;</OPTION>'."\n"; @@ -581,7 +583,7 @@ if (GETPOST('ajoutsujet')) print '<OPTION VALUE="15">15</OPTION>'."\n"; print '<OPTION VALUE="30">30</OPTION>'."\n"; print '<OPTION VALUE="45">45</OPTION>'."\n"; - print '</SELECT>'."\n"; + print '</select>'."\n"; print '<br><br>'; print' <input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans("Add")).'">'."\n"; @@ -597,7 +599,7 @@ if (GETPOST('ajoutsujet')) } if ($user->rights->opensurvey->write) { - print '<br>'.$langs->trans("PollAdminDesc", img_picto('', 'delete'), $langs->trans("Add")).'<br>'; + print '<span class="opacitymedium">'.$langs->trans("PollAdminDesc", img_picto('', 'delete'), $langs->trans("Add")).'</span><br>'; } $nbcolonnes = substr_count($object->sujet, ',') + 1; @@ -1093,6 +1095,6 @@ print '</form>'."\n"; print '<a name="bas"></a>'."\n"; -llxFooterSurvey(); +llxFooter(); $db->close(); diff --git a/htdocs/opensurvey/wizard/choix_autre.php b/htdocs/opensurvey/wizard/choix_autre.php index cb3ed346a52..7a31e21c843 100644 --- a/htdocs/opensurvey/wizard/choix_autre.php +++ b/htdocs/opensurvey/wizard/choix_autre.php @@ -110,7 +110,7 @@ llxHeader('', $langs->trans("OpenSurvey"), "", '', 0, 0, $arrayofjs, $arrayofcss if (empty($_SESSION['titre'])) { dol_print_error('', $langs->trans('ErrorOpenSurveyFillFirstSection')); - llxFooterSurvey(); + llxFooter(); exit; } diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index ec7ec4e60f6..37af5b1a7f4 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -52,17 +52,17 @@ if ($action == 'setvalue' && $user->admin) if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PAYBOX_PBX_IDENTIFIANT", GETPOST('PAYBOX_PBX_IDENTIFIANT', 'alpha'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error++; - $result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR", GETPOST('ONLINE_PAYMENT_CREDITOR', 'alpha'), 'chaine', 0, '', $conf->entity); - if (! $result > 0) $error++; - $result=dolibarr_set_const($db, "PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity); - if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR", GETPOST('ONLINE_PAYMENT_CREDITOR', 'alpha'), 'chaine', 0, '', $conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity); + if (! $result > 0) $error++; $result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error++; - $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'alpha'), 'chaine', 0, '', $conf->entity); + $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'alpha'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error++; - $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'alpha'), 'chaine', 0, '', $conf->entity); - if (! $result > 0) $error++; - $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'alpha'), 'chaine', 0, '', $conf->entity); + $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'alpha'), 'chaine', 0, '', $conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'alpha'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL", GETPOST('ONLINE_PAYMENT_SENDEMAIL'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error++; diff --git a/htdocs/paypal/lib/paypalfunctions.lib.php b/htdocs/paypal/lib/paypalfunctions.lib.php index 258ca919142..226875c6238 100644 --- a/htdocs/paypal/lib/paypalfunctions.lib.php +++ b/htdocs/paypal/lib/paypalfunctions.lib.php @@ -24,14 +24,14 @@ if (session_id() == "") { - session_start(); - if (ini_get('register_globals')) // To solve bug in using $_SESSION - { - foreach ($_SESSION as $key=>$value) - { - if (isset($GLOBALS[$key])) unset($GLOBALS[$key]); - } - } + session_start(); + if (ini_get('register_globals')) // To solve bug in using $_SESSION + { + foreach ($_SESSION as $key=>$value) + { + if (isset($GLOBALS[$key])) unset($GLOBALS[$key]); + } + } } // ================================== @@ -50,13 +50,13 @@ $API_version="56"; */ if (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha')) // We can force sand box with param 'forcesandbox' { - $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; - $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; + $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; + $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; } else { - $API_Endpoint = "https://api-3t.paypal.com/nvp"; - $API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token="; + $API_Endpoint = "https://api-3t.paypal.com/nvp"; + $API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token="; } // Clean parameters diff --git a/htdocs/printing/index.php b/htdocs/printing/index.php index 5c5322c7184..5372c70d73b 100644 --- a/htdocs/printing/index.php +++ b/htdocs/printing/index.php @@ -50,19 +50,19 @@ print $langs->trans("DirectPrintingJobsDesc").'<br><br>'; $object = new PrintingDriver($db); $result = $object->listDrivers($db, 10); foreach ($result as $driver) { - require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; - $classname = 'printing_'.$driver; - $langs->load($driver); - $printer = new $classname($db); - if ($conf->global->{$printer->active}) { - //$printer->listJobs('commande'); - $result = $printer->listJobs(); - print $printer->resprint; + require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; + $classname = 'printing_'.$driver; + $langs->load($driver); + $printer = new $classname($db); + if ($conf->global->{$printer->active}) { + //$printer->listJobs('commande'); + $result = $printer->listJobs(); + print $printer->resprint; - if ($result > 0) { - setEventMessages($printer->error, $printer->errors, 'errors'); - } - } + if ($result > 0) { + setEventMessages($printer->error, $printer->errors, 'errors'); + } + } } // End of page diff --git a/htdocs/printing/lib/printing.lib.php b/htdocs/printing/lib/printing.lib.php index 26a66acad7a..c899eb105b1 100644 --- a/htdocs/printing/lib/printing.lib.php +++ b/htdocs/printing/lib/printing.lib.php @@ -32,46 +32,46 @@ */ function printingAdminPrepareHead($mode) { - global $langs, $conf; + global $langs, $conf; - $h = 0; - $head = array(); + $h = 0; + $head = array(); - $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=config"; - $head[$h][1] = $langs->trans("ListDrivers"); - $head[$h][2] = 'config'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=config"; + $head[$h][1] = $langs->trans("ListDrivers"); + $head[$h][2] = 'config'; + $h++; - if ($mode == 'setup') { - $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=setup&driver=".GETPOST('driver', 'alpha'); - $head[$h][1] = $langs->trans("SetupDriver"); - $head[$h][2] = 'setup'; - $h++; - } + if ($mode == 'setup') { + $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=setup&driver=".GETPOST('driver', 'alpha'); + $head[$h][1] = $langs->trans("SetupDriver"); + $head[$h][2] = 'setup'; + $h++; + } - if ($mode == 'test') { - $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=test&driver=".GETPOST('driver', 'alpha'); - $head[$h][1] = $langs->trans("TargetedPrinter"); - $head[$h][2] = 'test'; - $h++; - } + if ($mode == 'test') { + $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=test&driver=".GETPOST('driver', 'alpha'); + $head[$h][1] = $langs->trans("TargetedPrinter"); + $head[$h][2] = 'test'; + $h++; + } - /** TODO This feature seem to be not ready yet. + /** TODO This feature seem to be not ready yet. $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=userconf"; $head[$h][1] = $langs->trans("UserConf"); $head[$h][2] = 'userconf'; $h++; - */ + */ - //$object=new stdClass(); + //$object=new stdClass(); - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab - //complete_head_from_modules($conf,$langs,$object,$head,$h,'printingadmin'); + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + //complete_head_from_modules($conf,$langs,$object,$head,$h,'printingadmin'); - //complete_head_from_modules($conf,$langs,$object,$head,$h,'printing','remove'); + //complete_head_from_modules($conf,$langs,$object,$head,$h,'printing','remove'); - return $head; + return $head; } diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 6a3f8a898eb..694d7862479 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -201,7 +201,7 @@ if ($action == 'convert') { $obj = $db->fetch_object($resql); - $objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step + $objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step $ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid); if ($ret > 0) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 405583ea314..96b2165c65a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4381,6 +4381,12 @@ class Product extends CommonObject if (!empty($this->label)) { $label .= '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label; } + if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if (!empty($conf->productbatch->enabled)) { + $langs->load("productbatch"); + $label .= "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2); + } + } if (!empty($conf->barcode->enabled)) { $label .= '<br><b>'.$langs->trans('BarCode').':</b> '.$this->barcode; } @@ -4390,28 +4396,26 @@ class Product extends CommonObject if ($this->weight) { $label .= "<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units); } + $labelsize = ""; if ($this->length) { - $label .= "<br><b>".$langs->trans("Length").'</b>: '.$this->length.' '.measuringUnitString(0, 'size', $this->length_units); + $labelsize .= ($labelsize ? " - ": "")."<b>".$langs->trans("Length").'</b>: '.$this->length.' '.measuringUnitString(0, 'size', $this->length_units); } if ($this->width) { - $label .= "<br><b>".$langs->trans("Width").'</b>: '.$this->width.' '.measuringUnitString(0, 'size', $this->width_units); + $labelsize .= ($labelsize ? " - ": "")."<b>".$langs->trans("Width").'</b>: '.$this->width.' '.measuringUnitString(0, 'size', $this->width_units); } if ($this->height) { - $label .= "<br><b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units); + $labelsize .= ($labelsize ? " - ": "")."<b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units); } + if ($labelsize) $label .= "<br>".$labelsize; + + $labelsurfacevolume = ""; if ($this->surface) { - $label .= "<br><b>".$langs->trans("Surface").'</b>: '.$this->surface.' '.measuringUnitString(0, 'surface', $this->surface_units); + $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Surface").'</b>: '.$this->surface.' '.measuringUnitString(0, 'surface', $this->surface_units); } if ($this->volume) { - $label .= "<br><b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units); - } - } - - if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - if (!empty($conf->productbatch->enabled)) { - $langs->load("productbatch"); - $label .= "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2); + $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units); } + if ($labelsurfacevolume) $label .= "<br>".$labelsurfacevolume; } if (!empty($conf->accounting->enabled) && $this->status) { diff --git a/htdocs/product/dynamic_price/editor.php b/htdocs/product/dynamic_price/editor.php index 42872f22e1e..f99120836c7 100644 --- a/htdocs/product/dynamic_price/editor.php +++ b/htdocs/product/dynamic_price/editor.php @@ -73,9 +73,9 @@ if ($action == 'add') if ($result == 0) //No existing entry found with title, ok { //Check the expression validity by parsing it - $priceparser = new PriceParser($db); - $price_result = $priceparser->testExpression($id, $expression); - if ($price_result < 0) { //Expression is not valid + $priceparser = new PriceParser($db); + $price_result = $priceparser->testExpression($id, $expression); + if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); } else @@ -113,9 +113,9 @@ if ($action == 'update') if ($result == 0 || $result == $eid) //No existing entry found with title or existing one is the current one, ok { //Check the expression validity by parsing it - $priceparser = new PriceParser($db); - $price_result = $priceparser->testExpression($id, $expression); - if ($price_result < 0) { //Expression is not valid + $priceparser = new PriceParser($db); + $price_result = $priceparser->testExpression($id, $expression); + if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); } else @@ -149,7 +149,7 @@ if ($action == 'delete') { if ($eid != 0) { - $price_expression->fetch($eid); + $price_expression->fetch($eid); $result = $price_expression->delete($user); if ($result < 0) { @@ -200,7 +200,7 @@ $help_text.= '<br><br>'.$langs->trans("PriceExpressionEditorHelp3"); $help_text.= '<br><br>'.$langs->trans("PriceExpressionEditorHelp4"); $help_text.= '<br><br>'.$langs->trans("PriceExpressionEditorHelp5"); foreach ($price_globals->listGlobalVariables() as $entry) { - $help_text.= '<br><b>#globals_'.$entry->code.'#</b> '.$entry->description.' = '.$entry->value; + $help_text.= '<br><b>#globals_'.$entry->code.'#</b> '.$entry->description.' = '.$entry->value; } //Price expression editor diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ae89e4c558c..a37acf91ebe 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -87,8 +87,8 @@ $diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user- $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); -$page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $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; @@ -536,11 +536,11 @@ if ($resql) 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="page" value="'.$page.'">'; print '<input type="hidden" name="type" value="'.$type.'">'; if (empty($arrayfields['p.fk_product_type']['checked'])) print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">'; - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "product"; diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 770a02fded5..e0fce722ee7 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -61,15 +61,15 @@ $staticproduct=new Product($db); $helpurl=''; if ($type == '0') { - $helpurl='EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos'; + $helpurl='EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos'; } elseif ($type == '1') { - $helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios'; + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios'; } else { - $helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios'; + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios'; } $title=$langs->trans("Statistics"); @@ -130,7 +130,7 @@ $sql.= " GROUP BY p.rowid, p.label, p.ref, p.fk_product_type"; $result=$db->query($sql); if ($result) { - $totalnboflines = $db->num_rows($result); + $totalnboflines = $db->num_rows($result); } $sql.= $db->order($sortfield, $sortorder); @@ -139,23 +139,23 @@ $sql.= $db->plimit($limit+1, $offset); $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($resql); + while ($i < $num) + { + $objp = $db->fetch_object($resql); - $infoprod[$objp->rowid]=array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label); - $infoprod[$objp->rowid]['nblineproposal']=$objp->c; + $infoprod[$objp->rowid]=array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label); + $infoprod[$objp->rowid]['nblineproposal']=$objp->c; - $i++; - } - $db->free($resql); + $i++; + } + $db->free($resql); } else { - dol_print_error($db); + dol_print_error($db); } //var_dump($infoprod); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a6697701a68..3f6a89cbddb 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1151,7 +1151,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se print load_fiche_titre($langs->trans("UpdateVAT"), ''); print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">'; - print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">'; + print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="update_vat">'; print '<input type="hidden" name="id" value="'.$object->id.'">'; @@ -1185,7 +1185,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) { print '<!-- Edit price -->'."\n"; print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">'; - print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">'; + print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="update_price">'; print '<input type="hidden" name="id" value="'.$object->id.'">'; @@ -1660,7 +1660,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print load_fiche_titre($langs->trans('PriceByCustomer')); print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">'; - print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">'; + print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="add_customer_price_confirm">'; print '<input type="hidden" name="id" value="'.$object->id.'">'; @@ -1747,7 +1747,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) } print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">'; - print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">'; + print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="update_customer_price_confirm">'; print '<input type="hidden" name="lineid" value="'.$prodcustprice->id.'">'; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index d0a1fc5db76..c025f0d08aa 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -105,6 +105,8 @@ if (empty($reshook)) $object->zip = GETPOST("zipcode"); $object->town = GETPOST("town"); $object->country_id = GETPOST("country_id"); + $object->phone = GETPOST("phone"); + $object->fax = GETPOST("fax"); if (!empty($object->libelle)) { @@ -174,6 +176,8 @@ if (empty($reshook)) $object->zip = GETPOST("zipcode"); $object->town = GETPOST("town"); $object->country_id = GETPOST("country_id"); + $object->phone = GETPOST("phone"); + $object->fax = GETPOST("fax"); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); @@ -292,6 +296,11 @@ if ($action == 'create') print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '</td></tr>'; + + // Phone / Fax + print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td><input name="phone" size="20" value="'.$object->phone.'"></td></tr>'; + print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td><input name="fax" size="20" value="'.$object->fax.'"></td></tr>'; + // Status print '<tr><td>'.$langs->trans("Status").'</td><td>'; print '<select name="statut" class="flat">'; @@ -703,6 +712,10 @@ else if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '</td></tr>'; + // Phone / Fax + print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td><input name="phone" size="20" value="'.$object->phone.'"></td></tr>'; + print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td><input name="fax" size="20" value="'.$object->fax.'"></td></tr>'; + // Status print '<tr><td>'.$langs->trans("Status").'</td><td>'; print '<select name="statut" class="flat">'; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 40c358967ce..85fadbc1421 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -89,6 +89,16 @@ class Entrepot extends CommonObject */ public $town; + /** + * @var string Phone + */ + public $phone; + + /** + * @var string Fax + */ + public $fax; + /** * @var int ID of parent */ @@ -114,6 +124,8 @@ class Entrepot extends CommonObject 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55), 'fk_departement' =>array('type'=>'integer', 'label'=>'State', 'enabled'=>1, 'visible'=>0, 'position'=>60), 'fk_pays' =>array('type'=>'integer', 'label'=>'Country', 'enabled'=>1, 'visible'=>-2, 'position'=>65), + 'phone' =>array('type'=>'varchar(20)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-2, 'position'=>70), + 'fax' =>array('type'=>'varchar(20)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-2, 'position'=>75), //'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-2, 'position'=>82), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), @@ -293,6 +305,8 @@ class Entrepot extends CommonObject $sql .= ", zip = '".$this->db->escape($this->zip)."'"; $sql .= ", town = '".$this->db->escape($this->town)."'"; $sql .= ", fk_pays = ".$this->country_id; + $sql .= ", phone = '".$this->db->escape($this->phone)."'"; + $sql .= ", fax = '".$this->db->escape($this->fax)."'"; $sql .= " WHERE rowid = ".$id; $this->db->begin(); @@ -440,7 +454,7 @@ class Entrepot extends CommonObject return -1; } - $sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id"; + $sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; if ($id) { @@ -471,6 +485,8 @@ class Entrepot extends CommonObject $this->zip = $obj->zip; $this->town = $obj->town; $this->country_id = $obj->country_id; + $this->phone = $obj->phone; + $this->fax = $obj->fax; // Retreive all extrafield // fetch optionals attributes and labels diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index d64fbe5ef90..3903e374713 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -1162,4 +1162,17 @@ class MouvementStock extends CommonObject return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } } diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 35e16e5c840..58997d4384d 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -65,7 +65,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print '<table class="noborder nohover centpercent">'; print "<tr class=\"liste_titre\">"; print '<td colspan="3">'.$langs->trans("Search").'</td></tr>'; - print "<tr ".$bc[false]."><td>"; + print '<tr class="oddevene"><td>'; print $langs->trans("Warehouse").':</td><td><input class="flat" type="text" size="18" name="sall"></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; print "</table></div></form><br>"; } @@ -119,7 +119,7 @@ else print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; -// Last movements +// Latest movements $max=10; $sql = "SELECT p.rowid, p.label as produit, p.tobatch, p.tosell, p.tobuy,"; $sql.= " e.ref as stock, e.rowid as entrepot_id,"; @@ -167,7 +167,7 @@ if ($resql) $producttmp->status_buy = $objp->tobuy; print '<tr class="oddeven">'; - print '<td>'.dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>'; + print '<td class="nowraponall">'.dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>'; print '<td class="tdoverflowmax200">'; print $producttmp->getNomUrl(1); print "</td>\n"; diff --git a/htdocs/product/stock/lib/replenishment.lib.php b/htdocs/product/stock/lib/replenishment.lib.php index a23b99b9293..798f21004c7 100644 --- a/htdocs/product/stock/lib/replenishment.lib.php +++ b/htdocs/product/stock/lib/replenishment.lib.php @@ -32,45 +32,45 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; */ function dolDispatchToDo($order_id) { - global $db; + global $db; - $dispatched = array(); - $ordered = array(); + $dispatched = array(); + $ordered = array(); - // Count nb of quantity dispatched per product - $sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'; - $sql.= ' WHERE fk_commande = ' . $order_id; - $sql.= ' GROUP BY fk_product'; - $sql.= ' ORDER by fk_product'; - $resql = $db->query($sql); - if ($resql && $db->num_rows($resql)) - { - while ($obj = $db->fetch_object($resql)) - $dispatched[$obj->fk_product] = $obj; - } + // Count nb of quantity dispatched per product + $sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'; + $sql.= ' WHERE fk_commande = ' . $order_id; + $sql.= ' GROUP BY fk_product'; + $sql.= ' ORDER by fk_product'; + $resql = $db->query($sql); + if ($resql && $db->num_rows($resql)) + { + while ($obj = $db->fetch_object($resql)) + $dispatched[$obj->fk_product] = $obj; + } - // Count nb of quantity to dispatch per product - $sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet'; - $sql.= ' WHERE fk_commande = ' . $order_id; - $sql.= ' AND fk_product > 0'; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= ' AND product_type = 0'; - $sql.= ' GROUP BY fk_product'; - $sql.= ' ORDER by fk_product'; - $resql = $db->query($sql); - if ($resql && $db->num_rows($resql)) - { - while ($obj = $db->fetch_object($resql)) - $ordered[$obj->fk_product] = $obj; - } + // Count nb of quantity to dispatch per product + $sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet'; + $sql.= ' WHERE fk_commande = ' . $order_id; + $sql.= ' AND fk_product > 0'; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= ' AND product_type = 0'; + $sql.= ' GROUP BY fk_product'; + $sql.= ' ORDER by fk_product'; + $resql = $db->query($sql); + if ($resql && $db->num_rows($resql)) + { + while ($obj = $db->fetch_object($resql)) + $ordered[$obj->fk_product] = $obj; + } - $todispatch=0; - foreach ($ordered as $key => $val) - { + $todispatch=0; + foreach ($ordered as $key => $val) + { if ($ordered[$key] > $dispatched[$key]) $todispatch++; - } + } - return ($todispatch ? true : false); - //return true; + return ($todispatch ? true : false); + //return true; } /** @@ -80,30 +80,30 @@ function dolDispatchToDo($order_id) */ function dispatchedOrders() { - global $db; + global $db; - $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur'; - $resql = $db->query($sql); - $resarray = array(); - if ($resql && $db->num_rows($resql) > 0) - { - while ($obj = $db->fetch_object($resql)) - { - if (! dolDispatchToDo($obj->rowid)) - { - $resarray[] = $obj->rowid; - } - } - } + $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur'; + $resql = $db->query($sql); + $resarray = array(); + if ($resql && $db->num_rows($resql) > 0) + { + while ($obj = $db->fetch_object($resql)) + { + if (! dolDispatchToDo($obj->rowid)) + { + $resarray[] = $obj->rowid; + } + } + } - if (count($resarray)) - { - $res = '(' . implode(',', $resarray) . ')'; - } else { - //hack to make sure ordered SQL request won't syntax error - $res = '(0)'; - } - return $res; + if (count($resarray)) + { + $res = '(' . implode(',', $resarray) . ')'; + } else { + //hack to make sure ordered SQL request won't syntax error + $res = '(0)'; + } + return $res; } /** @@ -159,16 +159,16 @@ function ordered($product_id) */ function getProducts($order_id) { - global $db; - $order = new CommandeFournisseur($db); - $f = $order->fetch($order_id); - $products = array(); - if($f) { - foreach($order->lines as $line) { - if (!in_array($line->fk_product, $products)) { - $products[] = $line->fk_product; - } - } - } - return $products; + global $db; + $order = new CommandeFournisseur($db); + $f = $order->fetch($order_id); + $products = array(); + if($f) { + foreach($order->lines as $line) { + if (!in_array($line->fk_product, $products)) { + $products[] = $line->fk_product; + } + } + } + return $products; } diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index d5fdf711ea5..0b145c7ca10 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -95,6 +95,8 @@ $fieldstosearchall = array( 'e.address'=>"Address", 'e.zip'=>'Zip', 'e.town'=>'Town', + 'e.phone'=>'Phone', + 'e.fax'=>'Fax', ); // Definition of fields for list @@ -105,6 +107,8 @@ $arrayfields = array( 'e.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0), 'e.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0), 'e.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0), + 'e.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>0), + 'e.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>0), 'stockqty'=>array('type'=>'float', 'label'=>$langs->trans("PhysicalStock"), 'enabled'=>1, 'visible'=>-2, 'position'=>70), 'estimatedvalue'=>array('type'=>'float', 'label'=>$langs->trans("EstimatedStockValue"), 'enabled'=>1, 'visible'=>-2, 'position'=>71), 'sellvalue'=>array('type'=>'float', 'label'=>$langs->trans("EstimatedStockValueSell"), 'enabled'=>1, 'visible'=>-2, 'position'=>72), @@ -182,7 +186,7 @@ $title = $langs->trans("ListOfWarehouses"); // Build and execute select // -------------------------------------------------------------------- -$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent,"; +$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.phone, e.fax, e.fk_pays, e.fk_parent,"; $sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -222,7 +226,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent"; +$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.phone, e.fax, e.fk_parent"; $totalnboflines = 0; $result = $db->query($sql); if ($result) @@ -399,6 +403,14 @@ if (!empty($arrayfields['e.town']['checked'])) { print '<td class="liste_titre"></td>'; } +if (!empty($arrayfields['e.phone']['checked'])) +{ + print '<td class="liste_titre"></td>'; +} +if (!empty($arrayfields['e.fax']['checked'])) +{ + print '<td class="liste_titre"></td>'; +} if (!empty($arrayfields['stockqty']['checked'])) { print '<td class="liste_titre"></td>'; @@ -462,6 +474,14 @@ if (!empty($arrayfields['e.town']['checked'])) { print_liste_field_titre($arrayfields['e.town']['label'], $_SERVER["PHP_SELF"], "e.town", "", $param, "", $sortfield, $sortorder); } +if (!empty($arrayfields['e.phone']['checked'])) +{ + print_liste_field_titre($arrayfields['e.phone']['label'], $_SERVER["PHP_SELF"], "e.phone", "", $param, "", $sortfield, $sortorder); +} +if (!empty($arrayfields['e.fax']['checked'])) +{ + print_liste_field_titre($arrayfields['e.fax']['label'], $_SERVER["PHP_SELF"], "e.fax", "", $param, "", $sortfield, $sortorder); +} if (!empty($arrayfields['stockqty']['checked'])) { print_liste_field_titre($arrayfields['stockqty']['label'], $_SERVER["PHP_SELF"], "stockqty", '', $param, '', $sortfield, $sortorder, 'right '); @@ -553,6 +573,18 @@ if ($num) print '<td>'.$obj->town.'</td>'; } + // Phone + if (!empty($arrayfields['e.phone']['checked'])) + { + print '<td>'.$obj->phone.'</td>'; + } + + //Fax + if (!empty($arrayfields['e.fax']['checked'])) + { + print '<td>'.$obj->fax.'</td>'; + } + // Stock qty if (!empty($arrayfields['stockqty']['checked'])) { @@ -654,6 +686,14 @@ if ($num) { $emptyColumn++; } + if (!empty($arrayfields['e.phone']['checked'])) + { + $emptyColumn++; + } + if (!empty($arrayfields['e.fax']['checked'])) + { + $emptyColumn++; + } for ($i=0; $i < $emptyColumn; $i++) { diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 7c189f1015e..f89788167b9 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -54,8 +54,11 @@ $ref = GETPOST('ref', 'alpha'); $msid = GETPOST('msid', 'int'); $product_id = GETPOST("product_id", 'int'); $action = GETPOST('action', 'aZ09'); +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'movementlist'; +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list // Security check //$result=restrictedArea($user, 'stock', $id, 'entrepot&stock'); @@ -123,15 +126,19 @@ if (!$user->rights->stock->mouvement->lire) { accessforbidden(); } +$permissiontoread = $user->rights->stock->mouvement->lire; +$permissiontoadd = $user->rights->stock->mouvement->creer; +$permissiontodelete = $user->rights->stock->mouvement->creer; // There is no deletion permission for stock movement as we shoul dnever delete + +$usercanread = $user->rights->stock->mouvement->lire; +$usercancreate = $user->rights->stock->mouvement->creer; +$usercandelete = $user->rights->stock->mouvement->creer; + /* * Actions */ -$usercanread = (($user->rights->stock->mouvement->lire)); -$usercancreate = (($user->rights->stock->mouvement->creer)); -$usercandelete = (($user->rights->stock->mouvement->supprimer)); - if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } @@ -139,26 +146,35 @@ $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'); -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - -// Do we click on purge search criteria ? -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers +if (empty($reshook)) { - $year = ''; - $month = ''; - $search_ref = ''; - $search_movement = ""; - $search_type_mouvement = ""; - $search_inventorycode = ""; - $search_product_ref = ""; - $search_product = ""; - $search_warehouse = ""; - $search_user = ""; - $search_batch = ""; - $search_qty = ''; - $sall = ""; - $toselect = ''; - $search_array_options = array(); + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Do we click on purge search criteria ? + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers + { + $year = ''; + $month = ''; + $search_ref = ''; + $search_movement = ""; + $search_type_mouvement = ""; + $search_inventorycode = ""; + $search_product_ref = ""; + $search_product = ""; + $search_warehouse = ""; + $search_user = ""; + $search_batch = ""; + $search_qty = ''; + $sall = ""; + $toselect = ''; + $search_array_options = array(); + } + + // Mass actions + $objectclass = 'MouvementStock'; + $objectlabel = 'MouvementStock'; + $uploaddir = $conf->stock->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } // Correct stock @@ -600,8 +616,8 @@ if ($resql) $resqlbis = $db->query($sql); if ($resqlbis) { - $obj = $db->fetch_object($resqlbis); - $lastmovementdate = $db->jdate($obj->datem); + $objbis = $db->fetch_object($resqlbis); + $lastmovementdate = $db->jdate($objbis->datem); } else { @@ -694,8 +710,9 @@ if ($resql) // 'presend'=>$langs->trans("SendByMail"), // 'builddoc'=>$langs->trans("PDFMerge"), ); - //if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); - if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); + // By default, we should never accept deletion of stock movement. + if (! empty($conf->global->STOCK_ALLOW_DELETE_OF_MOVEMENT) && $permissiontodelete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); + if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; @@ -713,6 +730,13 @@ if ($resql) if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit); else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); + // Add code for pre mass action (confirmation or email presend form) + $topicmail = "SendStockMovement"; + $modelmail = "movementstock"; + $objecttmp = new MouvementStock($db); + $trackid = 'mov'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($sall) { foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); @@ -961,6 +985,8 @@ if ($resql) $arrayofuniqueproduct = array(); + $i = 0; + $totalarray = array(); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); @@ -1126,8 +1152,8 @@ if ($resql) 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"' : '').'>'; + if (in_array($objp->mid, $arrayofselected)) $selected = 1; + print '<input id="cb'.$objp->mid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objp->mid.'"'.($selected ? ' checked="checked"' : '').'>'; } print '</td>'; if (!$i) $totalarray['nbfield']++; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 2489104eb34..3ae9866d73f 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -606,8 +606,8 @@ if (!empty($arrayfields['t.progress']['checked'])) /*print '<td class="right maxwidth100">'.$langs->trans("TimeSpent").'</td>'; if ($usertoprocess->id == $user->id) print '<td class="right maxwidth100">'.$langs->trans("TimeSpentByYou").'</td>'; else print '<td class="right maxwidth100">'.$langs->trans("TimeSpentByUser").'</td>';*/ -print '<th class="right maxwidth100">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</th>'; -print '<th class="right maxwidth100">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br>('.dol_trunc($usertoprocess->firstname, 10).')' : '').'</th>'; +print '<th class="right maxwidth100">'.$langs->trans("TimeSpent").'<br><span class="opacitymedium">'.$langs->trans("Everybody").'</span></th>'; +print '<th class="right maxwidth100">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br><span class="opacitymedium">'.dol_trunc($usertoprocess->firstname, 10).'</span>' : '').'</th>'; print '<th class="center leftborder">'.$langs->trans("HourStart").'</td>'; // By default, we can edit only tasks we are assigned to diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index d121b39b683..7f337818c1d 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -21,7 +21,7 @@ /** * \file htdocs/projet/activity/permonth.php * \ingroup projet - * \brief List activities of tasks (per week entry) + * \brief List activities of tasks (per month entry) */ require "../../main.inc.php"; @@ -480,8 +480,7 @@ print '<td class="liste_titre"></td>'; print '<td class="liste_titre right"><input type="text" size="4" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).'"></td>'; print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>'; -$countWeek = count($TWeek); -for ($idw=0;$idw<$countWeek;$idw++) +foreach ($TWeek as $week_number) { print '<td class="liste_titre"></td>'; } @@ -501,8 +500,8 @@ print '<td align="right" class="maxwidth75">'.$langs->trans("ProgressDeclared"). /*print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>'; if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByYou").'</td>'; else print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByUser").'</td>';*/ -print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</td>'; -print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br>('.dol_trunc($usertoprocess->firstname, 10).')' : '').'</td>'; +print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'<br><span class="opacitymedium">'.$langs->trans("Everybody").'</span></td>'; +print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br><span class="opacitymedium">'.dol_trunc($usertoprocess->firstname, 10).'</span>' : '').'</td>'; foreach ($TWeek as $week_number) { @@ -516,6 +515,8 @@ $colspan=5; // By default, we can edit only tasks we are assigned to $restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)?1:0); +$isavailable = array(); + if (count($tasksarray) > 0) { //var_dump($tasksarray); // contains only selected tasks @@ -616,6 +617,7 @@ print "</table>"; print '</div>'; print '<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).'"/>'."\n"; +print '<input type="hidden" id="numberOfFirstLine" name="numberOfFirstLine" value="'.(reset($TWeek)).'"/>'."\n"; print '<div class="center">'; print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; @@ -639,11 +641,9 @@ if ($conf->use_javascript_ajax) } });'."\n"; - $idw=0; - while ($idw < 7) + foreach ($TWeek as $week_number) { - print ' updateTotal('.$idw.',\''.$modeinput.'\');'; - $idw++; + print ' updateTotal('.$week_number.',\''.$modeinput.'\');'; } print "\n});\n"; print '</script>'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 563b7ca19c9..8b8ba5d7295 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -309,6 +309,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac $object->timespent_fk_user = $usertoprocess->id; $object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd'); $object->timespent_datehour = $object->timespent_date; + $object->timespent_note = $object->description; $result = $object->addTimeSpent($user); if ($result < 0) @@ -659,8 +660,8 @@ if (!empty($arrayfields['t.progress']['checked'])) /*print '<td class="maxwidth75 right">'.$langs->trans("TimeSpent").'</td>'; if ($usertoprocess->id == $user->id) print '<td class="maxwidth75 right">'.$langs->trans("TimeSpentByYou").'</td>'; else print '<td class="maxwidth75 right">'.$langs->trans("TimeSpentByUser").'</td>';*/ -print '<th class="maxwidth75 right">'.$langs->trans("TimeSpent").'<br>('.$langs->trans("Everybody").')</th>'; -print '<th class="maxwidth75 right">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br>('.dol_trunc($usertoprocess->firstname, 10).')' : '').'</th>'; +print '<th class="maxwidth75 right">'.$langs->trans("TimeSpent").'<br><span class="opacitymedium">'.$langs->trans("Everybody").'</span></th>'; +print '<th class="maxwidth75 right">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br><span class="opacitymedium">'.dol_trunc($usertoprocess->firstname, 10).'</span>' : '').'</th>'; for ($idw = 0; $idw < 7; $idw++) { diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 54075318246..d8f020708df 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2005-2020 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014-2017 Marcos García <marcosgdf@gmail.com> @@ -701,7 +701,7 @@ class Project extends CommonObject 'propal'=>'fk_projet', 'commande'=>'fk_projet', 'facture'=>'fk_projet', 'supplier_proposal'=>'fk_projet', 'commande_fournisseur'=>'fk_projet', 'facture_fourn'=>'fk_projet', 'expensereport_det'=>'fk_projet', 'contrat'=>'fk_projet', 'fichinter'=>'fk_projet', 'don'=>'fk_projet', - 'actioncomm'=>'fk_project', 'mo'=>'fk_project' + 'actioncomm'=>'fk_project', 'mrp_mo'=>'fk_project' ); foreach ($listoftables as $key => $value) { diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 1895270d758..0499629022d 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -51,7 +51,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); if ($id > 0 || ! empty($ref)) { - $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); + $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); } // Get parameters @@ -94,11 +94,11 @@ if ($object->id > 0) { $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); - // To verify role of users - //$userAccess = $object->restrictedProjectArea($user,'read'); - $userWrite = $object->restrictedProjectArea($user, 'write'); - //$userDelete = $object->restrictedProjectArea($user,'delete'); - //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; + // To verify role of users + //$userAccess = $object->restrictedProjectArea($user,'read'); + $userWrite = $object->restrictedProjectArea($user, 'write'); + //$userDelete = $object->restrictedProjectArea($user,'delete'); + //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; $head = project_prepare_head($object); dol_fiche_head($head, 'document', $langs->trans("Project"), -1, ($object->public?'projectpub':'project')); @@ -122,15 +122,15 @@ if ($object->id > 0) // Thirdparty if ($object->thirdparty->id > 0) { - $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref.='</div>'; // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { - $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',', array_keys($objectsListId)):'0').")"; + $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',', array_keys($objectsListId)):'0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/ganttchart.inc.php b/htdocs/projet/ganttchart.inc.php index cd6b728ebbe..2411e3957d0 100644 --- a/htdocs/projet/ganttchart.inc.php +++ b/htdocs/projet/ganttchart.inc.php @@ -171,58 +171,58 @@ else function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $project_id = null) { global $langs; - global $dateformatinput2; + global $dateformatinput2; - $start_date = $task["task_start_date"]; - $end_date = $task["task_end_date"]; - if (!$end_date) $end_date = $start_date; - $start_date = dol_print_date($start_date, $dateformatinput2); - $end_date = dol_print_date($end_date, $dateformatinput2); - // Resources - $resources = $task["task_resources"]; - // Define depend (ex: "", "4,13", ...) - $depend = ''; - $count = 0; - foreach ($task_dependencies as $value) { - // Not yet used project_dependencies = array(array(0=>idtask,1=>idtasktofinishfisrt)) - if ($value[0] == $task['task_id']) { - $depend.=($count>0?",":"").$value[1]; - $count ++; - } - } - // $depend .= "\""; - // Define parent - if ($project_id && $level < 0) - { - $parent = '-'.$project_id; - } - else - { - $parent = $task["task_parent_alternate_id"]; - //$parent = $task["task_parent"]; - } - // Define percent - $percent = $task['task_percent_complete']?$task['task_percent_complete']:0; - // Link (more information) - if ($task["task_id"] < 0) - { - //$link=DOL_URL_ROOT.'/projet/tasks.php?withproject=1&id='.abs($task["task_id"]); - $link=''; - } - else - { - $link=DOL_URL_ROOT.'/projet/tasks/contact.php?withproject=1&id='.$task["task_id"]; - } + $start_date = $task["task_start_date"]; + $end_date = $task["task_end_date"]; + if (!$end_date) $end_date = $start_date; + $start_date = dol_print_date($start_date, $dateformatinput2); + $end_date = dol_print_date($end_date, $dateformatinput2); + // Resources + $resources = $task["task_resources"]; + // Define depend (ex: "", "4,13", ...) + $depend = ''; + $count = 0; + foreach ($task_dependencies as $value) { + // Not yet used project_dependencies = array(array(0=>idtask,1=>idtasktofinishfisrt)) + if ($value[0] == $task['task_id']) { + $depend.=($count>0?",":"").$value[1]; + $count ++; + } + } + // $depend .= "\""; + // Define parent + if ($project_id && $level < 0) + { + $parent = '-'.$project_id; + } + else + { + $parent = $task["task_parent_alternate_id"]; + //$parent = $task["task_parent"]; + } + // Define percent + $percent = $task['task_percent_complete']?$task['task_percent_complete']:0; + // Link (more information) + if ($task["task_id"] < 0) + { + //$link=DOL_URL_ROOT.'/projet/tasks.php?withproject=1&id='.abs($task["task_id"]); + $link=''; + } + else + { + $link=DOL_URL_ROOT.'/projet/tasks/contact.php?withproject=1&id='.$task["task_id"]; + } - // Name - //$name='<a href="'.DOL_URL_ROOT.'/projet/task/tasks.php?id='.$task['task_id'].'">'.$task['task_name'].'</a>'; - $name=$task['task_name']; + // Name + //$name='<a href="'.DOL_URL_ROOT.'/projet/task/tasks.php?id='.$task['task_id'].'">'.$task['task_name'].'</a>'; + $name=$task['task_name']; - /*for($i=0; $i < $level; $i++) { + /*for($i=0; $i < $level; $i++) { $name=' - '.$name; }*/ - // Add line to gantt - /* + // Add line to gantt + /* g.AddTaskItem(new JSGantt.TaskItem(1, 'Define Chart API','', '', 'ggroupblack','', 0, 'Brian', 0, 1,0,1,'','','Some Notes text',g)); g.AddTaskItem(new JSGantt.TaskItem(11,'Chart Object', '2014-02-20','2014-02-20','gmilestone', '', 1, 'Shlomy',100,0,1,1,'','','',g)); </pre> @@ -247,30 +247,30 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje <dt>pGantt</dt><dd>(required) javascript JSGantt.GanttChart object from which to take settings. Defaults to &quot;g&quot; for backwards compatibility</dd> */ - //$note=""; + //$note=""; - $s = "\n// Add task level = ".$level." id=".$task["task_id"]." parent_id=".$task["task_parent"]." aternate_id=".$task["task_alternate_id"]." parent_aternate_id=".$task["task_parent_alternate_id"]."\n"; + $s = "\n// Add task level = ".$level." id=".$task["task_id"]." parent_id=".$task["task_parent"]." aternate_id=".$task["task_alternate_id"]." parent_aternate_id=".$task["task_parent_alternate_id"]."\n"; - //$task["task_is_group"]=1; // When task_is_group is 1, content will be autocalculated from sum of all low tasks + //$task["task_is_group"]=1; // When task_is_group is 1, content will be autocalculated from sum of all low tasks - // For JSGanttImproved - $css = $task['task_css']; - $line_is_auto_group = $task["task_is_group"]; - //$line_is_auto_group=0; - //if ($line_is_auto_group) $css = 'ggroupblack'; - //$dependency = ($depend?$depend:$parent."SS"); - $dependency = ''; - //$name = str_repeat("..", $level).$name; + // For JSGanttImproved + $css = $task['task_css']; + $line_is_auto_group = $task["task_is_group"]; + //$line_is_auto_group=0; + //if ($line_is_auto_group) $css = 'ggroupblack'; + //$dependency = ($depend?$depend:$parent."SS"); + $dependency = ''; + //$name = str_repeat("..", $level).$name; - $taskid = $task["task_alternate_id"]; - //$taskid = $task['task_id']; + $taskid = $task["task_alternate_id"]; + //$taskid = $task['task_id']; - $note = $task['note']; + $note = $task['note']; - $note = dol_concatdesc($note, $langs->trans("Workload").' : '.($task['task_planned_workload'] ? convertSecondToTime($task['task_planned_workload'], 'allhourmin') : '')); + $note = dol_concatdesc($note, $langs->trans("Workload").' : '.($task['task_planned_workload'] ? convertSecondToTime($task['task_planned_workload'], 'allhourmin') : '')); - $s.= "g.AddTaskItem(new JSGantt.TaskItem('".$taskid."', '".dol_escape_js(trim($name))."', '".$start_date."', '".$end_date."', '".$css."', '".$link."', ".$task['task_milestone'].", '".dol_escape_js($resources)."', ".($percent >= 0 ? $percent : 0).", ".$line_is_auto_group.", '".$parent."', 1, '".$dependency."', '".(empty($task["task_is_group"]) ? (($percent >= 0 && $percent != '') ? $percent.'%' : '') : '')."', '".dol_escape_js($note)."', g));"; - echo $s; + $s.= "g.AddTaskItem(new JSGantt.TaskItem('".$taskid."', '".dol_escape_js(trim($name))."', '".$start_date."', '".$end_date."', '".$css."', '".$link."', ".$task['task_milestone'].", '".dol_escape_js($resources)."', ".($percent >= 0 ? $percent : 0).", ".$line_is_auto_group.", '".$parent."', 1, '".$dependency."', '".(empty($task["task_is_group"]) ? (($percent >= 0 && $percent != '') ? $percent.'%' : '') : '')."', '".dol_escape_js($note)."', g));"; + echo $s; } /** @@ -284,15 +284,15 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje */ function findChildGanttLine($tarr, $parent, $task_dependencies, $level) { - $n=count($tarr); + $n=count($tarr); - $old_parent_id = 0; - for ($x=0; $x < $n; $x++) - { - if($tarr[$x]["task_parent"] == $parent && $tarr[$x]["task_parent"] != $tarr[$x]["task_id"]) - { - // Create a grouping parent task for the new level - /*if (empty($old_parent_id) || $old_parent_id != $tarr[$x]['task_project_id']) + $old_parent_id = 0; + for ($x=0; $x < $n; $x++) + { + if($tarr[$x]["task_parent"] == $parent && $tarr[$x]["task_parent"] != $tarr[$x]["task_id"]) + { + // Create a grouping parent task for the new level + /*if (empty($old_parent_id) || $old_parent_id != $tarr[$x]['task_project_id']) { $tmpt = array( 'task_id'=> -98, 'task_name'=>'Level '.$level, 'task_resources'=>'', 'task_start_date'=>'', 'task_end_date'=>'', @@ -301,9 +301,9 @@ function findChildGanttLine($tarr, $parent, $task_dependencies, $level) $old_parent_id = $tarr[$x]['task_project_id']; }*/ - constructGanttLine($tarr, $tarr[$x], $task_dependencies, $level, null); - findChildGanttLine($tarr, $tarr[$x]["task_id"], $task_dependencies, $level+1); - } - } + constructGanttLine($tarr, $tarr[$x], $task_dependencies, $level, null); + findChildGanttLine($tarr, $tarr[$x]["task_id"], $task_dependencies, $level+1); + } + } } diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 09fcab7fedb..38d12081b4f 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -274,6 +274,7 @@ dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1, ''); print '<div class="fichecenter"><div class="fichethirdleft">'; print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; +print '<input type="hidden" name="token" value="'.newToken().'">'; print '<table class="noborder centpercent">'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index dafd5ae0071..c758664d2c6 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -139,6 +139,7 @@ dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1, ''); print '<div class="fichecenter"><div class="fichethirdleft">'; print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; +print '<input type="hidden" name="token" value="'.newToken().'">'; print '<table class="noborder centpercent">'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index a94b0659950..e20bff22e5a 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -46,7 +46,7 @@ if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defi */ function llxHeaderVierge() { - print '<html><title>Export agenda cal</title><body>'; + print '<html><title>Export agenda cal</title><body>'; } /** * Footer function @@ -55,7 +55,7 @@ function llxHeaderVierge() */ function llxFooterVierge() { - print '</body></html>'; + print '</body></html>'; } require '../../main.inc.php'; @@ -129,12 +129,12 @@ $filename=$shortfilename; // Complete long filename foreach ($filters as $key => $value) { - //if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename + //if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename if ($key == 'year') $filename.='-year'.$value; - if ($key == 'id') $filename.='-id'.$value; - if ($key == 'idfrom') $filename.='-idfrom'.$value; - if ($key == 'idto') $filename.='-idto'.$value; - if ($key == 'project') $filename.='-project'.$value; + if ($key == 'id') $filename.='-id'.$value; + if ($key == 'idfrom') $filename.='-idfrom'.$value; + if ($key == 'idto') $filename.='-idto'.$value; + if ($key == 'project') $filename.='-project'.$value; if ($key == 'logina') $filename.='-logina'.$value; // Author if ($key == 'logint') $filename.='-logint'.$value; // Assigned to if ($key == 'notactiontype') $filename.='-notactiontype'.$value; @@ -149,7 +149,7 @@ if ($shortfilename=='dolibarrcalendar') $langs->load("main"); $langs->load("errors"); llxHeaderVierge(); - print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX", 'format').'</div>'; + print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX", 'format').'</div>'; llxFooterVierge(); exit; } @@ -186,7 +186,7 @@ if ($format == 'ical' || $format == 'vcal') $result=readfile($outputfile); if (! $result) print 'File '.$outputfile.' was empty.'; - //header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); + //header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); exit; } else diff --git a/htdocs/public/emailing/mailing-read.php b/htdocs/public/emailing/mailing-read.php index 7b9726bcfc5..e7a0266e339 100644 --- a/htdocs/public/emailing/mailing-read.php +++ b/htdocs/public/emailing/mailing-read.php @@ -81,7 +81,7 @@ if (! empty($tag)) $resql=$db->query($sql); - //Update status communication of contact prospect + //Update status communication of contact prospect $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG); diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index 32a83e5c432..195a7560631 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -152,7 +152,7 @@ function llxHeaderVierge($title, $head = "") */ function llxFooterVierge() { - printCommonFooter('public'); + printCommonFooter('public'); print "</body>\n"; print "</html>\n"; diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 1dfe694f154..0514c5ad565 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -56,10 +56,10 @@ function llxHeaderVierge($title, $head = "") header("Content-type: text/html; charset=".$conf->file->character_set_client); print "<html>\n"; - print "<head>\n"; - print "<title>".$title."</title>\n"; - if ($head) print $head."\n"; - print "</head>\n"; + print "<head>\n"; + print "<title>".$title."</title>\n"; + if ($head) print $head."\n"; + print "</head>\n"; print '<body class="public_body">'."\n"; } @@ -70,9 +70,9 @@ function llxHeaderVierge($title, $head = "") */ function llxFooterVierge() { - printCommonFooter('public'); + printCommonFooter('public'); - print "</body>\n"; + print "</body>\n"; print "</html>\n"; } diff --git a/htdocs/public/notice.php b/htdocs/public/notice.php index 43344c376aa..090f2e81358 100644 --- a/htdocs/public/notice.php +++ b/htdocs/public/notice.php @@ -36,14 +36,14 @@ require '../main.inc.php'; if (! GETPOST('transkey', 'alphanohtml') && ! GETPOST('transphrase', 'alphanohtml')) { - print 'Sorry, it seems your internet connexion is off.<br>'; - print 'You need to be connected to network to use this software.<br>'; + print 'Sorry, it seems your internet connexion is off.<br>'; + print 'You need to be connected to network to use this software.<br>'; } else { - $langs->load("error"); - $langs->load("other"); + $langs->load("error"); + $langs->load("other"); - if (GETPOST('transphrase', 'alphanohtml')) print GETPOST('transphrase', 'alphanohtml'); - if (GETPOST('transkey', 'alphanohtml')) print $langs->trans(GETPOST('transkey', 'alphanohtml')); + if (GETPOST('transphrase', 'alphanohtml')) print GETPOST('transphrase', 'alphanohtml'); + if (GETPOST('transkey', 'alphanohtml')) print $langs->trans(GETPOST('transkey', 'alphanohtml')); } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index ab011dd219a..ef5458456c5 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -250,17 +250,18 @@ $form = new Form($db); $arrayofjs = array(); $arrayofcss = array('/opensurvey/css/style.css'); -llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); + +llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss, $numsondage); if (empty($object->ref)) // For survey, id is a hex string { - $langs->load("errors"); - print $langs->trans("ErrorRecordNotFound"); + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); - llxFooterSurvey(); + llxFooterSurvey(); - $db->close(); - exit(); + $db->close(); + exit(); } // Define format of choices @@ -274,6 +275,7 @@ foreach ($toutsujet as $value) $toutsujet = str_replace("°", "'", $toutsujet); + print '<div class="survey_invitation">'.$langs->trans("YouAreInivitedToVote").'</div>'; print $langs->trans("OpenSurveyHowTo").'<br><br>'; @@ -301,9 +303,6 @@ if (!$canbemodified) { exit; } -print '<form name="formulaire" action="studs.php?sondage='.$numsondage.'"'.'#bas" method="POST">'."\n"; -print '<input type="hidden" name="sondage" value="'.$numsondage.'"/>'; - print '<div class="cadre"> '."\n"; print '<br><br>'."\n"; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 5029d717a10..28060a6d71e 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -658,6 +658,7 @@ if ($ispaymentok) } $paiement->paiementid = $paymentTypeId; $paiement->num_paiement = ''; + $paiement->num_payment = ''; $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; $paiement->ext_payment_id = $TRANSACTIONID; $paiement->ext_payment_site = $service; diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index c0ce22d69ed..3da50335e55 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -48,9 +48,9 @@ if (empty($usedolheader)) } else { - $arraycss=array(); - $arrayjs=array(); - /* + $arraycss=array(); + $arrayjs=array(); + /* $arraycss=array('/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css', '/includes/jquery/plugins/datatables/extensions/Buttons/css/buttons.dataTables.min.css', '/includes/jquery/plugins/datatables/extensions/ColReorder/css/colReorder.dataTables.min.css' @@ -207,12 +207,12 @@ $moreforfilter.='</div>'; if (! empty($moreforfilter)) { - print '<div class="liste_titre liste_titre_bydiv centpercent">'; - print $moreforfilter; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print '</div>'; + print '<div class="liste_titre liste_titre_bydiv centpercent">'; + print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '</div>'; } ?> @@ -245,12 +245,12 @@ if (! empty($moreforfilter)) $(document).ready(function(){ $('#idtableexample2').dataTable( { <?php - if ($optioncss=='print') { - print '\'dom\': \'lfrtip\','; - } else { - print '\'dom\': \'Blfrtip\','; - } - ?> + if ($optioncss=='print') { + print '\'dom\': \'lfrtip\','; + } else { + print '\'dom\': \'Blfrtip\','; + } + ?> "colReorder": true, 'buttons': [ 'colvis','copy', 'csv', 'excel', 'pdf', 'print' diff --git a/htdocs/public/website/index.php b/htdocs/public/website/index.php index b624a847dc5..3b37a164fc8 100644 --- a/htdocs/public/website/index.php +++ b/htdocs/public/website/index.php @@ -158,16 +158,16 @@ global $dolibarr_main_data_root; if ($pageid == 'css') // No more used ? { - header('Content-type: text/css'); - // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. - //if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); - //else - header('Cache-Control: no-cache'); - $original_file=$dolibarr_main_data_root.'/website/'.$websitekey.'/styles.css.php'; + header('Content-type: text/css'); + // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. + //if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); + //else + header('Cache-Control: no-cache'); + $original_file=$dolibarr_main_data_root.'/website/'.$websitekey.'/styles.css.php'; } else { - $original_file=$dolibarr_main_data_root.'/website/'.$websitekey.'/page'.$pageid.'.tpl.php'; + $original_file=$dolibarr_main_data_root.'/website/'.$websitekey.'/page'.$pageid.'.tpl.php'; } // Find the subdirectory name as the reference @@ -177,7 +177,7 @@ $refname=basename(dirname($original_file)."/"); // Limite acces si droits non corrects if (! $accessallowed) { - accessforbidden(); + accessforbidden(); } // Security: @@ -185,10 +185,10 @@ if (! $accessallowed) // les noms de fichiers. if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) { - dol_syslog("Refused to deliver file ".$original_file); - $file=basename($original_file); // Do no show plain path of original_file in shown error message - dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $file)); - exit; + dol_syslog("Refused to deliver file ".$original_file); + $file=basename($original_file); // Do no show plain path of original_file in shown error message + dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $file)); + exit; } clearstatcache(); @@ -202,14 +202,14 @@ $original_file_osencoded=dol_osencode($original_file); // New file name encoded // This test if file exists should be useless. We keep it to find bug more easily if (! file_exists($original_file_osencoded)) { - // Return header 404 - header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); + // Return header 404 + header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404); - $langs->load("website"); - print $langs->trans("RequestedPageHasNoContentYet", $pageid); + $langs->load("website"); + print $langs->trans("RequestedPageHasNoContentYet", $pageid); - include DOL_DOCUMENT_ROOT.'/public/error-404.php'; - exit; + include DOL_DOCUMENT_ROOT.'/public/error-404.php'; + exit; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index b2723a0ce6a..83a28d55f48 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1610,7 +1610,7 @@ elseif ($id || $ref) if ($action == 'editline') { print '<form name="updateline" id="updateline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;lineid='.$line_id.'" method="POST"> - <input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'"> + <input type="hidden" name="token" value="' . newToken().'"> <input type="hidden" name="action" value="updateline"> <input type="hidden" name="mode" value=""> <input type="hidden" name="id" value="' . $object->id.'">'; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 595100b771c..0381892d9e3 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -47,7 +47,7 @@ class Reception extends CommonObject public $fk_element = "fk_reception"; public $table_element = "reception"; public $table_element_line = "commande_fournisseur_dispatch"; - protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php index a9ed8667474..769f67db44b 100644 --- a/htdocs/reception/index.php +++ b/htdocs/reception/index.php @@ -34,8 +34,7 @@ $hookmanager = new HookManager($db); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('receptionindex')); -$langs->load("orders"); -$langs->load("receptions"); +$langs->loadLangs(array("orders", "receptions")); /* * View @@ -66,9 +65,11 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print "</table></div></form><br>\n"; } + /* - * Receptions to validate + * Draft receptions */ + $clause = " WHERE "; $sql = "SELECT e.rowid, e.ref, e.ref_supplier,"; @@ -91,13 +92,14 @@ if ($socid) $sql.= " AND c.fk_soc = ".$socid; $resql=$db->query($sql); if ($resql) { + print '<div class="div-table-responsive-no-min">'; + print '<table class="noborder centpercent">'; + print '<tr class="liste_titre">'; + print '<th colspan="3">'.$langs->trans("ReceptionsToValidate").'</th></tr>'; + $num = $db->num_rows($resql); if ($num) { - print '<div class="div-table-responsive-no-min">'; - print '<table class="noborder centpercent">'; - print '<tr class="liste_titre">'; - print '<th colspan="3">'.$langs->trans("ReceptionsToValidate").'</th></tr>'; $i = 0; while ($i < $num) { @@ -118,132 +120,24 @@ if ($resql) print '</td></tr>'; $i++; } - print "</table></div><br>"; } -} - - -/* - * CommandeFournisseurs a traiter - */ -$sql = "SELECT c.rowid, c.ref, c.ref_supplier as ref_supplier, c.fk_statut, s.nom as name, s.rowid as socid"; -$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c,"; -$sql.= " ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE c.fk_soc = s.rowid"; -$sql.= " AND c.entity = ".$conf->entity; -$sql.= " AND c.fk_statut = 3";//Commandé -if ($socid) $sql.= " AND c.fk_soc = ".$socid; -if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -$sql.= " ORDER BY c.rowid ASC"; -$resql=$db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - if ($num) - { - $langs->load("orders"); - - $i = 0; - print '<div class="div-table-responsive-no-min">'; - print '<table class="noborder centpercent">'; - print '<tr class="liste_titre">'; - print '<th colspan="3">'.$langs->trans("SuppliersOrdersToProcess").'</th></tr>'; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $orderstatic->id=$obj->rowid; - $orderstatic->ref=$obj->ref; - $orderstatic->ref_supplier=$obj->ref_supplier; - $orderstatic->statut=$obj->fk_statut; - $orderstatic->facturee=0; - - $companystatic->name=$obj->name; - $companystatic->id=$obj->socid; - - print '<tr class="oddeven">'; - print '<td class="nowrap">'; - print $orderstatic->getNomUrl(1); - print '</td>'; - print '<td>'; - print $companystatic->getNomUrl(1, 'customer', 32); - print '</td>'; - print '<td class="right">'; - print $orderstatic->getLibStatut(3); - print '</td>'; - print '</tr>'; - $i++; - } - print "</table></div><br>"; + else { + print '<tr><td>'.$langs->trans("None").'</td><td></td><td></td></tr>'; } + + print "</table></div><br>"; } //print '</td><td valign="top" width="70%">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; +$max = 5; /* - * CommandeFournisseurs en traitement + * Latest receptions */ -$sql = "SELECT c.rowid, c.ref, c.ref_supplier as ref_supplier, c.fk_statut as status, c.billed as billed, s.nom as name, s.rowid as socid"; -$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c,"; -$sql.= " ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE c.fk_soc = s.rowid"; -$sql.= " AND c.entity = ".$conf->entity; -$sql.= " AND c.fk_statut IN (4)"; -if ($socid) $sql.= " AND c.fk_soc = ".$socid; -if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -$resql = $db->query($sql); -if ( $resql ) -{ - $langs->load("orders"); - - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - print '<div class="div-table-responsive-no-min">'; - print '<table class="noborder centpercent">'; - print '<tr class="liste_titre">'; - print '<th colspan="3">'.$langs->trans("SuppliersOrdersInProcess").'</th></tr>'; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $orderstatic->id=$obj->rowid; - $orderstatic->ref=$obj->ref; - $orderstatic->ref_supplier=$obj->ref_supplier; - $orderstatic->statut=$obj->status; - $orderstatic->facturee=$obj->billed; - - $companystatic->name=$obj->name; - $companystatic->id=$obj->socid; - - print '<tr class="oddeven"><td>'; - print $orderstatic->getNomUrl(1); - print '</td>'; - print '<td>'; - print $companystatic->getNomUrl(1, 'customer'); - print '</td>'; - print '<td class="right">'; - print $orderstatic->getLibStatut(3); - print '</td>'; - print '</tr>'; - $i++; - } - print "</table></div><br>"; - } -} -else dol_print_error($db); - - -/* - * Last receptions - */ $sql = "SELECT e.rowid, e.ref, e.ref_supplier,"; $sql.= " s.nom as name, s.rowid as socid,"; $sql.= " c.ref as commande_fournisseur_ref, c.rowid as commande_fournisseur_id"; @@ -257,8 +151,7 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND sc.fk_user $sql.= " AND e.fk_statut = 1"; if ($socid) $sql.= " AND c.fk_soc = ".$socid; $sql.= " ORDER BY e.date_delivery DESC"; - -$sql.= $db->plimit(5, 0); +$sql.= $db->plimit($max, 0); $resql = $db->query($sql); if ($resql) @@ -267,7 +160,7 @@ if ($resql) if ($num) { $i = 0; - print '<div class="div-table-responsive-no-min">'; + print '<div class="div-table-responsive-no-min">'; print '<table class="noborder centpercent">'; print '<tr class="liste_titre">'; print '<th colspan="3">'.$langs->trans("LastReceptions", $num).'</th></tr>'; @@ -301,6 +194,64 @@ if ($resql) else dol_print_error($db); + +/* + * Supplier orders to process + */ + +$sql = "SELECT c.rowid, c.ref, c.ref_supplier as ref_supplier, c.fk_statut as status, c.billed as billed, s.nom as name, s.rowid as socid"; +$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c,"; +$sql.= " ".MAIN_DB_PREFIX."societe as s"; +if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= " WHERE c.fk_soc = s.rowid"; +$sql.= " AND c.entity IN (".getEntity('supplier_order').")"; +$sql.= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")"; +if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid; +if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +$sql.= " ORDER BY c.rowid ASC"; +$resql=$db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + if ($num) + { + $langs->load("orders"); + + $i = 0; + print '<div class="div-table-responsive-no-min">'; + print '<table class="noborder centpercent">'; + print '<tr class="liste_titre">'; + print '<th colspan="3">'.$langs->trans("SuppliersOrdersToProcess").'</th></tr>'; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + $orderstatic->id=$obj->rowid; + $orderstatic->ref=$obj->ref; + $orderstatic->ref_supplier=$obj->ref_supplier; + $orderstatic->statut=$obj->status; + $orderstatic->facturee=$obj->billed; + + $companystatic->name=$obj->name; + $companystatic->id=$obj->socid; + + print '<tr class="oddeven">'; + print '<td class="nowrap">'; + print $orderstatic->getNomUrl(1); + print '</td>'; + print '<td>'; + print $companystatic->getNomUrl(1, 'customer', 32); + print '</td>'; + print '<td class="right">'; + print $orderstatic->getLibStatut(3); + print '</td>'; + print '</tr>'; + $i++; + } + print "</table></div><br>"; + } +} + print '</div></div></div>'; $parameters = array('user' => $user); diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index f36c8cf4a86..251247a252b 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -341,7 +341,7 @@ print '</table>'; */ print '<br>'; -print '<i>'.$langs->trans("StatsOnReceptionsOnlyValidated").'</i>'; +print '<i class="opacitymedium">'.$langs->trans("StatsOnReceptionsOnlyValidated").'</i>'; llxFooter(); diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index 3e2a004e194..f57b810394a 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -52,11 +52,11 @@ $result = $object->fetch($id, $ref); if ($action == 'addcontact' && $user->rights->resource->write) { - if ($result > 0 && $id > 0) - { - $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); + if ($result > 0 && $id > 0) + { + $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $result = $object->add_contact($contactid, GETPOST('type', 'int'), GETPOST('source', 'alpha')); - } + } if ($result >= 0) { @@ -79,7 +79,7 @@ if ($action == 'addcontact' && $user->rights->resource->write) // Toggle the status of a contact elseif ($action == 'swapstatut' && $user->rights->resource->write) { - $result=$object->swapContactStatus(GETPOST('ligne', 'int')); + $result=$object->swapContactStatus(GETPOST('ligne', 'int')); } // Erase a contact diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index e96b6776664..25c5be2c79d 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -193,6 +193,8 @@ print '<div class="fichecenter"><div class="fichethirdleft">'; // Show filter box print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; +print '<input type="hidden" name="token" value="'.newToken().'">'; + print '<table class="noborder centpercent">'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; // User diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index 0b6375a1f64..86f40ee7a6c 100644 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -79,9 +79,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '<div class="tabsAction">'; - print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; - print "</div>"; + print '<div class="tabsAction">'; + print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; + print "</div>"; } @@ -96,7 +96,7 @@ if ($action == 'create') print '<br><div id="newattrib"></div>'; print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -106,10 +106,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "<br>"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "<br>"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index 694479ebd0e..11a56314b02 100644 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -79,9 +79,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '<div class="tabsAction">'; - print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; - print "</div>"; + print '<div class="tabsAction">'; + print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; + print "</div>"; } @@ -93,10 +93,10 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print '<br><div id="newattrib"></div>'; - print load_fiche_titre($langs->trans('NewAttribute')); + print '<br><div id="newattrib"></div>'; + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -106,10 +106,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print '<br><div id="editattrib"></div>'; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print '<br><div id="editattrib"></div>'; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index edc00088c39..22da0cd0545 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -98,6 +98,13 @@ if (!empty($canvas)) // Security check $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas); +$permissiontoread = $user->rights->societe->lire; +$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->rights->societe->delete || ($permissiontoadd && isset($object->status) && $object->status == 0); +$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php +$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1]; + /* * Actions @@ -1186,7 +1193,7 @@ else print '<table class="border centpercent">'; // Name, firstname - print '<tr><td class="titlefieldcreate">'; + print '<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">'; if ($object->particulier || $private) { print '<span id="TypeName" class="fieldrequired">'.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').'</span>'; @@ -1196,7 +1203,9 @@ else print '<span id="TypeName" class="fieldrequired">'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).'</span>'; } print '</td><td'.(empty($conf->global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; - print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.$object->name.'" autofocus="autofocus"></td>'; + print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.$object->name.'" autofocus="autofocus">'; + print $form->widgetForTranslation("name", $object, $permissiontoadd); + print '</td>'; if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print '<td>'.$langs->trans('Prefix').'</td><td><input type="text" size="5" maxlength="5" name="prefix_comm" value="'.$object->prefix_comm.'"></td>'; @@ -1286,16 +1295,20 @@ else // Barcode if (!empty($conf->barcode->enabled)) { - print '<tr><td>'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).'</td>'; + print '<tr><td>'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).'</td>'; print '<td colspan="3"><input type="text" name="barcode" id="barcode" value="'.$object->barcode.'">'; print '</td></tr>'; } // Address - print '<tr><td class="tdtop">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>'; + print '<tr><td class="tdtop">'; + print $form->editfieldkey('Address', 'address', '', $object, 0); + print '</td>'; print '<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.'" wrap="soft">'; print $object->address; - print '</textarea></td></tr>'; + print '</textarea>'; + print $form->widgetForTranslation("address", $object, $permissiontoadd); + print '</td></tr>'; // Zip / Town print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>'; @@ -1304,6 +1317,7 @@ else if ($conf->browser->layout == 'phone') print '</tr><tr>'; print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>'; print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); + print $form->widgetForTranslation("town", $object, $permissiontoadd); print '</td></tr>'; // Country diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ad5c66a50b8..e61c98e3267 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -712,6 +712,7 @@ class Societe extends CommonObject */ public $multicurrency_code; + /** * Constructor * diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 06d60843a79..fa8ac3d9469 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -102,6 +102,7 @@ $search_parent_name = GETPOST('search_parent_name', 'alpha'); $type = GETPOST('type', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $mode = GETPOST("mode", 'alpha'); +$place = GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'; // $place is string id of table for Bar or Restaurant $diroutputmassaction = $conf->societe->dir_output.'/temp/massgeneration/'.$user->id; @@ -111,7 +112,7 @@ $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "s.nom"; -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $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; @@ -228,7 +229,6 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); if ($action == "change") // Change customer for TakePOS { $idcustomer = GETPOST('idcustomer', 'int'); - $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant // Check if draft invoice already exists, if not create it $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")"; @@ -252,7 +252,8 @@ if ($action == "change") // Change customer for TakePOS $resql = $db->query($sql); ?> <script> - parent.$("#poslines").load("invoice.php?place="+<?php print $place; ?>, function() { + console.log("Reload page invoice.php with place=<?php print $place; ?>"); + parent.$("#poslines").load("invoice.php?place=<?php print $place; ?>", function() { //parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight); <?php if (!$resql) { ?> alert('Error failed to update customer on draft invoice.'); @@ -1030,8 +1031,7 @@ while ($i < min($num, $limit)) print '<tr class="oddeven"'; if ($contextpage == 'poslist') { - $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant - print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.$place.'\'"'; + print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.urlencode($place).'\'"'; } print '>'; if (!empty($arrayfields['s.rowid']['checked'])) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 185c7aaf6ea..c9fe7c41001 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1095,6 +1095,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print img_credit_card($companypaymentmodetemp->type); print '</td>'; print '<td>'; + if ($companypaymentmodetemp->proprio) print '<span class="opacitymedium">'.$companypaymentmodetemp->proprio.'</span><br>'; if ($companypaymentmodetemp->last_four) print '....'.$companypaymentmodetemp->last_four; if ($companypaymentmodetemp->exp_date_month || $companypaymentmodetemp->exp_date_year) print ' - '.sprintf("%02d", $companypaymentmodetemp->exp_date_month).'/'.$companypaymentmodetemp->exp_date_year.''; print '</td><td>'; @@ -1210,6 +1211,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '<span class="fa fa-university fa-2x fa-fw"></span>'; } print'</td>'; + // Information print '<td valign="middle">'; if ($src->object == 'card') { @@ -1225,7 +1227,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } elseif ($src->object == 'source' && $src->type == 'card') { - print $src->owner->name.'<br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; + print '<span class="opacitymedium">'.$src->owner->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '</td><td>'; if ($src->card->country) @@ -1238,7 +1240,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { - print 'info sepa'; + print 'SEPA debit'; print '</td><td>'; if ($src->sepa_debit->country) { @@ -1250,7 +1252,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } elseif ($src->object == 'payment_method' && $src->type == 'card') { - print $src->billing_details->name.'<br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; + print '<span class="opacitymedium">'.$src->billing_details->name.'</span><br>....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '</td><td>'; if ($src->card->country) @@ -1263,7 +1265,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { - print 'info sepa'; + print 'SEPA debit'; print '</td><td>'; if ($src->sepa_debit->country) { diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index b65f0486d17..6d69e692a96 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -256,7 +256,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print load_fiche_titre($langs->trans('PriceByCustomer')); print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">'; - print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">'; + print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="add_customer_price_confirm">'; print '<input type="hidden" name="socid" value="'.$object->id.'">'; print '<table class="border centpercent">'; @@ -334,7 +334,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">'; - print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">'; + print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="update_customer_price_confirm">'; print '<input type="hidden" name="lineid" value="'.$prodcustprice->id.'">'; print '<table class="border centpercent">'; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5067a4935bc..2c23f578fb4 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1041,7 +1041,7 @@ if (empty($reshook)) if (!$error) { - $result = $object->insertExtraFields('SUPPLIER_PROPOSAL_MODIFY'); + $result = $object->insertExtraFields('PROPOSAL_SUPPLIER_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -1125,7 +1125,7 @@ if ($action == 'create') $object = new SupplierProposal($db); print '<form name="addprop" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; - print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">'; + print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="add">'; if ($origin != 'project' && $originid) { print '<input type="hidden" name="origin" value="'.$origin.'">'; @@ -1150,7 +1150,7 @@ if ($action == 'create') } else { print '<td colspan="2">'; print $form->select_company('', 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); - print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>'; + print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>'; print '</td>'; } print '</tr>'."\n"; @@ -1230,8 +1230,8 @@ if ($action == 'create') print '<tr>'; print '<td>'.$langs->trans("Project").'</td><td colspan="2">'; - $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).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>'; + $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); + 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).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>'; print '</td>'; print '</tr>'; @@ -1433,7 +1433,7 @@ if ($action == 'create') require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; $notify = new Notify($db); $text .= '<br>'; - $text .= $notify->confirmMessage('SUPPLIER_PROPOSAL_VALIDATE', $object->socid, $object); + $text .= $notify->confirmMessage('PROPOSAL_SUPPLIER_VALIDATE', $object->socid, $object); } if (!$error) @@ -1534,7 +1534,7 @@ if ($action == 'create') print '<table class="nobordernopadding" width="100%"><tr><td>'; print $langs->trans('PaymentConditionsShort'); print '</td>'; - if ($action != 'editconditions' && $object->statut == SupplierProposal::STATUS_DRAFT) + if ($action != 'editconditions' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'</a></td>'; print '</tr></table>'; print '</td><td colspan="3">'; @@ -1557,8 +1557,8 @@ if ($action == 'create') print '</tr></table>'; print '</td><td colspan="3">'; if ($action == 'editdate_livraison') { - print '<form name="editdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; - print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">'; + print '<form name="editdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post" class="formconsumeproduce">'; + print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="action" value="setdate_livraison">'; print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">'; @@ -1575,7 +1575,7 @@ if ($action == 'create') print '<table class="nobordernopadding" width="100%"><tr><td>'; print $langs->trans('PaymentMode'); print '</td>'; - if ($action != 'editmode' && $object->statut == $object::STATUS_VALIDATED) + if ($action != 'editmode' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>'; print '</tr></table>'; print '</td><td colspan="3">'; @@ -1762,7 +1762,7 @@ if ($action == 'create') $result = $object->getLinesArray(); print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOST('lineid')).'" method="POST"> - <input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'"> + <input type="hidden" name="token" value="' . newToken().'"> <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> <input type="hidden" name="mode" value=""> <input type="hidden" name="id" value="' . $object->id.'"> @@ -1806,12 +1806,13 @@ if ($action == 'create') if ($action == 'statut') { // Form to set proposal accepted/refused - $form_close = '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">'; + $form_close = '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST" id="formacceptrefuse" class="formconsumeproduce">'; + $form_close .= '<input type="hidden" name="token" value="' . newToken() . '">'; + $form_close .= '<input type="hidden" name="action" value="setstatut">'; + if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '<p class="notice">'.$langs->trans('SupplierProposalRefFournNotice').'</p>'; // TODO Suggest a permanent checkbox instead of option - $form_close .= '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; $form_close .= '<table class="border centpercent">'; $form_close .= '<tr><td width="150" class="left">' . $langs->trans("CloseAs") . '</td><td class="left">'; - $form_close .= '<input type="hidden" name="action" value="setstatut">'; $form_close .= '<select id="statut" name="statut" class="flat">'; $form_close .= '<option value="0">&nbsp;</option>'; $form_close .= '<option value="2">' . $langs->trans('SupplierProposalStatusSigned') . '</option>'; @@ -1882,7 +1883,7 @@ if ($action == 'create') // Set accepted/refused if ($object->statut == SupplierProposal::STATUS_VALIDATED && $user->rights->supplier_proposal->cloturer) { - print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#acceptedrefused').'"'; + print '<div class="inline-block divButAction"><a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#acceptedrefused').'"'; print '>'.$langs->trans('SetAcceptedRefused').'</a></div>'; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 0570b78bcdd..d1d3b08bc2d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> - * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> + * Copyright (C) 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 @@ -1481,7 +1481,7 @@ class SupplierProposal extends CommonObject if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('SUPPLIER_PROPOSAL_VALIDATE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_VALIDATE', $user); if ($result < 0) { $error++; } // End call triggers } @@ -1683,7 +1683,7 @@ class SupplierProposal extends CommonObject if (!$notrigger) { // Call trigger - $result = $this->call_trigger('SUPPLIER_PROPOSAL_REOPEN', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_REOPEN', $user); if ($result < 0) { $error++; } // End call triggers } @@ -1737,11 +1737,11 @@ class SupplierProposal extends CommonObject if ($resql) { $modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED : $this->modelpdf; - $triggerName = 'SUPPLIER_PROPOSAL_CLOSE_REFUSED'; + $triggerName = 'PROPOSAL_SUPPLIER_CLOSE_REFUSED'; if ($status == 2) { - $triggerName = 'SUPPLIER_PROPOSAL_CLOSE_SIGNED'; + $triggerName = 'PROPOSAL_SUPPLIER_CLOSE_SIGNED'; $modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL : $this->modelpdf; if (!empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists @@ -1751,7 +1751,7 @@ class SupplierProposal extends CommonObject } if ($status == 4) { - $triggerName = 'SUPPLIER_PROPOSAL_CLASSIFY_BILLED'; + $triggerName = 'PROPOSAL_SUPPLIER_CLASSIFY_BILLED'; } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) @@ -1916,7 +1916,7 @@ class SupplierProposal extends CommonObject if (!$error) { // Call trigger - $result = $this->call_trigger('SUPPLIER_PROPOSAL_UNVALIDATE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_UNVALIDATE', $user); if ($result < 0) $error++; } @@ -2034,7 +2034,7 @@ class SupplierProposal extends CommonObject if (!$notrigger) { // Call trigger - $result = $this->call_trigger('SUPPLIER_PROPOSAL_DELETE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_DELETE', $user); if ($result < 0) { $error++; } // End call triggers } @@ -2232,8 +2232,8 @@ class SupplierProposal extends CommonObject $statusnew = ''; if ($status == self::STATUS_DRAFT) $statusnew = 'status0'; elseif ($status == self::STATUS_VALIDATED) $statusnew = 'status1'; - elseif ($status == self::STATUS_SIGNED) $statusnew = 'status3'; - elseif ($status == self::STATUS_NOTSIGNED) $statusnew = 'status5'; + elseif ($status == self::STATUS_SIGNED) $statusnew = 'status4'; + elseif ($status == self::STATUS_NOTSIGNED) $statusnew = 'status9'; elseif ($status == self::STATUS_CLOSE) $statusnew = 'status6'; return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusnew, $mode); diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 57db269cc2e..b0c589010aa 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -19,9 +19,9 @@ */ /** - * \file htdocs/comm/propal/index.php - * \ingroup propal - * \brief Home page of proposal area + * \file htdocs/supplier_proposal/index.php + * \ingroup supplier_proposal + * \brief Home page of vendor proposal area */ require '../main.inc.php'; @@ -104,6 +104,7 @@ if ($resql) $total = 0; $totalinprocess = 0; $dataseries = array(); + $colorseries = array(); $vals = array(); // -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not) while ($i < $num) @@ -122,20 +123,28 @@ if ($resql) } $db->free($resql); + include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + print '<div class="div-table-responsive-no-min">'; print '<table class="noborder centpercent">'; print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CommRequests").'</th></tr>'."\n"; $listofstatus = array(0, 1, 2, 3, 4); foreach ($listofstatus as $status) { - $dataseries[] = array($supplier_proposalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); - if (!$conf->use_javascript_ajax) - { - print '<tr class="oddeven">'; - print '<td>'.$supplier_proposalstatic->LibStatut($status, 0).'</td>'; - print '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>'; - print "</tr>\n"; - } + $dataseries[] = array($supplier_proposalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); + if ($status == SupplierProposal::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == SupplierProposal::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; + if ($status == SupplierProposal::STATUS_SIGNED) $colorseries[$status] = $badgeStatus4; + if ($status == SupplierProposal::STATUS_NOTSIGNED) $colorseries[$status] = $badgeStatus9; + if ($status == SupplierProposal::STATUS_CLOSE) $colorseries[$status] = $badgeStatus6; + + if (empty($conf->use_javascript_ajax)) + { + print '<tr class="oddeven">'; + print '<td>'.$supplier_proposalstatic->LibStatut($status, 0).'</td>'; + print '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>'; + print "</tr>\n"; + } } if ($conf->use_javascript_ajax) { @@ -144,6 +153,7 @@ if ($resql) include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); @@ -282,7 +292,7 @@ if ($resql) print '<td>'.$companystatic->getNomUrl(1, 'customer').'</td>'; print '<td>'.dol_print_date($db->jdate($obj->datec), 'day').'</td>'; - print '<td class="right">'.$supplier_proposalstatic->LibStatut($obj->fk_statut, 5).'</td>'; + print '<td class="right">'.$supplier_proposalstatic->LibStatut($obj->fk_statut, 3).'</td>'; print '</tr>'; $i++; } diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 7a87e13ff97..d50faa480cb 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -83,7 +83,6 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackT print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); $head = takepos_prepare_head(); dol_fiche_head($head, 'receipt', 'TakePOS', -1); -print '<br>'; print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">'; print '<input type="hidden" name="token" value="'.newToken().'">'; @@ -207,7 +206,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P // Customer information print '<tr class="oddeven"><td>'; - print $langs->trans('ShowCustomer'); + print $langs->trans('PrintCustomerOnReceipts'); print '<td colspan="2">'; print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); print "</td></tr>\n"; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 20b62da4650..d21936bdaef 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -59,9 +59,11 @@ if ($resql) { $action = GETPOST('action', 'alpha'); + /* * Actions */ + $error = 0; if ($action == 'set') @@ -69,20 +71,12 @@ if ($action == 'set') $db->begin(); if (GETPOST('socid', 'int') < 0) $_POST["socid"] = ''; - $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ADDON", GETPOST('TAKEPOS_ADDON', 'alpha'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { @@ -140,7 +134,6 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackT print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); $head = takepos_prepare_head(); dol_fiche_head($head, 'setup', 'TakePOS', -1); -print '<br>'; // Numbering modules $now = dol_now(); @@ -186,8 +179,7 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - $var=!$var; - print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n"; + print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n"; print $module->info(); print '</td>'; @@ -303,6 +295,12 @@ $array = array('rowid' => 'ID', 'ref' => 'Ref', 'label' => 'Label', 'datec' => ' print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0, '', 1); print "</td></tr>\n"; +print '<tr class="oddeven"><td>'; +print $langs->trans('TakeposGroupSameProduct'); +print '<td colspan="2">'; +print ajax_constantonoff("TAKEPOS_GROUP_SAME_PRODUCT", array(), $conf->entity, 0, 0, 1, 0); +print "</td></tr>\n"; + $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; @@ -313,7 +311,7 @@ $htmltext .= '</i>'; print '<tr class="oddeven"><td>'; print $langs->trans("ColorTheme"); print '<td colspan="2">'; -$array = array(0=>"eldy", 1=>$langs->trans("Colorful")); +$array = array(0=>"Eldy", 1=>$langs->trans("Colorful")); print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0); print "</td></tr>\n"; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index abd4f68adc5..fa62aff1bc3 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -204,7 +204,7 @@ if (!empty($conf->stock->enabled)) if (!$disabled) { print $formproduct->selectWarehouses($conf->global->{'CASHDESK_ID_WAREHOUSE'.$terminal}, 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled); - print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">('.$langs->trans("Create").')</a>'; + print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"]).'"><span class="fa fa-plus-circle valignmiddle"></span></a>'; } else { diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 07de9e50a51..89cf13956ac 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -39,7 +39,7 @@ $term = GETPOST('term', 'alpha'); $id = GETPOST('id', 'int'); if (empty($user->rights->takepos->run)) { - access_forbidden(); + accessforbidden(); } @@ -85,10 +85,10 @@ elseif ($action == 'search' && $term != '') { } } - $sql = 'SELECT rowid, ref, label, tosell, tobuy FROM '.MAIN_DB_PREFIX.'product as p'; + $sql = 'SELECT rowid, ref, label, tosell, tobuy, barcode, price FROM '.MAIN_DB_PREFIX.'product as p'; $sql .= ' WHERE entity IN ('.getEntity('product').')'; if ($filteroncategids) { - $sql.= ' AND rowid IN (SELECT DISTINCT fk_product FROM '.MAIN_DB_PREFIX.'categorie_product WHERE fk_categorie IN ('.$filteroncategids.'))'; + $sql.= ' AND EXISTS (SELECT cp.fk_product FROM '.MAIN_DB_PREFIX.'categorie_product as cp WHERE cp.fk_product = p.rowid AND cp.fk_categorie IN ('.$filteroncategids.'))'; } $sql .= ' AND tosell = 1'; $sql .= natural_search(array('ref', 'label', 'barcode'), $term); @@ -96,8 +96,17 @@ elseif ($action == 'search' && $term != '') { if ($resql) { $rows = array(); - while ($row = $db->fetch_object($resql)) { - $rows[] = $row; + while ($obj = $db->fetch_object($resql)) { + $rows[] = array( + 'rowid' => $obj->rowid, + 'ref' => $obj->ref, + 'label' => $obj->label, + 'tosell' => $obj->tosell, + 'tobuy' => $obj->tobuy, + 'barcode' => $obj->barcode, + 'price' => $obj->price + //'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency) + ); } echo json_encode($rows); } diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index c228b948c3b..7d4fd9be051 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -119,7 +119,7 @@ button.calcbutton2 { width: calc(25% - 2px); height: calc(25% - 2px); font-weight: bold; - font-size: 8pt; + font-size: 10pt; margin: 1px; } @@ -155,6 +155,21 @@ button.actionbutton { overflow: visible; /* removes extra width in IE */ width:33%; height: calc(25% - 2px); + margin: 1px; + border-width: 0; +} + +button.item_value { + background: #bbbbbb; + border: #000000 1px solid; + border-radius: 4px; + padding: 8px; +} + +button.item_value.selected { + background: #ffffff; + color: #000000; + font-weight: bold; } div[aria-describedby="dialog-info"] button:before { @@ -226,7 +241,7 @@ div.description{ text-align:center; padding-top: 30px; - background: -webkit-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,0.98), rgba(255,255,255,1)); + background: -webkit-linear-gradient(top, rgba(250,250,250,0), rgba(250,250,250,0.5), rgba(250,250,250,0.95), rgba(250,250,250,1)); } div.catwatermark{ @@ -284,7 +299,7 @@ div.paymentbordline .row1withhead{ margin: 0 auto; width: 100%; - height: calc(40% - 50px); + height: calc(45% - 50px); padding-top: 5px; } @@ -297,7 +312,7 @@ div.paymentbordline .row2withhead{ margin: 0 auto; width: 100%; - height: 60%; + height: 55%; } .div1{ @@ -308,7 +323,7 @@ div.paymentbordline box-sizing: border-box; overflow: auto; /* background-color:white; */ - padding-top: 0; + padding-top: 1px; padding-bottom: 0; padding-right: 5px; padding-left: 5px; @@ -481,6 +496,26 @@ div.description_content { border-radius: 5px; } +div#moreinfo, div#infowarehouse { + color: #aaa; + padding: 0 8px 0 8px; +} + +.productprice { + position: absolute; + top: 5px; + right: 5px; + background: var(--colorbackhmenu1); + color: var(--colortextbackhmenu); + font-size: 2em; + padding: 5px; + border-radius: 2px; + opacity: 0.9; + padding-left: 8px; + padding-right: 8px; +} + + @media screen and (min-width: 892px) { .actionbutton{ font-size: 13px; @@ -553,7 +588,7 @@ div.description_content { } .row1withhead{ - height: calc(40% - 100px); + height: calc(45% - 100px); } @@ -586,4 +621,9 @@ div.description_content { font-size: 1.2em; } + button.actionbutton { + min-height: 60px; + padding-left: 4px; + padding-right: 4px; + } } diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 8624948e6ff..5af2eb1d238 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -42,11 +42,20 @@ $action = GETPOST('action', 'alpha'); $left = GETPOST('left', 'alpha'); $top = GETPOST('top', 'alpha'); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant $newname = GETPOST('newname', 'alpha'); $mode = GETPOST('mode', 'alpha'); +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + + +/* + * Actions + */ + if ($action == "getTables") { $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; @@ -81,6 +90,11 @@ if ($action == "add") $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names } + +/* + * View + */ + // Title $title = 'TakePOS - Dolibarr '.DOL_VERSION; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; @@ -132,7 +146,7 @@ function updatename(rowid) { } function LoadPlace(place){ - parent.location.href='takepos.php?place='+place; + parent.location.href='index.php?place='+place; } diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index e8cce00abb3..ef0ff2ca4f4 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/takepos/floors.php + * \file htdocs/takepos/freezone.php * \ingroup takepos * \brief Popup to enter a free line */ @@ -32,14 +32,37 @@ if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + +global $mysoc; $langs->loadLangs(array("bills", "cashdesk")); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'); // $place is id of table for Bar or Restaurant $idline = GETPOST('idline', 'int'); $action = GETPOST('action', 'alpha'); +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + +// get invoice +$invoice = new Facture($db); +if ($place > 0) { + $invoice->fetch($place); +} else { + $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$place.')'); +} + +// get default vat rate +$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION['takeposterminal']; +$soc = new Societe($db); +if ($invoice->socid > 0) $soc->fetch($invoice->socid); +else $soc->fetch($conf->global->$constforcompanyid); +$vatRateDefault = get_default_tva($mysoc, $soc); /* * View @@ -48,18 +71,36 @@ $action = GETPOST('action', 'alpha'); $arrayofcss = array('/takepos/css/pos.css.php'); $arrayofjs = array(); -top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); - +top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss); ?> <script> -function Save(){ - $.get( "invoice.php", { action: "<?php echo $action; ?>", place: "<?php echo $place; ?>", desc:$('#desc').val(), number:$('#number').val()} ); - parent.$.colorbox.close(); -} + var vatRate = '<?php echo dol_escape_js($vatRateDefault); ?>'; -$( document ).ready(function() { - $('#desc').focus() -}); + /** + * Apply new VAT rate + * + * @param {string} id VAT id + * @param {string} rate VAT rate + */ + function ApplyVATRate(id, rate) { + console.log("Save selected VAT Rate into vatRate variable with value "+rate); + vatRate = rate; + jQuery('button.vat_rate').removeClass('selected'); + jQuery('#vat_rate_'+id).addClass('selected'); + } + + /** + * Save (validate) + */ + function Save() { + console.log("We click so we call page invoice.php with place=<?php echo $place; ?> tva_tx="+vatRate); + $.get( "invoice.php", { action: "<?php echo $action; ?>", place: "<?php echo $place; ?>", desc:$('#desc').val(), number:$('#number').val(), tva_tx: vatRate} ); + parent.$.colorbox.close(); + } + + $( document ).ready(function() { + $('#desc').focus() + }); </script> </head> <body> @@ -72,6 +113,21 @@ if ($action == "addnote") echo '<input type="hidden" id="number" name="number" v ?> <input type="hidden" name="place" class="takepospay" value="<?php echo $place; ?>"> <input type="button" class="button takepospay clearboth" value="OK" onclick="Save();"> +<?php +if ($action == 'freezone') { + require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; + + $form = new Form($db); + $num = $form->load_cache_vatrates("'" . $mysoc->country_code . "'"); + if ($num > 0) { + print '<br><br>'; + print $langs->trans('VAT') . ' : '; + foreach ($form->cache_vatrates as $rate) { + print '<button type="button" class="button item_value vat_rate' . ($rate['txtva'] == $vatRateDefault ? ' selected' : '') . '" id="vat_rate_' . $rate['rowid'] . '" onclick="ApplyVATRate(\'' . $rate['rowid'] . '\', \'' . $rate['txtva'] .'\');">' . $rate['txtva'] . ' %</button>'; + } + } +} +?> </center> </body> diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/index.php similarity index 91% rename from htdocs/takepos/takepos.php rename to htdocs/takepos/index.php index c5f0b69b38a..2ce3f31211b 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/index.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/takepos/takepos.php + * \file htdocs/takepos/index.php * \ingroup takepos * \brief Main TakePOS screen */ @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant or multiple sales $action = GETPOST('action', 'alpha'); $setterminal = GETPOST('setterminal', 'int'); @@ -48,7 +48,7 @@ if ($setterminal > 0) $_SESSION["takeposterminal"] = $setterminal; } -$_SESSION["urlfrom"] = '/takepos/takepos.php'; +$_SESSION["urlfrom"] = '/takepos/index.php'; $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); @@ -179,7 +179,7 @@ function ClearSearch() { // Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically function setFocusOnSearchField() { - console.log("Call setFocusOnSearchField in page takepos.php"); + console.log("Call setFocusOnSearchField in page index.php"); <?php if ($conf->browser->layout == 'classic') { ?> console.log("has keyboard from localStorage, so we can force focus on search field"); $("#search").focus(); @@ -263,6 +263,8 @@ function LoadProducts(position, issubcat) { if (currentcat==val.fk_parent) { $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(val.label); + $("#proprice"+ishow).attr("class", "hidden"); + $("#proprice"+ishow).html(""); $("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid); $("#prodiv"+ishow).data("rowid",val.rowid); $("#prodiv"+ishow).data("iscat",1); @@ -281,6 +283,8 @@ function LoadProducts(position, issubcat) { if (typeof (data[idata]) == "undefined") { $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); + $("#proprice"+ishow).attr("class", "hidden"); + $("#proprice"+ishow).html(""); $("#proimg"+ishow).attr("title",""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); @@ -289,9 +293,17 @@ function LoadProducts(position, issubcat) { ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell) - var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref').': '); ?>'+data[idata]['ref']; + <?php + $titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[idata]['ref']"; + $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[idata]['barcode']"; + ?> + var titlestring = <?php echo $titlestring; ?>; $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); + if (data[parseInt(idata)]['price_formated']) { + $("#proprice"+ishow).attr("class", "productprice"); + $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); + } $("#proimg"+ishow).attr("title", titlestring); $("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid", data[idata]['id']); @@ -337,6 +349,8 @@ function MoreProducts(moreorless) { if (typeof (data[idata]) == "undefined") { $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); + $("#proprice"+ishow).attr("class", ""); + $("#proprice"+ishow).html(""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); ishow++; //Next product to show after print data product @@ -345,6 +359,10 @@ function MoreProducts(moreorless) { //Only show products with status=1 (for sell) $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); + if (data[parseInt(idata)]['price_formated']) { + $("#proprice"+ishow).attr("class", "productprice"); + $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); + } $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("iscat",0); @@ -417,12 +435,12 @@ function Floors() { function FreeZone() { console.log("Open box to enter a free product"); - $.colorbox({href:"freezone.php?action=freezone&place="+place, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"}); + $.colorbox({href:"freezone.php?action=freezone&place="+place, onClosed: function () { Refresh(); },width:"80%", height:"200px", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"}); } function TakeposOrderNotes() { console.log("Open box to order notes"); - $.colorbox({href:"freezone.php?action=addnote&place="+place+"&idline="+selectedline, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("OrderNotes"); ?>"}); + $.colorbox({href:"freezone.php?action=addnote&place="+place+"&idline="+selectedline, onClosed: function () { Refresh(); },width:"80%", height:"250px", transition:"none", iframe:"true", title:"<?php echo $langs->trans("OrderNotes"); ?>"}); } function Refresh() { @@ -462,7 +480,7 @@ function New() { * return {void} */ function Search2(keyCodeForEnter) { - console.log("Search2 Call ajax search to replace products"); + console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter); var search = false; var eventKeyCode = window.event.keyCode; @@ -477,20 +495,37 @@ function Search2(keyCodeForEnter) { for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) { if (typeof (data[i]) == "undefined") { $("#prodesc" + i).text(""); + $("#proprice" + i).attr("class", "hidden"); + $("#proprice" + i).html(""); $("#proimg" + i).attr("src", "genimg/empty.png"); $("#prodiv" + i).data("rowid", ""); continue; } - var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref').': '); ?>' + data[i]['ref']; + <?php + $titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[i]['ref']"; + $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[i]['barcode']"; + ?> + var titlestring = <?php echo $titlestring; ?>; $("#prodesc" + i).text(data[i]['label']); $("#prodivdesc" + i).show(); + if (data[i]['price_formated']) { + $("#proprice" + i).attr("class", "productprice"); + $("#proprice" + i).html(data[i]['price_formated']); + } $("#proimg" + i).attr("title", titlestring); $("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']); $("#prodiv" + i).data("rowid", data[i]['rowid']); $("#prodiv" + i).data("iscat", 0); } }).always(function (data) { - if ($('#search').val().length > 0 && data.length == 1) ClickProduct(0); + // If there is only 1 answer + if ($('#search').val().length > 0 && data.length == 1) { + console.log($('#search').val()+' - '+data[0]['barcode']); + if ($('#search').val() == data[0]['barcode']) { + console.log("There is only 1 answer with barcode matching the search, so we add the product in basket"); + ClickProduct(0); + } + } }); } } @@ -636,14 +671,14 @@ function TerminalsDialog() modal: true, buttons: { '<?php echo dol_escape_js($langs->trans("Terminal")) ?> 1': function() { - location.href='takepos.php?setterminal=1'; + location.href='index.php?setterminal=1'; } <?php for ($i = 2; $i <= $conf->global->TAKEPOS_NUM_TERMINALS; $i++) { print ", '".dol_escape_js($langs->trans("Terminal"))." ".$i."': function() { - location.href='takepos.php?setterminal=".$i."'; + location.href='index.php?setterminal=".$i."'; } "; } @@ -654,7 +689,7 @@ function TerminalsDialog() function DirectPayment(){ console.log("DirectPayment"); - $("#poslines").load("invoice.php?place"+place+"&action=valid&pay=<?php echo $langs->trans("cash"); ?>", function() { + $("#poslines").load("invoice.php?place="+place+"&action=valid&pay=<?php echo $langs->trans("cash"); ?>", function() { }); } @@ -679,7 +714,7 @@ $( document ).ready(function() { <body class="bodytakepos" style="overflow: hidden;"> <?php -print '<div class="hidden" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>'; +print '<div class="hidden dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>'; $keyCodeForEnter = $conf->global->{'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']} > 0 ? $conf->global->{'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']} : ''; ?> <div class="container"> @@ -690,14 +725,18 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { <div class="header"> <div class="topnav"> <div class="topnav-left"> - <a class="topnav-terminalhour" onclick="TerminalsDialog();"> + <div class="inline-block valignmiddle"><a class="topnav-terminalhour" onclick="TerminalsDialog();"> <?php echo $langs->trans("Terminal")." "; if ($_SESSION["takeposterminal"] == "") echo "1"; else echo $_SESSION["takeposterminal"]; echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>'; ?> - </a> - <a id="customer" onclick="Customer();"></a> + </a></div> + <div class="inline-block valignmiddle" id="customerandsales"> + <a class="valignmiddle" id="customer" onclick="Customer();"></a> + </div> + <div class="inline-block valignmiddle" id="moreinfo"></div> + <div class="inline-block valignmiddle" id="infowarehouse"></div> </div> <div class="topnav-right"> <div class="login_block_other"> @@ -922,15 +961,16 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { <?php if ($count == ($MAXPRODUCT - 2)) { //echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />'; - echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>'; + print '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>'; } elseif ($count == ($MAXPRODUCT - 1)) { //echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />'; - echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>'; + print '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>'; } else { - echo '<img class="imgwrapper" height="100%" title="" id="proimg'.$count.'">'; + print '<div class="" id="proprice'.$count.'"></div>'; + print '<img class="imgwrapper" height="100%" title="" id="proimg'.$count.'">'; } ?> <?php if ($count != ($MAXPRODUCT - 2) && $count != ($MAXPRODUCT - 1)) { ?> diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 20054a52965..51536ba8133 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -37,14 +37,22 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +global $mysoc; + $langs->loadLangs(array("companies", "commercial", "bills", "cashdesk", "stocks")); $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $idproduct = GETPOST('idproduct', 'int'); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant $placeid = 0; // $placeid is ID of invoice +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + + + if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') { // DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED @@ -53,7 +61,7 @@ if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") $_SESSION["takeposterminal"] = 1; else { - header("Location: takepos.php"); + header("Location: ".DOL_URL_ROOT."/takepos/index.php"); exit; } } @@ -318,7 +326,23 @@ if ($action == "addline") } } - $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, 0, '', 0, 100, '', null, 0); + $idoflineadded = 0; + if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) { + foreach ($invoice->lines as $line) { + if ($line->product_ref == $prod->ref) { + $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty+1, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); + if ($result < 0) { + dol_htmloutput_errors($invoice->error, $invoice->errors, 1); + } else { + $idoflineadded = $line->id; + } + break; + } + } + } + if ($idoflineadded <= 0) { + $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, 0, '', 0, 100, '', null, 0); + } $invoice->fetch($placeid); } @@ -327,7 +351,12 @@ if ($action == "freezone") { $customer = new Societe($db); $customer->fetch($invoice->socid); - $tva_tx = get_default_tva($mysoc, $customer); + $tva_tx = GETPOST('tva_tx', 'alpha'); + if ($tva_tx != '') { + $tva_tx = price2num($tva_tx); + } else { + $tva_tx = get_default_tva($mysoc, $customer); + } // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr); @@ -366,6 +395,14 @@ if ($action == "deleteline") { if ($action == "delete") { // $placeid is the invoice id (it differs from place) and is defined if the place is set and the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at begining of page works. + + /*$reg = array(); + if (preg_match('/^(\d+)-(\d+)$/', $place, $reg)) { + + $place = $reg[1]; + var_dump($place); + }*/ + if ($placeid > 0) { $result = $invoice->fetch($placeid); @@ -378,7 +415,8 @@ if ($action == "delete") { $resql1 = $db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet where fk_facture = ".$placeid; $resql2 = $db->query($sql); - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}; + $sql.= " WHERE ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $resql3 = $db->query($sql); if ($resql1 && $resql2 && $resql3) @@ -673,17 +711,103 @@ function DolibarrTakeposPrinting(id) { }); } + $( document ).ready(function() { - $("a#customer").text("<?php - if ($invoice->socid != $conf->global->$constforcompanyid) print $soc->name; - else print $langs->trans("Customer"); - ?>"); + console.log("Set customer info in header"); + + <?php + $s = $langs->trans("Customer"); + if ($invoice->socid != $conf->global->$constforcompanyid) { + $s = $soc->name; + } + ?> + + $("#customerandsales").html('<a class="valignmiddle" id="customer" onclick="Customer();"><?php print dol_escape_js($s); ?></a>'); + + <?php + $sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture"; + $sql.= " WHERE ref LIKE '(PROV-POS".$_SESSION["takeposterminal"]."-0%'"; + $sql.= $db->order('datec', 'ASC'); + $resql = $db->query($sql); + if ($resql) { + while ($obj = $db->fetch_object($resql)) { + echo '$("#customerandsales").append(\''; + if ($placeid==$obj->rowid) echo "<b>"; + echo '<a class="valignmiddle" onclick="location.href=\\\'index.php?place='; + $num_sale=str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref)); + echo $num_sale; + if (str_replace("-", "", $num_sale)>$max_sale) $max_sale=str_replace("-", "", $num_sale); + echo '\\\'">'.date('H:i', strtotime($obj->datec)); + if ($placeid==$obj->rowid) echo "</b>"; + echo '</a>\');'; + } + echo '$("#customerandsales").append(\'<a onclick="location.href=\\\'index.php?place=0-'; + echo $max_sale+1; + echo '\\\'"><span class="fa fa-plus-square" title="'.dol_escape_htmltag($langs->trans("StartAParallelSale")).'"></a>\');'; + } else { + dol_print_error($db); + } + + $s = ''; + + $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; + if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") + { + $s = '<span class="small">'; + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; + $warehouse = new Entrepot($db); + $warehouse->fetch($conf->global->$constantforkey); + $s .= $langs->trans("Warehouse").'<br>'.$warehouse->ref; + $s .= '</span>'; + } + ?> + + $("#infowarehouse").html('<?php print dol_escape_js($s); ?>'); + + <?php + // Module Adherent + $s = ''; + if (!empty($conf->adherent->enabled) && $invoice->socid != $conf->global->$constforcompanyid) + { + $s = '<span class="small">'; + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + $langs->load("members"); + $s .= $langs->trans("Member").': '; + $adh = new Adherent($db); + $result = $adh->fetch('', '', $invoice->socid); + if ($result > 0) + { + $adh->ref = $adh->getFullName($langs); + $s.= $adh->getFullName($langs); + $s.= ' - '.$adh->type; + if ($adh->datefin) + { + $s.= '<br>'.$langs->trans("SubscriptionEndDate").': '.dol_print_date($adh->datefin, 'day'); + if ($adh->hasDelay()) { + $s.= " ".img_warning($langs->trans("Late")); + } + } + else + { + $s.= '<br>'.$langs->trans("SubscriptionNotReceived"); + if ($adh->statut > 0) $s.= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated + } + } + else + { + $s.= '<br>'.$langs->trans("ThirdpartyNotLinkedToMember"); + } + $s.= '</span>'; + } + ?> + $("#moreinfo").html('<?php print dol_escape_js($s); ?>'); + }); </script> <?php -// Add again js for footer because this content is injected into takepos.php page so all init +// Add again js for footer because this content is injected into index.php page so all init // for tooltip and other js beautifiers must be reexecuted too. if (!empty($conf->use_javascript_ajax)) { @@ -691,7 +815,7 @@ if (!empty($conf->use_javascript_ajax)) print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n"; } - +print '<!-- invoice.php place='.(int) $place.' invoice='.$invoice->ref.' mobilepage='.$mobilepage.' $_SESSION["basiclayout"]='.$_SESSION["basiclayout"].' conf->global->TAKEPOS_BAR_RESTAURANT='.$conf->global->TAKEPOS_BAR_RESTAURANT.' -->'."\n"; print '<div class="div-table-responsive-no-min invoice">'; print '<table id="tablelines" class="noborder noshadow postablelines" width="100%">'; print '<tr class="liste_titre nodrag nodrop">'; @@ -848,14 +972,16 @@ if ($placeid > 0) if (empty($conf->global->TAKEPOS_SHOW_N_FIRST_LINES)) { $tooltiptext = '<b>'.$langs->trans("Ref").'</b> : '.$line->product_ref.'<br>'; $tooltiptext .= '<b>'.$langs->trans("Label").'</b> : '.$line->product_label.'<br>'; - $tooltiptext .= '<br>'; - $tooltiptext .= $line->desc; - $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : $line->product_ref, $tooltiptext); + if ($line->product_label != $line->desc) { + if ($line->desc) $tooltiptext .= '<br>'; + $tooltiptext .= $line->desc; + } + $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext); } else { if ($line->product_label) $htmlforlines .= $line->product_label; - if ($line->product_label && $line->desc) $htmlforlines .= '<br>'; if ($line->product_label != $line->desc) { + if ($line->product_label && $line->desc) $htmlforlines .= '<br>'; $firstline = dolGetFirstLineOfText($line->desc, $conf->global->TAKEPOS_SHOW_N_FIRST_LINES); if ($firstline != $line->desc) { @@ -873,8 +999,7 @@ if ($placeid > 0) $moreinfo = ''; $moreinfo .= $langs->transcountry("TotalHT", $mysoc->country_code).': '.price($line->total_ht); if ($line->vat_src_code) $moreinfo .= '<br>'.$langs->trans("VATCode").': '.$line->vat_src_code; - $moreinfo .= '<br>'.$langs->transcountry("TotalVAT", $mysoc->country_code).': '.price($line->total_vat); - //$moreinfo .= '<br>'.$langs->transcountry("VATRate", $mysoc->country_code).': '.price($line->); + $moreinfo .= '<br>'.$langs->transcountry("TotalVAT", $mysoc->country_code).': '.price($line->total_tva); $moreinfo .= '<br>'.$langs->transcountry("TotalLT1", $mysoc->country_code).': '.price($line->total_localtax1); $moreinfo .= '<br>'.$langs->transcountry("TotalLT2", $mysoc->country_code).': '.price($line->total_localtax2); $moreinfo .= '<br>'.$langs->transcountry("TotalTTC", $mysoc->country_code).': '.price($line->total_ttc); @@ -903,53 +1028,6 @@ else { // No invoice generated yet print '</table>'; -if ($invoice->socid != $conf->global->$constforcompanyid) -{ - print '<p class="right">'; - - $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; - if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") - { - $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; - $warehouse = new Entrepot($db); - $warehouse->fetch($conf->global->$constantforkey); - print '<br>'.$langs->trans("Warehouse").': '.$warehouse->ref; - } - - // Module Adherent - if (!empty($conf->adherent->enabled)) - { - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $langs->load("members"); - print '<br>'.$langs->trans("Member").': '; - $adh = new Adherent($db); - $result = $adh->fetch('', '', $invoice->socid); - if ($result > 0) - { - $adh->ref = $adh->getFullName($langs); - print $adh->getFullName($langs); - print '<br>'.$langs->trans("Type").': '.$adh->type; - if ($adh->datefin) - { - print '<br>'.$langs->trans("SubscriptionEndDate").': '.dol_print_date($adh->datefin, 'day'); - if ($adh->hasDelay()) { - print " ".img_warning($langs->trans("Late")); - } - } - else - { - print '<br>'.$langs->trans("SubscriptionNotReceived"); - if ($adh->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } - } - else - { - print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>'; - } - } - print '</p>'; -} - if ($action == "search") { print '<center> diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index fb2442b5aba..b2534272ae2 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -34,10 +34,14 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'); // $place is id of table for Bar or Restaurant $invoiceid = GETPOST('invoiceid', 'int'); +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + /* * View diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 5d0346a495c..b2526ef885e 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant $action = GETPOST('action', 'alpha'); $setterminal = GETPOST('setterminal', 'int'); @@ -48,6 +48,11 @@ if ($setterminal > 0) $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + + /* * View */ @@ -166,7 +171,7 @@ function Exit(){ <body style="overflow: hidden; background-color:#D1D1D1;"> <?php -if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '<div id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>'; +if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '<div class="dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>'; ?> <div class="container"> <div class="phonebuttonsrow"> diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 66043f7139c..c025f504d73 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -30,10 +30,14 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->loadLangs(array("main", "cashdesk", "companies")); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant $facid = GETPOST('facid', 'int'); +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + /* * View diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index a2d57ea3a6e..ae5081ca891 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -34,10 +34,14 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant $invoiceid = GETPOST('invoiceid', 'int'); +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + /* * View @@ -73,6 +77,14 @@ $arrayofjs = array(); top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss); $langs->loadLangs(array('main', 'bills', 'cashdesk')); + +if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { + $htmlReductionPercent = '<span class="fa fa-2x fa-percent"></span>'; + $htmlReductionAmount = '<span class="fa fa-2x fa-money"></span>'; +} else { + $htmlReductionPercent = $langs->trans('ReductionShort') . '<br>%'; + $htmlReductionAmount = $langs->trans('ReductionShort') . '<br>' . $langs->trans('Amount'); +} ?> <link rel="stylesheet" href="css/pos.css.php"> </head> @@ -83,6 +95,9 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk')); var reductionTotal = ''; var editAction = ''; var editNumber = ''; + var htmlBtnOK = '<span style="font-size: 14pt;">OK</span>'; + var htmlReductionPercent = '<?php echo dol_escape_js($htmlReductionPercent); ?>'; + var htmlReductionAmount = '<?php echo dol_escape_js($htmlReductionAmount); ?>'; /** * Reset values @@ -94,8 +109,8 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk')); editAction = ''; editNumber = ''; jQuery('#reduction_total').val(reductionTotal); - jQuery("#reduction_type_percent").html('<span class="fa fa-2x fa-percent"></span>'); - jQuery('#reduction_type_amount').html('<span class="fa fa-2x fa-money-bill-alt"></span>'); + jQuery("#reduction_type_percent").html(htmlReductionPercent); + jQuery('#reduction_type_amount').html(htmlReductionAmount); } /** @@ -124,14 +139,14 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk')); } if (editAction === 'p'){ - jQuery('#reduction_type_percent').html('<span style="font-size: 14pt;">OK</span>'); - jQuery('#reduction_type_amount').html('<span class="fa fa-2x fa-money-bill-alt"></span>'); + jQuery('#reduction_type_percent').html(htmlBtnOK); + jQuery('#reduction_type_amount').html(htmlReductionAmount); } else if (editAction === 'a'){ - jQuery('#reduction_type_amount').html('<span style="font-size: 14pt;">OK</span>'); - jQuery("#reduction_type_percent").html('<span class="fa fa-2x fa-percent"></span>'); + jQuery('#reduction_type_amount').html(htmlBtnOK); + jQuery("#reduction_type_percent").html(htmlReductionPercent); } else { - jQuery('#reduction_type_percent').html('<span class="fa fa-2x fa-percent"></span>'); - jQuery('#reduction_type_amount').html('<span class="fa fa-2x fa-money-bill-alt"></span>'); + jQuery('#reduction_type_percent').html(htmlReductionPercent); + jQuery('#reduction_type_amount').html(htmlReductionAmount); } } @@ -198,11 +213,11 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk')); print '<button type="button" class="calcbutton" onclick="AddReduction(7);">7</button>'; print '<button type="button" class="calcbutton" onclick="AddReduction(8);">8</button>'; print '<button type="button" class="calcbutton" onclick="AddReduction(9);">9</button>'; -print '<button type="button" class="calcbutton2" id="reduction_type_percent" onclick="Edit(\'p\');"><span class="fa fa-2x fa-percent"></span></button>'; +print '<button type="button" class="calcbutton2" id="reduction_type_percent" onclick="Edit(\'p\');">' . $htmlReductionPercent . '</button>'; print '<button type="button" class="calcbutton" onclick="AddReduction(4);">4</button>'; print '<button type="button" class="calcbutton" onclick="AddReduction(5);">5</button>'; print '<button type="button" class="calcbutton" onclick="AddReduction(6);">6</button>'; -print '<button type="button" class="calcbutton2" id="reduction_type_amount" onclick="Edit(\'a\');"><span class="fa fa-2x fa-money-bill-alt"></span></button>'; +print '<button type="button" class="calcbutton2" id="reduction_type_amount" onclick="Edit(\'a\');">' . $htmlReductionAmount . '</button>'; print '<button type="button" class="calcbutton" onclick="AddReduction(1);">1</button>'; print '<button type="button" class="calcbutton" onclick="AddReduction(2);">2</button>'; print '<button type="button" class="calcbutton" onclick="AddReduction(3);">3</button>'; diff --git a/htdocs/takepos/send.php b/htdocs/takepos/send.php index 0b16f555e2f..5774c9bbaf1 100644 --- a/htdocs/takepos/send.php +++ b/htdocs/takepos/send.php @@ -37,6 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $invoiceid = GETPOST('facid', 'int'); +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + + /* * View */ diff --git a/htdocs/takepos/smpcb.php b/htdocs/takepos/smpcb.php index 445bc6da9cc..0e25a0cb7b0 100644 --- a/htdocs/takepos/smpcb.php +++ b/htdocs/takepos/smpcb.php @@ -1,5 +1,15 @@ <?php - require '../main.inc.php'; +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); + +require '../main.inc.php'; + +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} if (isset($_GET['status'])) { die(strtoupper($_SESSION['SMP_CURRENT_PAYMENT'])); diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index 48619dfc7d0..ed609ddbc87 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -1,9 +1,6 @@ <?php if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> -/* <style type="text/css" > */ -/* - Badge style is based on boostrap framework - */ +/* Badge style is based on boostrap framework */ .badge { display: inline-block; @@ -174,9 +171,7 @@ a.badge-dark:focus, a.badge-dark:hover { } -/* - * STATUS BADGES - */ +/* STATUS BADGES */ <?php for ($i = 0; $i <= 9; $i++) { /* Default Status */ @@ -186,6 +181,10 @@ for ($i = 0; $i <= 9; $i++) { _createStatusBadgeCss($i, 'colorblind_deuteranopes_', "COLORBLIND STATUS".$i, 'body[class*="colorblind-"] '); } +_createStatusBadgeCss('1b', '', "STATUS1b"); +_createStatusBadgeCss('4b', '', "STATUS4b"); + + /** * Create status badge * @@ -202,26 +201,27 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL if (!empty(${$statusVarNamePrefix.'badgeStatus'.$statusName})) { print "\n/* ".strtoupper($commentLabel)." */\n"; + $thisBadgeBackgroundColor = $thisBadgeBorderColor = ${$statusVarNamePrefix.'badgeStatus'.$statusName}; - $TBadgeBorderOnly = array(0, 3, 5, 7); + $TBadgeBorderOnly = array('0', '1b', '3', '4b', '5', '7'); $thisBadgeTextColor = colorIsLight(${$statusVarNamePrefix.'badgeStatus'.$statusName}) ? '#212529' : '#ffffff'; if (!empty(${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName})) { $thisBadgeTextColor = ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName}; } - if (in_array($statusName, $TBadgeBorderOnly)) { + if (in_array((string) $statusName, $TBadgeBorderOnly)) { $thisBadgeTextColor = '#212529'; $thisBadgeBackgroundColor = "#fff"; } - if (in_array($statusName, array(0, 5, 9))) $thisBadgeTextColor = '#999999'; - if (in_array($statusName, array(6))) $thisBadgeTextColor = '#777777'; + if (in_array((string) $statusName, array('0', '5', '9'))) $thisBadgeTextColor = '#999999'; + if (in_array((string) $statusName, array('6'))) $thisBadgeTextColor = '#777777'; print $cssPrefix.".badge-status".$statusName." {\n"; print " color: ".$thisBadgeTextColor." !important;\n"; - if (in_array($statusName, $TBadgeBorderOnly)) { + if (in_array((string) $statusName, $TBadgeBorderOnly)) { print " border-color: ".$thisBadgeBorderColor.";\n"; } print " background-color: ".$thisBadgeBackgroundColor.";\n"; @@ -239,7 +239,7 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL print $cssPrefix.".badge-status".$statusName.":focus, ".$cssPrefix.".badge-status".$statusName.":hover {\n"; print " color: ".$thisBadgeTextColor." !important;\n"; //print " background-color: " . colorDarker($thisBadgeBackgroundColor, 10) . ";\n"; - if (in_array($statusName, $TBadgeBorderOnly)) { + if (in_array((string) $statusName, $TBadgeBorderOnly)) { print " border-color: ".colorDarker($thisBadgeBorderColor, 10).";\n"; } print "}\n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index c51f8be7a53..2be4ec32f0b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -33,7 +33,7 @@ --colorboxstatsborder: #ddd; --dolgraphbg: rgba(255,255,255,0); --fieldrequiredcolor: #000055; - --colortextbacktab: #<?php print $colortextbacktab; ?>) ; + --colortextbacktab: #<?php print $colortextbacktab; ?>; --colorboxiconbg: #eee; --refidnocolor:#444; --tableforfieldcolor:#666; @@ -298,12 +298,14 @@ td.onholidaymorning, td.onholidayafternoon { td.onholidayallday { background-color: #f4eede; } +/* td.leftborder, td.hide0 { border-left: 1px solid #ccc; } td.leftborder, td.hide6 { border-right: 1px solid #ccc; } +*/ td.rightborder { border-right: 1px solid #ccc; } @@ -1165,6 +1167,7 @@ table[summary="list_of_modules"] .fa-cog { .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth250onsmartphone { max-width: 250px; } .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } .minwidth50imp { min-width: 50px !important; } @@ -1288,7 +1291,7 @@ td.showDragHandle { .side-nav-vert { position: sticky; top: 0px; - z-index: 210; + z-index: 1001; } <?php } ?> @@ -1551,7 +1554,7 @@ div.nopadding { td.nobordernopadding.widthpictotitle.opacityhigh.valignmiddle.col-picto { color: var(--colortexttitlenotab); - opacity: 0.65; + opacity: 0.45; } .pictotitle { margin-<?php echo $right; ?>: 8px; @@ -3221,6 +3224,9 @@ td.evenodd, tr.nohoverpair td, #trlinefordates td { border-bottom: 1pt solid black !important; /* background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinebreak)); ?> !important; */ } +.trforbreak.nobold td a, .trforbreak.nobold span.secondary { + font-weight: normal !important; +} table.dataTable td { padding: 5px 8px 5px 8px !important; @@ -4161,6 +4167,7 @@ span[phptag] { background: #e6e6e6; display: inline-block; padding: 4px 0 4px 0; + z-index: 1000; } .websitebar .buttonDelete, .websitebar .button { text-shadow: none; diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index dd76f09a54f..81a6aa3b4c5 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -142,3 +142,34 @@ div.mainmenu.generic3::before { div.mainmenu.generic4::before { content: "\f249"; } + + +/* Define square Dolibarr logo in pure CSS */ +.fa-dolibarr-css{ + color: #235481; + background: currentColor; + height: 150px; + width: 150px; + position: relative; +} +.fa-dolibarr-css:before{ + content: ''; + position: absolute; + left: 19%; + top: 17%; + width: 25%; + height: 25%; + border: solid 30px white; + border-radius: 0% 200% 200% 0% / 0% 180% 180% 0%; +} +.fa-dolibarr-css:after{ + content: ''; + position: absolute; + left: 19%; + top: 17%; + width: 5px; + height: 25%; + border-bottom: solid 60px currentColor; + margin-left: 30px; +} + diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 4dd4b7627a8..65c51e10dfe 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -104,11 +104,13 @@ $colorblind_deuteranopes_badgeWarning = '#e4e411'; * So this badges status uses default value according to theme eldy status img * TODO: use color definition vars above for define badges color status X -> exemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive .... */ -$badgeStatus0 = '#cbd3d3'; -$badgeStatus1 = '#bc9526'; -$badgeStatus2 = '#e6f0f0'; +$badgeStatus0 = '#cbd3d3'; // draft +$badgeStatus1 = '#bc9526'; // validated +$badgeStatus1b = '#bc9526'; // validated +$badgeStatus2 = '#9c9c26'; // approved $badgeStatus3 = '#bca52b'; $badgeStatus4 = '#55a580'; // Color ok +$badgeStatus4b = '#55a580'; // Color ok $badgeStatus5 = '#cad2d2'; $badgeStatus6 = '#cad2d2'; $badgeStatus7 = '#baa32b'; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8ad0df866c7..33b9635bb68 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1245,6 +1245,7 @@ table[summary="list_of_modules"] .fa-cog { .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth250onsmartphone { max-width: 250px; } .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } .minwidth50imp { min-width: 50px !important; } @@ -1439,7 +1440,7 @@ body.sidebar-collapse .side-nav, body.sidebar-collapse .login_block .side-nav-vert { position: sticky; top: 0px; - z-index: 210; + z-index: 1001; } <?php } ?> diff --git a/htdocs/ticket/class/utils_diff.class.php b/htdocs/ticket/class/utils_diff.class.php index a8e3712ec9b..7a4a3ff96ad 100644 --- a/htdocs/ticket/class/utils_diff.class.php +++ b/htdocs/ticket/class/utils_diff.class.php @@ -15,12 +15,12 @@ */ class Diff { - // define the constants - const UNMODIFIED = 0; - const DELETED = 1; - const INSERTED = 2; + // define the constants + const UNMODIFIED = 0; + const DELETED = 1; + const INSERTED = 2; - /* Returns the diff for two strings. The return value is an array, each of + /* Returns the diff for two strings. The return value is an array, each of * whose values is an array containing two values: a line (or character, if * $compareCharacters is true), and one of the constants DIFF::UNMODIFIED (the * line or character is in both strings), DIFF::DELETED (the line or character @@ -32,86 +32,86 @@ class Diff * $compareCharacters - true to compare characters, and false to compare * lines; this optional parameter defaults to false */ - public static function compare( - $string1, - $string2, - $compareCharacters = false - ) { + public static function compare( + $string1, + $string2, + $compareCharacters = false + ) { - // initialise the sequences and comparison start and end positions - $start = 0; - if ($compareCharacters) { - $sequence1 = $string1; - $sequence2 = $string2; - $end1 = strlen($string1) - 1; - $end2 = strlen($string2) - 1; - } else { - $sequence1 = preg_split('/\R/', $string1); - $sequence2 = preg_split('/\R/', $string2); - $end1 = count($sequence1) - 1; - $end2 = count($sequence2) - 1; - } + // initialise the sequences and comparison start and end positions + $start = 0; + if ($compareCharacters) { + $sequence1 = $string1; + $sequence2 = $string2; + $end1 = strlen($string1) - 1; + $end2 = strlen($string2) - 1; + } else { + $sequence1 = preg_split('/\R/', $string1); + $sequence2 = preg_split('/\R/', $string2); + $end1 = count($sequence1) - 1; + $end2 = count($sequence2) - 1; + } - // skip any common prefix - while ($start <= $end1 && $start <= $end2 - && $sequence1[$start] == $sequence2[$start]) { - $start++; - } + // skip any common prefix + while ($start <= $end1 && $start <= $end2 + && $sequence1[$start] == $sequence2[$start]) { + $start++; + } - // skip any common suffix - while ($end1 >= $start && $end2 >= $start - && $sequence1[$end1] == $sequence2[$end2]) { - $end1--; - $end2--; - } + // skip any common suffix + while ($end1 >= $start && $end2 >= $start + && $sequence1[$end1] == $sequence2[$end2]) { + $end1--; + $end2--; + } - // compute the table of longest common subsequence lengths - $table = self::computeTable($sequence1, $sequence2, $start, $end1, $end2); + // compute the table of longest common subsequence lengths + $table = self::computeTable($sequence1, $sequence2, $start, $end1, $end2); - // generate the partial diff - $partialDiff = self::generatePartialDiff($table, $sequence1, $sequence2, $start); + // generate the partial diff + $partialDiff = self::generatePartialDiff($table, $sequence1, $sequence2, $start); - // generate the full diff - $diff = array(); - for ($index = 0; $index < $start; $index++) { - $diff[] = array($sequence1[$index], self::UNMODIFIED); - } - while (count($partialDiff) > 0) { - $diff[] = array_pop($partialDiff); - } + // generate the full diff + $diff = array(); + for ($index = 0; $index < $start; $index++) { + $diff[] = array($sequence1[$index], self::UNMODIFIED); + } + while (count($partialDiff) > 0) { + $diff[] = array_pop($partialDiff); + } - $end2 = ($compareCharacters ? strlen($sequence1) : count($sequence1)); - for ($index = $end1 + 1; $index < $end2; $index++) - { - $diff[] = array($sequence1[$index], self::UNMODIFIED); - } + $end2 = ($compareCharacters ? strlen($sequence1) : count($sequence1)); + for ($index = $end1 + 1; $index < $end2; $index++) + { + $diff[] = array($sequence1[$index], self::UNMODIFIED); + } - // return the diff - return $diff; - } + // return the diff + return $diff; + } - /* Returns the diff for two files. The parameters are: + /* Returns the diff for two files. The parameters are: * * $file1 - the path to the first file * $file2 - the path to the second file * $compareCharacters - true to compare characters, and false to compare * lines; this optional parameter defaults to false */ - public static function compareFiles( - $file1, - $file2, - $compareCharacters = false - ) { + public static function compareFiles( + $file1, + $file2, + $compareCharacters = false + ) { - // return the diff of the files - return self::compare( - file_get_contents($file1), - file_get_contents($file2), - $compareCharacters - ); - } + // return the diff of the files + return self::compare( + file_get_contents($file1), + file_get_contents($file2), + $compareCharacters + ); + } - /* Returns the table of longest common subsequence lengths for the specified + /* Returns the table of longest common subsequence lengths for the specified * sequences. The parameters are: * * $sequence1 - the first sequence @@ -120,43 +120,43 @@ class Diff * $end1 - the ending index for the first sequence * $end2 - the ending index for the second sequence */ - private static function computeTable( - $sequence1, - $sequence2, - $start, - $end1, - $end2 - ) { + private static function computeTable( + $sequence1, + $sequence2, + $start, + $end1, + $end2 + ) { - // determine the lengths to be compared - $length1 = $end1 - $start + 1; - $length2 = $end2 - $start + 1; + // determine the lengths to be compared + $length1 = $end1 - $start + 1; + $length2 = $end2 - $start + 1; - // initialise the table - $table = array(array_fill(0, $length2 + 1, 0)); + // initialise the table + $table = array(array_fill(0, $length2 + 1, 0)); - // loop over the rows - for ($index1 = 1; $index1 <= $length1; $index1++) { - // create the new row - $table[$index1] = array(0); + // loop over the rows + for ($index1 = 1; $index1 <= $length1; $index1++) { + // create the new row + $table[$index1] = array(0); - // loop over the columns - for ($index2 = 1; $index2 <= $length2; $index2++) { - // store the longest common subsequence length - if ($sequence1[$index1 + $start - 1]== $sequence2[$index2 + $start - 1] - ) { - $table[$index1][$index2] = $table[$index1 - 1][$index2 - 1] + 1; - } else { - $table[$index1][$index2] = max($table[$index1 - 1][$index2], $table[$index1][$index2 - 1]); - } - } - } + // loop over the columns + for ($index2 = 1; $index2 <= $length2; $index2++) { + // store the longest common subsequence length + if ($sequence1[$index1 + $start - 1]== $sequence2[$index2 + $start - 1] + ) { + $table[$index1][$index2] = $table[$index1 - 1][$index2 - 1] + 1; + } else { + $table[$index1][$index2] = max($table[$index1 - 1][$index2], $table[$index1][$index2 - 1]); + } + } + } - // return the table - return $table; - } + // return the table + return $table; + } - /* Returns the partial diff for the specificed sequences, in reverse order. + /* Returns the partial diff for the specificed sequences, in reverse order. * The parameters are: * * $table - the table returned by the computeTable function @@ -164,48 +164,48 @@ class Diff * $sequence2 - the second sequence * $start - the starting index */ - private static function generatePartialDiff( - $table, - $sequence1, - $sequence2, - $start - ) { + private static function generatePartialDiff( + $table, + $sequence1, + $sequence2, + $start + ) { - // initialise the diff - $diff = array(); + // initialise the diff + $diff = array(); - // initialise the indices - $index1 = count($table) - 1; - $index2 = count($table[0]) - 1; + // initialise the indices + $index1 = count($table) - 1; + $index2 = count($table[0]) - 1; - // loop until there are no items remaining in either sequence - while ($index1 > 0 || $index2 > 0) { - // check what has happened to the items at these indices - if ($index1 > 0 && $index2 > 0 - && $sequence1[$index1 + $start - 1]== $sequence2[$index2 + $start - 1] - ) { - // update the diff and the indices - $diff[] = array($sequence1[$index1 + $start - 1], self::UNMODIFIED); - $index1--; - $index2--; - } elseif ($index2 > 0 - && $table[$index1][$index2] == $table[$index1][$index2 - 1] - ) { - // update the diff and the indices - $diff[] = array($sequence2[$index2 + $start - 1], self::INSERTED); - $index2--; - } else { - // update the diff and the indices - $diff[] = array($sequence1[$index1 + $start - 1], self::DELETED); - $index1--; - } - } + // loop until there are no items remaining in either sequence + while ($index1 > 0 || $index2 > 0) { + // check what has happened to the items at these indices + if ($index1 > 0 && $index2 > 0 + && $sequence1[$index1 + $start - 1]== $sequence2[$index2 + $start - 1] + ) { + // update the diff and the indices + $diff[] = array($sequence1[$index1 + $start - 1], self::UNMODIFIED); + $index1--; + $index2--; + } elseif ($index2 > 0 + && $table[$index1][$index2] == $table[$index1][$index2 - 1] + ) { + // update the diff and the indices + $diff[] = array($sequence2[$index2 + $start - 1], self::INSERTED); + $index2--; + } else { + // update the diff and the indices + $diff[] = array($sequence1[$index1 + $start - 1], self::DELETED); + $index1--; + } + } - // return the diff - return $diff; - } + // return the diff + return $diff; + } - /* Returns a diff as a string, where unmodified lines are prefixed by ' ', + /* Returns a diff as a string, where unmodified lines are prefixed by ' ', * deletions are prefixed by '- ', and insertions are prefixed by '+ '. The * parameters are: * @@ -213,36 +213,36 @@ class Diff * $separator - the separator between lines; this optional parameter defaults * to "\n" */ - public static function toString($diff, $separator = "\n") - { + public static function toString($diff, $separator = "\n") + { - // initialise the string - $string = ''; + // initialise the string + $string = ''; - // loop over the lines in the diff - foreach ($diff as $line) { - // extend the string with the line - switch ($line[1]) { - case self::UNMODIFIED: - $string .= ' ' . $line[0]; - break; - case self::DELETED: - $string .= '- ' . $line[0]; - break; - case self::INSERTED: - $string .= '+ ' . $line[0]; - break; - } + // loop over the lines in the diff + foreach ($diff as $line) { + // extend the string with the line + switch ($line[1]) { + case self::UNMODIFIED: + $string .= ' ' . $line[0]; + break; + case self::DELETED: + $string .= '- ' . $line[0]; + break; + case self::INSERTED: + $string .= '+ ' . $line[0]; + break; + } - // extend the string with the separator - $string .= $separator; - } + // extend the string with the separator + $string .= $separator; + } - // return the string - return $string; - } + // return the string + return $string; + } - /* Returns a diff as an HTML string, where unmodified lines are contained + /* Returns a diff as an HTML string, where unmodified lines are contained * within 'span' elements, deletions are contained within 'del' elements, and * insertions are contained within 'ins' elements. The parameters are: * @@ -250,40 +250,40 @@ class Diff * $separator - the separator between lines; this optional parameter defaults * to '<br>' */ - public static function toHTML($diff, $separator = '<br>') - { + public static function toHTML($diff, $separator = '<br>') + { - // initialise the HTML - $html = ''; + // initialise the HTML + $html = ''; - // loop over the lines in the diff - foreach ($diff as $line) { - // extend the HTML with the line - switch ($line[1]) { - case self::UNMODIFIED: - $element = 'span'; - break; - case self::DELETED: - $element = 'del'; - break; - case self::INSERTED: - $element = 'ins'; - break; - } - $html .= - '<' . $element . '>' - . htmlspecialchars($line[0]) - . '</' . $element . '>'; + // loop over the lines in the diff + foreach ($diff as $line) { + // extend the HTML with the line + switch ($line[1]) { + case self::UNMODIFIED: + $element = 'span'; + break; + case self::DELETED: + $element = 'del'; + break; + case self::INSERTED: + $element = 'ins'; + break; + } + $html .= + '<' . $element . '>' + . htmlspecialchars($line[0]) + . '</' . $element . '>'; - // extend the HTML with the separator - $html .= $separator; - } + // extend the HTML with the separator + $html .= $separator; + } - // return the HTML - return $html; - } + // return the HTML + return $html; + } - /* Returns a diff as an HTML table. The parameters are: + /* Returns a diff as an HTML table. The parameters are: * * $diff - the diff array * $indentation - indentation to add to every line of the generated HTML; this @@ -291,89 +291,89 @@ class Diff * $separator - the separator between lines; this optional parameter * defaults to '<br>' */ - public static function toTable($diff, $indentation = '', $separator = '<br>') - { + public static function toTable($diff, $indentation = '', $separator = '<br>') + { - // initialise the HTML - $html = $indentation . "<table class=\"diff\">\n"; + // initialise the HTML + $html = $indentation . "<table class=\"diff\">\n"; - // loop over the lines in the diff - $index = 0; - while ($index < count($diff)) { - // determine the line type - switch ($diff[$index][1]) { - // display the content on the left and right - case self::UNMODIFIED: - $leftCell = self::getCellContent( - $diff, - $indentation, - $separator, - $index, - self::UNMODIFIED - ); - $rightCell = $leftCell; - break; + // loop over the lines in the diff + $index = 0; + while ($index < count($diff)) { + // determine the line type + switch ($diff[$index][1]) { + // display the content on the left and right + case self::UNMODIFIED: + $leftCell = self::getCellContent( + $diff, + $indentation, + $separator, + $index, + self::UNMODIFIED + ); + $rightCell = $leftCell; + break; - // display the deleted on the left and inserted content on the right - case self::DELETED: - $leftCell = self::getCellContent( - $diff, - $indentation, - $separator, - $index, - self::DELETED - ); - $rightCell = self::getCellContent( - $diff, - $indentation, - $separator, - $index, - self::INSERTED - ); - break; + // display the deleted on the left and inserted content on the right + case self::DELETED: + $leftCell = self::getCellContent( + $diff, + $indentation, + $separator, + $index, + self::DELETED + ); + $rightCell = self::getCellContent( + $diff, + $indentation, + $separator, + $index, + self::INSERTED + ); + break; - // display the inserted content on the right - case self::INSERTED: - $leftCell = ''; - $rightCell = self::getCellContent( - $diff, - $indentation, - $separator, - $index, - self::INSERTED - ); - break; - } + // display the inserted content on the right + case self::INSERTED: + $leftCell = ''; + $rightCell = self::getCellContent( + $diff, + $indentation, + $separator, + $index, + self::INSERTED + ); + break; + } - // extend the HTML with the new row - $html .= - $indentation - . " <tr>\n" - . $indentation - . ' <td class="diff' - . ($leftCell == $rightCell - ? 'Unmodified' - : ($leftCell == '' ? 'Blank' : 'Deleted')) - . '">' - . $leftCell - . "</td>\n" - . $indentation - . ' <td class="diff' - . ($leftCell == $rightCell - ? 'Unmodified' - : ($rightCell == '' ? 'Blank' : 'Inserted')) - . '">' - . $rightCell - . "</td>\n" - . $indentation - . " </tr>\n"; - } + // extend the HTML with the new row + $html .= + $indentation + . " <tr>\n" + . $indentation + . ' <td class="diff' + . ($leftCell == $rightCell + ? 'Unmodified' + : ($leftCell == '' ? 'Blank' : 'Deleted')) + . '">' + . $leftCell + . "</td>\n" + . $indentation + . ' <td class="diff' + . ($leftCell == $rightCell + ? 'Unmodified' + : ($rightCell == '' ? 'Blank' : 'Inserted')) + . '">' + . $rightCell + . "</td>\n" + . $indentation + . " </tr>\n"; + } - // return the HTML - return $html . $indentation . "</table>\n"; - } + // return the HTML + return $html . $indentation . "</table>\n"; + } - /* Returns the content of the cell, for use in the toTable function. The + /* Returns the content of the cell, for use in the toTable function. The * parameters are: * * $diff - the diff array @@ -382,22 +382,22 @@ class Diff * $index - the current index, passes by reference * $type - the type of line */ - private static function getCellContent($diff, $indentation, $separator, &$index, $type) - { - // initialise the HTML - $html = ''; + private static function getCellContent($diff, $indentation, $separator, &$index, $type) + { + // initialise the HTML + $html = ''; - // loop over the matching lines, adding them to the HTML - while ($index < count($diff) && $diff[$index][1] == $type) { - $html .= - '<span>' - . htmlspecialchars($diff[$index][0]) - . '</span>' - . $separator; - $index++; - } + // loop over the matching lines, adding them to the HTML + while ($index < count($diff) && $diff[$index][1] == $type) { + $html .= + '<span>' + . htmlspecialchars($diff[$index][0]) + . '</span>' + . $separator; + $index++; + } - // return the HTML - return $html; - } + // return the HTML + return $html; + } } diff --git a/htdocs/ticket/css/styles.css.php b/htdocs/ticket/css/styles.css.php index 914a3dba119..c6b14fd5df3 100644 --- a/htdocs/ticket/css/styles.css.php +++ b/htdocs/ticket/css/styles.css.php @@ -51,7 +51,7 @@ html { html { <?php if (! empty($conf->global->TICKET_SHOW_MODULE_LOGO)) { - print 'background: url("../public/img/bg_ticket.png") no-repeat 95% 90%;'; + print 'background: url("../public/img/bg_ticket.png") no-repeat 95% 90%;'; } ?> } diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index 1f5f06ccc1f..cf8ed28db96 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -229,7 +229,6 @@ print '<div class="fichecenter"><div class="fichethirdleft">'; print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<input type="hidden" name="token" value="'.newToken().'">'; - print '<table class="noborder centpercent">'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; // Company diff --git a/htdocs/user/admin/group_extrafields.php b/htdocs/user/admin/group_extrafields.php index 92be17dcd47..ebdd1bd77c0 100644 --- a/htdocs/user/admin/group_extrafields.php +++ b/htdocs/user/admin/group_extrafields.php @@ -98,7 +98,7 @@ if ($action == 'create') print '<br><div id="newattrib"></div>'; print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -111,7 +111,7 @@ if ($action == 'edit' && ! empty($attrname)) print "<br>"; print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/user/admin/user_extrafields.php b/htdocs/user/admin/user_extrafields.php index 1f87b5fbe90..2653dfc9090 100644 --- a/htdocs/user/admin/user_extrafields.php +++ b/htdocs/user/admin/user_extrafields.php @@ -60,7 +60,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; $textobject=$langs->transnoentitiesnoconv("Users"); -$help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:M&oacute;dulo_Usuarios'; +$help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:M&oacute;dulo_Usuarios|DE:Modul_Benutzer'; llxHeader('', $langs->trans("UsersSetup"), $help_url); @@ -88,8 +88,8 @@ if ($action != 'create' && $action != 'edit') /* ************************************************************************** */ /* */ -/* Creation d'un champ optionnel - /* */ +/* Creation of an optional field */ +/* */ /* ************************************************************************** */ if ($action == 'create') @@ -102,7 +102,7 @@ if ($action == 'create') /* ************************************************************************** */ /* */ -/* Edition d'un champ optionnel */ +/* Editing an optional field */ /* */ /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 373a8b55f0e..fb1da988ce4 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -290,7 +290,8 @@ class Users extends DolibarrApi * @param int $id Id of user * @return array Array of group objects * - * @throws RestException + * @throws RestException 403 Not allowed + * @throws RestException 404 Not found * * @url GET {id}/groups */ @@ -299,7 +300,7 @@ class Users extends DolibarrApi $obj_ret = array(); if (!DolibarrApiAccess::$user->rights->user->user->lire) { - throw new RestException(401); + throw new RestException(403); } $user = new User($this->db); diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 64cf4b21b2e..02992eafa04 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -35,7 +35,7 @@ require_once '../main.inc.php'; // This can happen only with a bookmark or forged url call. if (!empty($_SESSION["dol_authmode"]) && ($_SESSION["dol_authmode"] == 'forceuser' || $_SESSION["dol_authmode"] == 'http')) { - unset($_SESSION["dol_login"]); + unset($_SESSION["dol_login"]); die("Applicative disconnection should be useless when connection was made in mode ".$_SESSION["dol_authmode"]); } diff --git a/htdocs/variants/create_val.php b/htdocs/variants/create_val.php index e0828cc07dd..5093f242326 100644 --- a/htdocs/variants/create_val.php +++ b/htdocs/variants/create_val.php @@ -43,9 +43,9 @@ if ($object->fetch($id) < 1) { if ($cancel) { - $action=''; - header('Location: '.DOL_URL_ROOT.'/variants/card.php?id='.$object->id); - exit(); + $action=''; + header('Location: '.DOL_URL_ROOT.'/variants/card.php?id='.$object->id); + exit(); } // None diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 466cf3366da..0a80c205925 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -55,30 +55,30 @@ $server->wsdl->schemaTargetNamespace=$ns; // Define WSDL Authentication object $server->wsdl->addComplexType( - 'authentication', - 'complexType', - 'struct', - 'all', - '', - array( - 'dolibarrkey' => array('name'=>'dolibarrkey','type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication','type'=>'xsd:string'), - 'login' => array('name'=>'login','type'=>'xsd:string'), - 'password' => array('name'=>'password','type'=>'xsd:string'), - 'entity' => array('name'=>'entity','type'=>'xsd:string'), - ) + 'authentication', + 'complexType', + 'struct', + 'all', + '', + array( + 'dolibarrkey' => array('name'=>'dolibarrkey','type'=>'xsd:string'), + 'sourceapplication' => array('name'=>'sourceapplication','type'=>'xsd:string'), + 'login' => array('name'=>'login','type'=>'xsd:string'), + 'password' => array('name'=>'password','type'=>'xsd:string'), + 'entity' => array('name'=>'entity','type'=>'xsd:string'), + ) ); // Define WSDL Return object $server->wsdl->addComplexType( - 'result', - 'complexType', - 'struct', - 'all', - '', - array( - 'result_code' => array('name'=>'result_code','type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label','type'=>'xsd:string'), - ) + 'result', + 'complexType', + 'struct', + 'all', + '', + array( + 'result_code' => array('name'=>'result_code','type'=>'xsd:string'), + 'result_label' => array('name'=>'result_label','type'=>'xsd:string'), + ) ); // Define WSDL Return object for document @@ -109,16 +109,16 @@ $styleuse='encoded'; // encoded/literal/literal wrapped // Register WSDL $server->register( - 'getVersions', - // Entry values - array('authentication'=>'tns:authentication'), - // Exit values - array('result'=>'tns:result','dolibarr'=>'xsd:string','os'=>'xsd:string','php'=>'xsd:string','webserver'=>'xsd:string'), - $ns, - $ns.'#getVersions', - $styledoc, - $styleuse, - 'WS to get Versions' + 'getVersions', + // Entry values + array('authentication'=>'tns:authentication'), + // Exit values + array('result'=>'tns:result','dolibarr'=>'xsd:string','os'=>'xsd:string','php'=>'xsd:string','webserver'=>'xsd:string'), + $ns, + $ns.'#getVersions', + $styledoc, + $styleuse, + 'WS to get Versions' ); // Register WSDL @@ -146,15 +146,15 @@ function getVersions($authentication) if ($authentication['entity']) $conf->entity=$authentication['entity']; - // Init and check authentication - $objectresp=array(); - $errorcode='';$errorlabel=''; - $error=0; - $fuser=check_authentication($authentication, $error, $errorcode, $errorlabel); - // Check parameters + // Init and check authentication + $objectresp=array(); + $errorcode='';$errorlabel=''; + $error=0; + $fuser=check_authentication($authentication, $error, $errorcode, $errorlabel); + // Check parameters - if (! $error) + if (! $error) { $objectresp['result']=array('result_code'=>'OK', 'result_label'=>''); $objectresp['dolibarr']=version_dolibarr(); diff --git a/htdocs/webservices/server_payment.php b/htdocs/webservices/server_payment.php index 3ccf3dafcaa..4f4490d4707 100644 --- a/htdocs/webservices/server_payment.php +++ b/htdocs/webservices/server_payment.php @@ -97,7 +97,7 @@ $server->wsdl->addComplexType( '', array( 'amount' => array('name'=>'amount','type'=>'xsd:double'), - 'num_paiement' => array('name'=>'num_paiement','type'=>'xsd:string'), + 'num_payment' => array('name'=>'num_payment','type'=>'xsd:string'), 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'), 'bank_account' => array('name'=>'bank_account','type'=>'xsd:int'), 'payment_mode_id' => array('name'=>'payment_mode_id','type'=>'xsd:int'), @@ -167,14 +167,14 @@ function createPayment($authentication, $payment) $soc = new Societe($db); $res = $soc->fetch($payment['thirdparty_id']); - $new_payment = new Paiement($db); - $new_payment->amount = doubleval($payment['amount']); - $new_payment->num_paiement = $payment['num_paiement']; - $new_payment->bank_account = intval($payment['bank_account']); - $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; - $new_payment->datepaye = $now; - $new_payment->author = $payment['thirdparty_id']; - $new_payment->amounts = array(); + $new_payment = new Paiement($db); + $new_payment->amount = doubleval($payment['amount']); + $new_payment->num_payment = $payment['num_payment']; + $new_payment->fk_account = intval($payment['bank_account']); + $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; + $new_payment->datepaye = $now; + $new_payment->author = $payment['thirdparty_id']; + $new_payment->amounts = array(); if (intval($payment['invoice_id']) > 0) { $new_payment->amounts[ $payment['invoice_id'] ] = $new_payment->amount; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 275df563c53..ed82a4aa43e 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -353,7 +353,7 @@ class Website extends CommonObject /** - * Load object in memory from the database + * Load all object in memory ($this->records) from the database * * @param string $sortorder Sort Order * @param string $sortfield Sort field diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 516640d15fb..7d1f345d8c2 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -282,7 +282,7 @@ class WebsitePage extends CommonObject } /** - * Load list of objects in memory from the database. + * Return array of all web site pages. * * @param string $websiteid Web site * @param string $sortorder Sort Order diff --git a/htdocs/website/index.php b/htdocs/website/index.php index e8732c04673..17bf6c8ebde 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -121,7 +121,7 @@ if ($websiteid > 0 || $websitekey) $website = $object; -// Check pageid received as aprameter +// Check pageid received as parameter if ($pageid < 0) $pageid = 0; if (($pageid > 0 || $pageref) && $action != 'addcontainer') { @@ -2074,7 +2074,7 @@ if (!GETPOST('hide_websitemenu')) // List of website print '<span class="websiteselection">'; $out = ''; - $out .= '<select name="website" class="minwidth100 maxwidth300" id="website">'; + $out .= '<select name="website" class="minwidth100 maxwidth300 maxwidth150onsmartphone" id="website">'; if (empty($object->records)) $out .= '<option value="-1">&nbsp;</option>'; // Loop on each sites $i = 0; @@ -2260,7 +2260,7 @@ if (!GETPOST('hide_websitemenu')) if ($action != 'addcontainer') { - print '<span class="websiteselection">'.$formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action).'</span>'; + print '<span class="websiteselection">'.$formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action, 'maxwidth200onsmartphone').'</span>'; } else { @@ -3495,6 +3495,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print '<td class="tdoverflow100">'.$answerrecord->description.'</td>'; print '<td>'; $param = '?action=replacesiteconfirm'; + $param .= '&websiteid='.$website->id; $param .= '&optioncontent='.GETPOST('optioncontent'); $param .= '&optionmeta='.GETPOST('optionmeta'); $param .= '&optionsitefiles='.GETPOST('optionsitefiles'); @@ -3641,10 +3642,20 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa // If mode WEBSITE_SUBCONTAINERSINLINE is on if (!empty($conf->global->WEBSITE_SUBCONTAINERSINLINE)) { + // TODO Check file $filephp exists, if not create it. + //var_dump($filetpl); $filephp = $filetpl; ob_start(); - include $filephp; + try { + $res = include $filephp; + if (empty($res)) { + print "ERROR: Failed to include file '".$filephp."'. Try to edit and save page."; + } + } catch(Exception $e) + { + print $e->getMessage(); + } $newcontent = ob_get_contents(); ob_end_clean(); } diff --git a/htdocs/website/samples/wrapper.html b/htdocs/website/samples/wrapper.php similarity index 50% rename from htdocs/website/samples/wrapper.html rename to htdocs/website/samples/wrapper.php index 7a3932c1608..35f2b410f78 100644 --- a/htdocs/website/samples/wrapper.html +++ b/htdocs/website/samples/wrapper.php @@ -1,15 +1,22 @@ <?php -// BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of wrapper.html sample. +// BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of file website/samples/wrapper.php $websitekey=basename(__DIR__); +if (strpos($_SERVER["PHP_SELF"], 'website/samples/wrapper.php')) die("Sample file for website module. Can be called directly."); if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; $encoding = ''; + +// Parameters to download files $hashp=GETPOST('hashp', 'aZ09'); $modulepart=GETPOST('modulepart', 'aZ09'); $entity=GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; $original_file=GETPOST("file", "alpha"); +// Parameters for RSS +$rss=GETPOST('rss', 'aZ09'); +if ($rss) $original_file = 'blog.rss'; + // If we have a hash public (hashp), we guess the original_file. if (! empty($hashp)) { @@ -60,14 +67,14 @@ if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) $attachment=false // Define mime type $type = 'application/octet-stream'; -if (GETPOST('type','none')) $type=GETPOST('type', 'alpha'); +if (GETPOSTISSET('type')) $type=GETPOST('type', 'alpha'); else $type=dol_mimetype($original_file); // Security: Delete string ../ into $original_file -$original_file=str_replace("../","/", $original_file); +$original_file = str_replace("../", "/", $original_file); // Cache or not -if (GETPOST("cache",'none') || image_format_supported($original_file) >= 0) +if (GETPOST("cache", 'none') || image_format_supported($original_file) >= 0) { // Important: Following code is to avoid page request by browser and PHP CPU at // each Dolibarr page access. @@ -75,26 +82,139 @@ if (GETPOST("cache",'none') || image_format_supported($original_file) >= 0) header('Pragma: cache'); // This is to avoid having Pragma: no-cache } -// Find the subdirectory name as the reference $refname=basename(dirname($original_file)."/"); -if ($_GET["modulepart"] == "mycompany" && preg_match('/^\/?logos\//', $original_file)) +// Get RSS news +if ($rss) { + $format = 'rss'; + $type = ''; + $cachedelay = 0; + $filename = $original_file; + $filters = array('type_container'=>'blogpost', 'lang'=>'en_US'); + $dir_temp = $conf->website->dir_temp; + include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; + include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; + $website = new Website($db); + $websitepage = new WebsitePage($db); + + $website->fetch('', $websitekey); + + $MAXNEWS = 20; + $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); + $eventarray = $arrayofblogs; + + require_once DOL_DOCUMENT_ROOT."/core/lib/xcal.lib.php"; + require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; + require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; + + dol_syslog("build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); + + // Clean parameters + if (!$filename) + { + $extension = 'rss'; + $filename = $format.'.'.$extension; + } + + // Create dir and define output file (definitive and temporary) + $result = dol_mkdir($dir_temp); + $outputfile = $dir_temp.'/'.$filename; + + $result = 0; + + $buildfile = true; + + if ($cachedelay) + { + $nowgmt = dol_now(); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) + { + dol_syslog("build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); + $buildfile = false; + } + } + + if ($buildfile) + { + $title=$desc=$langs->transnoentities('LastBlogPosts'); + + // Create temp file + $outputfiletmp=tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads + @chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK)); + + // Write file + $result=build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp); + + if ($result >= 0) + { + if (dol_move($outputfiletmp, $outputfile, 0, 1)) $result=1; + else + { + $error='Failed to rename '.$outputfiletmp.' into '.$outputfile; + dol_syslog("build_exportfile ".$error, LOG_ERR); + dol_delete_file($outputfiletmp, 0, 1); + print $error; + exit(-1); + } + } + else + { + dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); + dol_delete_file($outputfiletmp, 0, 1); + $langs->load("errors"); + print $langs->trans("ErrorFailToCreateFile", $outputfile); + exit(-1); + } + } + + if ($result >= 0) + { + $attachment = false; + if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; + //$attachment = false; + $contenttype='application/rss+xml'; + if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; + //$contenttype='text/plain'; + $outputencoding='UTF-8'; + + if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); + if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); + + // Ajout directives pour resoudre bug IE + //header('Cache-Control: Public, must-revalidate'); + //header('Pragma: public'); + if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); + else header('Cache-Control: private, must-revalidate'); + + // Clean parameters + $outputfile=$dir_temp.'/'.$filename; + $result=readfile($outputfile); + if (! $result) print 'File '.$outputfile.' was empty.'; + + // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); + exit; + } +} +// Get logos +elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file)) { readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file)); } -else +else { + // Find the subdirectory name as the reference include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name - if (! empty($_GET["hashp"])) + if ($hashp) { $accessallowed = 1; // When using hashp, link is public so we force $accessallowed $sqlprotectagainstexternals = ''; } - + // Security: // Limit access if permissions are wrong if (! $accessallowed) @@ -131,4 +251,4 @@ else readfile($fullpath_original_file_osencoded); } if (is_object($db)) $db->close(); -// END PHP ?> +// END PHP diff --git a/scripts/accountancy/export-thirdpartyaccount.php b/scripts/accountancy/export-thirdpartyaccount.php index 9399066078f..e24a460f61e 100755 --- a/scripts/accountancy/export-thirdpartyaccount.php +++ b/scripts/accountancy/export-thirdpartyaccount.php @@ -33,7 +33,7 @@ $langs->loadLangs(array("companies", "compta", "main", "accountancy")); // Security check if (!$user->admin) - accessforbidden(); + accessforbidden(); // Date range $year = GETPOST("year"); diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 4e5069b4fdc..eb5b794d3d1 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -328,7 +328,7 @@ if ($resql) { dol_syslog("error for emailing id " . $id . " #" . $i . ($mail->error ? ' - ' . $mail->error : ''), LOG_DEBUG); $sqlerror = "UPDATE " . MAIN_DB_PREFIX . "mailing_cibles"; - $sqlerror .= " SET statut=-1, date_envoi=" . $db->idate($now) . " WHERE rowid=" . $obj->rowid; + $sqlerror .= " SET statut=-1, date_envoi='" . $db->idate($now) . "' WHERE rowid=" . $obj->rowid; $resqlerror = $db->query($sqlerror); if (! $resqlerror) { dol_print_error($db); diff --git a/scripts/website/blogpost-footer.txt b/scripts/website/blogpost-footer.txt new file mode 100644 index 00000000000..e79ea4f6a4a --- /dev/null +++ b/scripts/website/blogpost-footer.txt @@ -0,0 +1,2 @@ +<!-- Before this is the imported content --> +<?php includeContainer('blogpost-footer'); ?> \ No newline at end of file diff --git a/scripts/website/blogpost-header.txt b/scripts/website/blogpost-header.txt new file mode 100644 index 00000000000..5c414286e77 --- /dev/null +++ b/scripts/website/blogpost-header.txt @@ -0,0 +1,4 @@ +<?php includeContainer('blogpost-header'); ?> +<h1><?php echo $websitepage->title ?></h1> + +<!-- After this is the imported content --> \ No newline at end of file diff --git a/scripts/website/migrate_news_joomla2dolibarr.php b/scripts/website/migrate-news-joomla2dolibarr.php similarity index 64% rename from scripts/website/migrate_news_joomla2dolibarr.php rename to scripts/website/migrate-news-joomla2dolibarr.php index 609ae59f128..e9f6c3c2295 100755 --- a/scripts/website/migrate_news_joomla2dolibarr.php +++ b/scripts/website/migrate-news-joomla2dolibarr.php @@ -17,7 +17,7 @@ */ /** - * \file scripts/website/migrate_newsèjoomla2dolibarr.php + * \file scripts/website/migrate_news_joomla2dolibarr.php * \ingroup scripts * \brief Migrate news from a Joomla databse into a Dolibarr website */ @@ -37,15 +37,16 @@ define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); // Set this define to 0 if you want to $error = 0; -$mode = $argv[1]; -$websiteref = $argv[2]; -$joomlaserverinfo = $argv[3]; +$mode = empty($argv[1])?'':$argv[1]; +$websiteref = empty($argv[2])?'':$argv[2]; +$joomlaserverinfo = empty($argv[3])?'':$argv[3]; $image = 'image/__WEBSITE_KEY__/images/stories/dolibarr.png'; -$max = 1; +$max = (!isset($argv[4]) || (empty($argv[4]) && $argv[4] !== '0'))?'10':$argv[4]; if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) { - print "Usage: $script_file (test|confirm) website login:pass@serverjoomla/tableprefix/databasejoomla\n"; + print '***** '.$script_file.' *****'."\n"; + print "Usage: $script_file (test|confirm) website login:pass@serverjoomla/tableprefix/databasejoomla [nbmaxrecord]\n"; print "\n"; print "Load joomla news and create them into Dolibarr database (if they don't alreay exist).\n"; exit(-1); @@ -53,6 +54,8 @@ if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($w require $path."../../htdocs/master.inc.php"; include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; +include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php'; $langs->load('main'); @@ -92,10 +95,23 @@ if (! $resql) { exit; } +$blogpostheader = file_get_contents($path.'blogpost-header.txt'); +if ($blogpostheader === false) { + print "Error: Failed to load file content of 'blogpost-header.txt'\n"; + exit(-1); +} +$blogpostfooter = file_get_contents($path.'blogpost-footer.txt'); +if ($blogpostfooter === false) { + print "Error: Failed to load file content of 'blogpost-footer.txt'\n"; + exit(-1); +} + + + $db->begin(); +$i = 0; $nbimported = 0; $nbalreadyexists = 0; while ($obj = $dbjoomla->fetch_object($resql)) { - $i = 0; if ($obj) { $i++; $id = $obj->id; @@ -104,37 +120,68 @@ while ($obj = $dbjoomla->fetch_object($resql)) { //$description = dol_string_nohtmltag($obj->introtext); $description = trim(dol_trunc(dol_string_nohtmltag($obj->metadesc), 250)); if (empty($description)) $description = trim(dol_trunc(dol_string_nohtmltag($obj->introtext), 250)); - $hmtltext = $obj->introtext.'<br>'."\n".'<hr>'."\n".'<br>'."\n".$obj->fulltext; + + $htmltext = ""; + if ($blogpostheader) $htmltext .= $blogpostheader."\n"; + $htmltext .= '<section id="mysectionnews" contenteditable="true">'."\n"; + $htmltext .= $obj->introtext; + if ($obj->fulltext) { + $htmltext .= '<br>'."\n".'<hr>'."\n".'<br>'."\n".$obj->fulltext; + } + $htmltext .= "\n</section>"; + if ($blogpostfooter) $htmltext .= "\n".$blogpostfooter; + $language = ($obj->language && $obj->language != '*' ? $obj->language : 'en'); $keywords = $obj->metakey; $author_alias = $obj->username; $date_creation = $dbjoomla->jdate($obj->publish_up); - print $i.' '.$id.' '.$title.' '.$language.' '.$keywords.' '.$importid."\n"; + print '#'.$i.' id='.$id.' '.$title.' lang='.$language.' keywords='.$keywords.' importid='.$importid."\n"; $sqlinsert = 'INSERT INTO '.MAIN_DB_PREFIX.'website_page(fk_website, pageurl, aliasalt, title, description, keywords, content, status, type_container, lang, import_key, image, date_creation, author_alias)'; $sqlinsert .= " VALUES(".$websiteid.", '".$db->escape($alias)."', '', '".$db->escape($title)."', '".$db->escape($description)."', '".$db->escape($keywords)."', "; - $sqlinsert .= " '".$db->escape($hmtltext)."', '1', 'blogpost', '".$db->escape($language)."', '".$db->escape($importid)."', '".$db->escape($image)."', '".$db->idate($date_creation)."', '".$db->escape($author_alias)."')"; + $sqlinsert .= " '".$db->escape($htmltext)."', '1', 'blogpost', '".$db->escape($language)."', '".$db->escape($importid)."', '".$db->escape($image)."', '".$db->idate($date_creation)."', '".$db->escape($author_alias)."')"; print $sqlinsert."\n"; $result = $db->query($sqlinsert); if ($result <= 0) { - $error++; - print 'Error, '.$db->lasterror.": ".$sqlinsert."\n"; - break; + print 'ERROR: '.$db->lasterrno.": ".$sqlinsert."\n"; + if ($db->lasterrno != 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $error++; + } else { + $nbalreadyexists++; + } + } else { + $pageid = $db->last_insert_id(MAIN_DB_PREFIX.'website_page'); + + if ($pageid > 0) { // We must also regenerate page on disk + global $dolibarr_main_data_root; + $pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteref; + $filetpl = $pathofwebsite.'/page'.$pageid.'.tpl.php'; + $websitepage = new WebsitePage($db); + $websitepage->fetch($pageid); + dolSavePageContent($filetpl, $website, $websitepage); + } + + print "Insert done - pageid = ".$pageid."\n"; + $nbimported++; } - if ($max && $i <= $max) { - print 'Nb max of record reached. We stop now.'."\n"; + if ($max && $i >= $max) { + print 'Nb max of record ('.$max.') reached. We stop now.'."\n"; break; } } } if ($mode == 'confirm' && ! $error) { + print "Commit\n"; + print $nbalreadyexists." page(s) already exists.\n"; + print $nbimported." page(s) imported with importid=".$importid."\n"; $db->commit(); } else { + print "Rollback\n"; $db->rollback(); } diff --git a/scripts/website/regenerate-pages.php b/scripts/website/regenerate-pages.php new file mode 100755 index 00000000000..28bf0f0c7da --- /dev/null +++ b/scripts/website/regenerate-pages.php @@ -0,0 +1,98 @@ +#!/usr/bin/env php +<?php +/* Copyright (C) 2020 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 <https://www.gnu.org/licenses/>. + */ + +/** + * \file scripts/website/regenerate_pages.php + * \ingroup scripts + * \brief Regenerate all pages of a web site + */ + +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path = __DIR__.'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit(-1); +} + +@set_time_limit(0); // No timeout for this script +define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". + +$error = 0; + +$mode = empty($argv[1])?'':$argv[1]; +$websiteref = empty($argv[2])?'':$argv[2]; +$max = (!isset($argv[3]) || (empty($argv[3]) && $argv[3] !== '0'))?'10':$argv[3]; + +if (empty($argv[2]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) { + print '***** '.$script_file.' *****'."\n"; + print "Usage: $script_file (test|confirm) website [nbmaxrecord]\n"; + print "\n"; + print "Regenerate all pages of a web site.\n"; + exit(-1); +} + +require $path."../../htdocs/master.inc.php"; +include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; +include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php'; + +$langs->load('main'); + +$website = new Website($db); +$result = $website->fetch(0, $websiteref); +if ($result <= 0) { + print 'Error, web site '.$websiteref.' not found'."\n"; + exit(-1); +} + +$websitepagestatic = new WebsitePage($db); + +$db->begin(); + +$listofpages = $websitepagestatic->fetchAll($website->id, '', $max); + +global $dolibarr_main_data_root; +$pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteref; + +$nbgenerated = 0; +foreach($listofpages as $websitepage) { + $filealias = $pathofwebsite.'/'.$websitepage->pageurl.'.php'; + $filetpl = $pathofwebsite.'/page'.$websitepage->id.'.tpl.php'; + if ($mode == 'confirm') { + dolSavePageAlias($filealias, $website, $websitepage); + dolSavePageContent($filetpl, $website, $websitepage); + } + print "Generation of page done - pageid = ".$websitepage->id." - ".$websitepage->pageurl."\n"; + $nbgenerated++; + + if ($max && $nbgenerated >= $max) { + print 'Nb max of record ('.$max.') reached. We stop now.'."\n"; + break; + } +} + +if ($mode == 'confirm') { + print $nbgenerated." page(s) generated into ".$pathofwebsite."\n"; +} else { + print $nbgenerated." page(s) found but not generated (test mode)\n"; +} + +exit($error);
    '.$langs->trans("Filter").'