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/.travis.yml b/.travis.yml index 613d2fa2420..688d706331d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -282,7 +282,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude dev/namespacemig --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo 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/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index e50112f7ff1..065a72a5257 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -622,7 +622,7 @@ if ($action == 'delbookkeepingyear') { 'default' => $deljournal ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1, 300); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300); print $formconfirm; } 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/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/lines.php b/htdocs/accountancy/customer/lines.php index 55342a98c27..7e51160195b 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -332,7 +332,7 @@ if ($result) { print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $clickpicto = $form->showCheckAddButtons(); print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print "\n"; @@ -341,7 +341,7 @@ if ($result) { $product_static = new Product($db); while ($objp = $db->fetch_object($result)) { - $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte; + $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte.''; $facture_static->ref = $objp->ref; $facture_static->id = $objp->facid; @@ -390,7 +390,7 @@ if ($result) { print ''.$objp->tva_intra.''; - print ''; + print ''; print $codecompta.' '; print img_edit(); print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 63b142e1bdd..8cc398a00bf 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -287,7 +287,7 @@ if ($result) { while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $codeCompta = length_accountg($objp->account_number).' - '.$objp->label; + $codeCompta = length_accountg($objp->account_number).' - '.$objp->label.''; $expensereport_static->ref = $objp->ref; $expensereport_static->id = $objp->erid; @@ -315,7 +315,7 @@ if ($result) { print ''.$codeCompta.''; - print ''; + print ''; print img_edit(); print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index ef44222568f..8d3f3937823 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -336,7 +336,7 @@ if ($result) { print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $checkpicto = $form->showCheckAddButtons(); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; @@ -347,7 +347,7 @@ if ($result) { while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $codecompta = length_accountg($objp->account_number).' - '.$objp->label; + $codecompta = length_accountg($objp->account_number).' - '.$objp->label.''; $facturefournisseur_static->ref = $objp->ref; $facturefournisseur_static->id = $objp->facid; @@ -399,7 +399,7 @@ if ($result) { print ''.$objp->tva_intra.''; - print ''; + print ''; print $codecompta.' '; print img_edit(); print ''; 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/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).''; print ''.$membertype->getLibStatut(5).''; if ($user->rights->adherent->configurer) - print 'rowid.'">'.img_edit().''; + print 'rowid.'">'.img_edit().''; else print ' '; print ""; @@ -607,7 +607,7 @@ if ($rowid > 0) } print ''; - print ''; + print ''; print ''; print '
'; diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 83c143e4955..b5a6e2e3dfe 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -110,56 +110,60 @@ print ''; print ''; print ''; -print ''."\n"; +print ''."\n"; // Name -print ''."\n"; // Address -print ''."\n"; -print ''."\n"; -print ''."\n"; // Country -print ''."\n"; -print ''."\n"; -print ''; print ''."\n"; -print ''; print ''."\n"; -print ''; print ''."\n"; // Web -print ''; print ''."\n"; // Code -print ''."\n"; // Note -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("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; +print '
'; print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; +print '
'; print '
'; +print '
'; print '
'; +print '
'; print '
'; +print '
'; //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
'; +print '
'; $formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id'); print '
'; +print '
'; +print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); print '
'; +print '
'; +print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); print '
'; +print '
'; +print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); print '
'; +print '
'; +print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); print '
'; +print '
'; print '
'; +print '
'; print '
'."\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 ''."\n"; // Phone print ''; print ''."\n"; // Fax print ''; print ''."\n"; // Email print ''; print ''."\n"; // Web print ''; print ''."\n"; // Barcode if (!empty($conf->barcode->enabled)) { - print ''; print ''; } @@ -480,15 +486,16 @@ if (!empty($conf->barcode->enabled)) { print ''; @@ -497,15 +504,16 @@ print ''; print ''; @@ -524,35 +532,15 @@ print ''; print ''; print "\n"; -// Facebook -print ''; -print ''."\n"; - -// Twitter -print ''; -print ''."\n"; - -// LinkedIn -print ''; -print ''."\n"; - -// Instagram -print ''; -print ''."\n"; - -// Youtube -print ''; -print ''."\n"; - -// Github -print ''; -print ''."\n"; +$listofnetworks = array('facebook'=>'facebook', 'twitter'=>'twitter', 'linkedin'=>'linkedin', 'instagram'=>'instagram', 'youtube'=>'youtube', 'github'=>'github'); +foreach($listofnetworks as $networkkey => $networkicon) { + print ''; + print ''."\n"; +} 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/company.php b/htdocs/admin/company.php index b5ec2969f39..222cc292ace 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -451,27 +451,33 @@ print '
'; +print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); print '
'; +print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); print '
'; +print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); print '
'; +print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); print '
'; + print '
'; + print ''; + print ''; print '
'; print '
'; print ''; -print '
'; +print '
'; if (!empty($mysoc->logo_mini)) { - print ''.img_delete($langs->trans("Delete")).''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - print '
'; + print '
'; print ''; + print '
'; } + print ''; } else { - print ''; + print ''; } print '
'; print '
'; print '
'; print ''; -print '
'; +print '
'; if (!empty($mysoc->logo_squarred_mini)) { - print ''.img_delete($langs->trans("Delete")).''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { - print '
'; + print '
'; print ''; + print '
'; } + print ''; } else { - print ''; + print ''; } print '
'; print '
'.$langs->trans("SocialNetworksInformation").''.$langs->trans("Value").'
'; -print '
'; -print '
'; -print '
'; -print '
'; -print '
'; -print '
'; + print ''; + $networkconst = 'MAIN_INFO_SOCIETE_'.strtoupper($networkkey).'_URL'; + print ''; + print '
"; @@ -707,26 +695,24 @@ print ""; print '
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; print ""; print '\n"; print ""; print '\n"; print "
'.$langs->trans("VATManagement").''.$langs->trans("Description").''.$langs->trans("VATManagement").''.$langs->trans("Description").' 
'; -print ""; -print ""; -if ($mysoc->country_code == 'FR') print "\n"; -print "
".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."
"; +$tooltiphelp = ''; +if ($mysoc->country_code == 'FR') $tooltiphelp = ''.$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR").""; +print ""; print "
'; -print ""; -print ""; -if ($mysoc->country_code == 'FR') print "\n"; -print "
".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."
"; +$tooltiphelp = ''; +if ($mysoc->country_code == 'FR') $tooltiphelp = "".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."\n"; +print ""; print "
"; @@ -740,40 +726,35 @@ if ($mysoc->useLocalTax(1)) print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; // Note: When option is not set, it must not appears as set on on, because there is no default value for this option - print ""; + print ""; print '\n"; - - print ""; + print ""; print '\n"; print "
'.$langs->transcountry("LocalTax1Management", $mysoc->country_code).''.$langs->trans("Description").''.$langs->transcountry("LocalTax1Management", $mysoc->country_code).''.$langs->trans("Description").' 
global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."
global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."'; - print ''; - print ""; - $example = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); - print ($example != "LocalTax1IsUsedExample" ? "\n" : ""); + print '
'; + $tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); + $tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."\n" : ""); + print ""; if (!isOnlyOneLocalTax(1)) { - print '
'; } $opcions = array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"), $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"), $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc")); - print ''; - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."
: '; + print '
: '; $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); - print '
'.$langs->trans("CalcLocaltax").': '; + print '
: '; print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1); - print '
"; + print ""; print "
global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."
global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); - print ($example != "LocalTax1IsNotUsedExample" ? "\n" : ""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."
"; + $tooltiphelp = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); + $tooltiphelp = ($tooltiphelp != "LocalTax1IsNotUsedExample" ? "".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."\n" : ""); + print ""; print "
"; } @@ -783,38 +764,34 @@ if ($mysoc->useLocalTax(2)) print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; - // Note: When option is not set, it must not appears as set on on, because there is no default value for this option - print ""; + print ""; print '\n"; - - print ""; + print ""; print '\n"; print "
'.$langs->transcountry("LocalTax2Management", $mysoc->country_code).''.$langs->trans("Description").''.$langs->transcountry("LocalTax2Management", $mysoc->country_code).''.$langs->trans("Description").' 
global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."
global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."'; - print ''; - print ""; - $example = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); - print ($example != "LocalTax2IsUsedExample" ? "\n" : ""); + print '
'; + print ""; + $tooltiphelp = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); + $tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."\n" : ""); if (!isOnlyOneLocalTax(2)) { - print '
'; } - print ''; - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."
: '; + print '
: '; $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2"); - print '
: '; + print '
: '; print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2); - print '
"; + print ""; print "
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."'; - print ""; - print ""; - $example = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); - print ($example != "LocalTax2IsNotUsedExample" ? "\n" : ""); - print "
".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."
"; + print "
"; + $tooltiphelp = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); + $tooltiphelp = ($tooltiphelp != "LocalTax2IsNotUsedExample" ? "".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."\n" : ""); + print ""; + print "
"; print "
"; } 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/delais.php b/htdocs/admin/delais.php index 5b756c21017..1944f140ef3 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -207,7 +207,7 @@ llxHeader(); print load_fiche_titre($langs->trans("DelaysOfToleranceBeforeWarning"), '', 'title_setup'); -print ''.$langs->transnoentities("DelaysOfToleranceDesc", img_warning()); +print ''.$langs->transnoentities("DelaysOfToleranceDesc", img_warning('default', '', 'pictowarning nopaddingleft')); print " ".$langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php')."
\n"; print "
\n"; 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/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/fckeditor.php b/htdocs/admin/fckeditor.php index cab7bfaecf0..ad077361fe8 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -185,7 +185,7 @@ else print '
'."\n"; print ''."\n"; - print ''; + print ''; // Skins show_skin(null, 1); 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/limits.php b/htdocs/admin/limits.php index 8bc356e18d9..6f52d6dfd12 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -207,29 +207,29 @@ if (empty($mysoc->country_code)) else { // Show examples - print ''.$langs->trans("ExamplesWithCurrentSetup").":
\n"; + print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', ''); // Always show vat rates with vat 0 $s=2/7;$qty=1;$vat=0; $tmparray=calcul_price_total(1, $qty*price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); - print $langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); + print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; $s=10/3;$qty=1;$vat=0; $tmparray=calcul_price_total(1, $qty*price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); - print $langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); + print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; $s=10/3;$qty=2;$vat=0; $tmparray=calcul_price_total(1, $qty*price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); - print $langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); + print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; // Add vat rates examples specific to country $vat_rates=array(); @@ -261,10 +261,10 @@ else { $s=10/3; $tmparray=calcul_price_total(1, $qty*price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); - print $langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); + print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; } } } @@ -276,17 +276,17 @@ else $s=10/3;$qty=1;$vat=10; $tmparray=calcul_price_total(1, $qty*price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); - print $langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); + print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; $s=10/3;$qty=2;$vat=10; $tmparray=calcul_price_total(1, $qty*price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); - print $langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); + print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; } // Important: can debug rounding, to simulate the rounded total 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/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/modulehelp.php b/htdocs/admin/modulehelp.php index 531e53ac459..08ddbd4ad6a 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -290,7 +290,7 @@ $text=''; if ($mode == 'desc') { - if ($moduledesc) $text.=$moduledesc.'

'; + if ($moduledesc) $text .= '
'.$moduledesc.'


'; $text.=''.$langs->trans("Version").': '.$version; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 72eb8240c10..4056bca0ee3 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -552,7 +552,7 @@ if ($mode == 'common') if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // Show list of modules - + //$conf->global->MAIN_USE_KANBAN_FOR_MODULES=1; $oldfamily = ''; foreach ($orders as $key => $value) @@ -637,8 +637,12 @@ if ($mode == 'common') $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label']; print load_fiche_titre($familytext, '', ''); - print '
'; - print ''."\n"; + if (! empty($conf->global->MAIN_USE_KANBAN_FOR_MODULES)) { + print '
'; + } else { + print '
'; + print '
'."\n"; + } $atleastoneforfamily = 0; } @@ -651,9 +655,6 @@ if ($mode == 'common') $oldfamily = $familykey; } - - - // Version (with picto warning or not) $version = $objMod->getVersion(0); $versiontrans = ''; @@ -669,212 +670,221 @@ if ($mode == 'common') $imginfo = "info_black"; } - print ''."\n"; - if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print ''; + if (! empty($conf->global->MAIN_USE_KANBAN_FOR_MODULES)) { + // Output Kanban + print $objMod->getKanbanView(); + } else { + print ''."\n"; + if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print ''; - // Picto + Name of module - print ' \n"; - - // Desc - print '\n"; - - // Help - print ''; - - // Version - print '\n"; - - // Activate/Disable and Setup (2 columns) - if (!empty($conf->global->$const_name)) // If module is already activated - { - $disableSetup = 0; - - // Link enable/disabme - print ''."\n"; + else + { + print img_object($alttext, 'generic', 'class="valignmiddle"'); + } + print ' '.$objMod->getName().''; + print "\n"; - // Link config - if (!empty($objMod->config_page_url) && !$disableSetup) - { - $backtourlparam = ''; - if ($search_keyword != '') $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.$search_keyword; // No urlencode here, done later - if ($search_nature > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.$search_nature; - if ($search_version > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.$search_version; - if ($search_status > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.$search_status; - $backtourl = $_SERVER["PHP_SELF"].$backtourlparam; + // Desc + print '\n"; - if (is_array($objMod->config_page_url)) - { - print '\n"; - } - elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) - { - print ''; - } - else - { - print ''; - } - } - else - { - print ''; - } - } - else // Module not yet activated - { - // Link enable/disable - print ''; + + // Version + print '\n"; + + // Activate/Disable and Setup (2 columns) + if (!empty($conf->global->$const_name)) // If module is already activated + { + $disableSetup = 0; + + // Link enable/disabme + print '\n"; + else + { + if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { + print 'warnings_unactivation[$mysoc->country_code].'&value='.$modName.'&mode='.$mode.$param.'">'; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } + else { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } + } + print ''."\n"; - // Link config - print ''; + // Link config + if (!empty($objMod->config_page_url) && !$disableSetup) + { + $backtourlparam = ''; + if ($search_keyword != '') $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.$search_keyword; // No urlencode here, done later + if ($search_nature > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.$search_nature; + if ($search_version > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.$search_version; + if ($search_status > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.$search_status; + $backtourl = $_SERVER["PHP_SELF"].$backtourlparam; + + if (is_array($objMod->config_page_url)) + { + print '\n"; + } + elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) + { + print ''; + } + else + { + print ''; + } + } + else + { + print ''; + } + } + else // Module not yet activated + { + // Link enable/disable + print '\n"; + + // Link config + print ''; + } + + print "\n"; } - - print "\n"; } if ($oldfamily) { - print "
'.++$linenum.'
'.++$linenum.''; - $alttext = ''; - //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version); - //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin); - if (!empty($objMod->picto)) - { - if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule"', 1); - else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule"'); - } - else - { - print img_object($alttext, 'generic', 'class="valignmiddle"'); - } - print ' '.$objMod->getName().''; - print "'; - print nl2br($objMod->getDesc()); - print "'; - //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1); - print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).''; - print ''; - print $versiontrans; - if (!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; - if (!empty($objMod->url_last_version)) { - $newversion = getURLContent($objMod->url_last_version); - if (isset($newversion['content'])) { - if (version_compare($newversion['content'], $versiontrans) > 0) { - print " ".$newversion['content'].""; - } - } - } - } - print "'; - if (!empty($arrayofwarnings[$modName])) + // Picto + Name of module + print ' '; + $alttext = ''; + //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version); + //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin); + if (!empty($objMod->picto)) { - print ''."\n"; + if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule"', 1); + else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule"'); } - if (!empty($objMod->disabled)) - { - print $langs->trans("Disabled"); - } - elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) - { - if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used"); - else { - print img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium'); - //print $langs->trans("Required"); - } - if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++; - } - else - { - if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { - print 'warnings_unactivation[$mysoc->country_code].'&value='.$modName.'&mode='.$mode.$param.'">'; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } - else { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } - } - print ''; + print nl2br($objMod->getDesc()); + print "'; - $i = 0; - foreach ($objMod->config_page_url as $page) - { - $urlpage = $page; - if ($i++) - { - print ''.img_picto(ucfirst($page), "setup").''; - // print ''.ucfirst($page).' '; - } - else - { - if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) - { - $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); - print ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; - } - else - { - $urltouse = $urlpage; - print ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; - } - } - } - print "'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').''; - if (!empty($objMod->always_enabled)) - { - // Should never happened - } - elseif (!empty($objMod->disabled)) - { - print $langs->trans("Disabled"); - } - else - { - // Module qualified for activation - $warningmessage = ''; + // Help + print ''; + //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1); + print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).''; + print ''; + print $versiontrans; + if (!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + if (!empty($objMod->url_last_version)) { + $newversion = getURLContent($objMod->url_last_version); + if (isset($newversion['content'])) { + if (version_compare($newversion['content'], $versiontrans) > 0) { + print " ".$newversion['content'].""; + } + } + } + } + print "'; if (!empty($arrayofwarnings[$modName])) + { + print ''."\n"; + } + if (!empty($objMod->disabled)) { - print ''."\n"; - foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) - { - if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) - { - $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code); - } - } + print $langs->trans("Disabled"); } - if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) + elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) { - print ''."\n"; - foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) - { - $keymodulelowercase = strtolower(preg_replace('/^mod/', '', $keymodule)); - if (in_array($keymodulelowercase, $conf->modules)) // If module that request warning is on - { - foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) - { - if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) - { - $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); - $warningmessage .= ($warningmessage ? "\n" : "").($warningmessage ? "\n" : "").$langs->trans("Module").' : '.$objMod->getName(); - if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name; - if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName(); - } - } - } - } + if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used"); + else { + print img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium'); + //print $langs->trans("Required"); + } + if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++; } - print ''."\n"; - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print "\n"; - } - print "'.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').''; + $i = 0; + foreach ($objMod->config_page_url as $page) + { + $urlpage = $page; + if ($i++) + { + print ''.img_picto(ucfirst($page), "setup").''; + // print ''.ucfirst($page).' '; + } + else + { + if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) + { + $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); + print ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; + } + else + { + $urltouse = $urlpage; + print ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; + } + } + } + print "'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').''; + if (!empty($objMod->always_enabled)) + { + // Should never happened + } + elseif (!empty($objMod->disabled)) + { + print $langs->trans("Disabled"); + } + else + { + // Module qualified for activation + $warningmessage = ''; + if (!empty($arrayofwarnings[$modName])) + { + print ''."\n"; + foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) + { + if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) + { + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code); + } + } + } + if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) + { + print ''."\n"; + foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) + { + $keymodulelowercase = strtolower(preg_replace('/^mod/', '', $keymodule)); + if (in_array($keymodulelowercase, $conf->modules)) // If module that request warning is on + { + foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) + { + if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) + { + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); + $warningmessage .= ($warningmessage ? "\n" : "").($warningmessage ? "\n" : "").$langs->trans("Module").' : '.$objMod->getName(); + if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name; + if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName(); + } + } + } + } + } + print ''."\n"; + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print "\n"; + } + print "'.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').'
\n"; - print '
'; + if (! empty($conf->global->MAIN_USE_KANBAN_FOR_MODULES)) { + print ''; + } else { + print "\n"; + print ''; + } } dol_fiche_end(); diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 0c6d3e219b8..a2db56549e3 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -148,7 +148,10 @@ elseif ($action == 'setapilayer') } else { - MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID); + $result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID); + if ($result > 0) { + setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs"); + } } } 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/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/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 ''; 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 ''.$obj->name.''."\n"; - print ''.$obj->value.''."\n"; - if (empty($conf->multicompany->enabled) || !$user->entity) print ''.$obj->entity.''."\n"; // If superadmin or multicompany disabled - print "\n"; + print ''; + print ''.$obj->name.''."\n"; + print ''.$obj->value.''."\n"; + if (empty($conf->multicompany->enabled) || !$user->entity) print ''.$obj->entity.''."\n"; // If superadmin or multicompany disabled + print "\n"; - $i++; - } + $i++; + } } print ''; 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/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/listsessions.php b/htdocs/admin/tools/listsessions.php index 28d4fc3d51f..de526b725da 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -167,7 +167,7 @@ if ($savehandler == 'files') if (count($listofsessions) == 0) { - print ''.$langs->trans("NoSessionFound", $savepath, $openbasedir).''; + print ''.$langs->trans("NoSessionFound", $savepath, $openbasedir).''; } print ""; } 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/api/index.php b/htdocs/api/index.php index 7a9ef9ad24d..6ccdab6c179 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -56,6 +56,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $url = $_SERVER['PHP_SELF']; +if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method' + $url = $_SERVER['PHP_SELF'].$_SERVER['PATH_INFO']; +} // Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases) if (! empty($conf->global->MAIN_NGINX_FIX)) { 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/asset/card.php b/htdocs/asset/card.php index b4ff4ebac68..b0ab945f543 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -203,7 +203,7 @@ if (($id || $ref) && $action == 'edit') // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - $res = $object->fetch_optionals($object->id); + $res = $object->fetch_optionals(); $head = asset_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("Asset"), -1, 'generic'); 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 c4146660053..4a919d7bb2a 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -549,7 +549,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $result = $object->getLinesArray(); print ' - + diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index e33394edcf7..f8ecfa11996 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -482,7 +482,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table -print ''."\n"; +print '
'."\n"; // Fields title search @@ -502,7 +502,7 @@ foreach ($object->fields as $key => $val) elseif (strpos($val['type'], 'integer:') === 0) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); } - elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print ''; + elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; print ''; } } @@ -582,6 +582,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 9e69eda2cd3..699065520da 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -60,10 +60,9 @@ function printDropdownBookmarksList() } $searchForm = ''."\n"; - $searchForm .= ''; + $searchForm .= 'global->MAIN_OPTIMIZEFORTEXTBROWSER)?'onsubmit="return false"':'').'>'; $searchForm .= ''; - $searchForm .= ''; - $searchForm .= ''; + // Url to list bookmark $listbtn = ''; @@ -79,7 +78,6 @@ function printDropdownBookmarksList() $newbtn .= img_picto('', 'bookmark', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; } - $bookmarkList = ''; - $html = ' - - - '; + $searchForm .= ''; - $html .= ' - - - '; + // Generate the return string + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $html = $searchForm; - $html .= ' - - - '; + $html.=' + '; + } else { + $html = ' + + + '; - if ($(this).text().search(new RegExp(filter, "i")) < 0) { - $(this).addClass("hidden-search-result"); - } else { - $(this).removeClass("hidden-search-result"); - count++; - } - }); - $("#top-bookmark-search-filter-count").text(count); - }); - '; + $html .= ' + + + '; + + $html .= ' + + + '; + + $html .= ' + '; + } return $html; } 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/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..c7242077da4 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -4,6 +4,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2020 Tobias Sekan * * 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 @@ -71,7 +72,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 +81,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 +222,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 +233,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); /* @@ -291,8 +291,18 @@ if ($user->rights->categorie->supprimer) print ""; +if (! empty($user->rights->categorie->creer)) +{ + $link = DOL_URL_ROOT.'/categories/card.php'; + $link .= '?action=create'; + $link .= '&type='.$type; + $link .= '&catorigin='.$object->id; + $link .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.'&id='.$id); - + print '
'; + print dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', $link); + print "
"; +} $cats = $object->get_filles(); if ($cats < 0) 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 '
'; - 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/propal/card.php b/htdocs/comm/propal/card.php index 9430fce4634..262493c9383 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -726,7 +726,7 @@ if (empty($reshook)) $originLine = new $lineClassName($db); if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0) { - $originLine->fetch_optionals($lineId); + $originLine->fetch_optionals(); $desc = $originLine->desc; $pu_ht = $originLine->subprice; $qty = $originLine->qty; @@ -1523,7 +1523,7 @@ if ($action == 'create') $dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice); // Replicate extrafields - $objectsrc->fetch_optionals($originid); + $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; if (!empty($conf->multicurrency->enabled)) @@ -1541,7 +1541,7 @@ if ($action == 'create') $object = new Propal($db); print ''; - print ''; + print ''; print ''; if ($origin != 'project' && $originid) { print ''; @@ -1675,7 +1675,7 @@ if ($action == 'create') $langs->load("projects"); print ''; print ''.$langs->trans("Project").''; - $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); + $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); print ' id).'">'; print ''; 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/remx.php b/htdocs/comm/remx.php index 651fa556e8a..c312591aeec 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -56,7 +56,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) exit; } -if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') +if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes') { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) @@ -122,6 +122,8 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $newdiscount2->datec = $discount->datec; $newdiscount1->tva_tx = $discount->tva_tx; $newdiscount2->tva_tx = $discount->tva_tx; + $newdiscount1->vat_src_code = $discount->vat_src_code; + $newdiscount2->vat_src_code = $discount->vat_src_code; $newdiscount1->amount_ttc = $amount_ttc_1; $newdiscount2->amount_ttc = price2num($discount->amount_ttc - $newdiscount1->amount_ttc); $newdiscount1->amount_ht = price2num($newdiscount1->amount_ttc / (1 + $newdiscount1->tva_tx / 100), 'MT'); @@ -129,6 +131,13 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $newdiscount1->amount_tva = price2num($newdiscount1->amount_ttc - $newdiscount1->amount_ht); $newdiscount2->amount_tva = price2num($newdiscount2->amount_ttc - $newdiscount2->amount_ht); + $newdiscount1->multicurrency_amount_ttc = $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc); + $newdiscount2->multicurrency_amount_ttc = price2num($discount->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ttc); + $newdiscount1->multicurrency_amount_ht = price2num($newdiscount1->multicurrency_amount_ttc / (1 + $newdiscount1->tva_tx / 100), 'MT'); + $newdiscount2->multicurrency_amount_ht = price2num($newdiscount2->multicurrency_amount_ttc / (1 + $newdiscount2->tva_tx / 100), 'MT'); + $newdiscount1->multicurrency_amount_tva = price2num($newdiscount1->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ht); + $newdiscount2->multicurrency_amount_tva = price2num($newdiscount2->multicurrency_amount_ttc - $newdiscount2->multicurrency_amount_ht); + $db->begin(); $discount->fk_facture_source = 0; // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_facture_source // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_invoice_supplier_source @@ -154,12 +163,12 @@ if ($action == 'setremise' && $user->rights->societe->creer) //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) - $amount_ht = GETPOST('amount_ht'); + $amount_ht = price2num(GETPOST('amount_ht', 'alpha')); $desc = GETPOST('desc', 'alpha'); $tva_tx = GETPOST('tva_tx', 'alpha'); $discount_type = !empty($_POST['discount_type']) ?GETPOST('discount_type', 'alpha') : 0; - if (price2num($amount_ht) > 0) + if ($amount_ht > 0) { $error = 0; if (empty($desc)) @@ -196,7 +205,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) } else { - setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("NewGlobalDiscount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("AmountHT")), null, 'errors'); } } @@ -375,10 +384,10 @@ if ($socid > 0) print ' '.$langs->trans("Currency".$conf->currency).''; print ''.$langs->trans("VAT").''; print ''; - print $form->load_tva('tva_tx', GETPOST('tva_tx'), $mysoc, $object); + print $form->load_tva('tva_tx', GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0, $mysoc, $object, 0, 0, '', 0, 1); print ''; print ''.$langs->trans("NoteReason").''; - print ''; + print ''; print ""; @@ -409,7 +418,7 @@ if ($socid > 0) /* - * List remises fixes client restant en cours (= liees a aucune facture ni ligne de facture) + * List not consumed available credits (= linked to no invoice and no invoice line) */ print load_fiche_titre($langs->trans("DiscountStillRemaining")); @@ -421,7 +430,8 @@ if ($socid > 0) print load_fiche_titre($langs->trans("CustomerDiscounts"), '', ''); } - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; + $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql .= " rc.datec as dc, rc.description,"; $sql .= " rc.fk_facture_source,"; $sql .= " u.login, u.rowid as user_id,"; @@ -510,7 +520,7 @@ if ($socid > 0) { print ''.price($obj->multicurrency_amount_ht).''; } - print ''.vatrate($obj->tva_tx, true).''; + print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; if (!empty($conf->multicurrency->enabled)) { @@ -577,7 +587,8 @@ if ($socid > 0) /* * Liste remises fixes fournisseur restant en cours (= liees a aucune facture ni ligne de facture) */ - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; + $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql .= " rc.datec as dc, rc.description,"; $sql .= " rc.fk_invoice_supplier_source,"; $sql .= " u.login, u.rowid as user_id,"; @@ -666,7 +677,7 @@ if ($socid > 0) { print ''.price($obj->multicurrency_amount_ht).''; } - print ''.vatrate($obj->tva_tx, true).''; + print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; if (!empty($conf->multicurrency->enabled)) { @@ -744,7 +755,8 @@ if ($socid > 0) } // Discount linked to invoice lines - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; + $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,"; $sql .= " u.login, u.rowid as user_id,"; $sql .= " f.rowid as invoiceid, f.ref,"; @@ -762,7 +774,7 @@ if ($socid > 0) $sql .= " ORDER BY dc DESC"; //$sql.= " UNION "; // Discount linked to invoices - $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; $sql2 .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; $sql2 .= " rc.fk_facture_source,"; $sql2 .= " u.login, u.rowid as user_id,"; @@ -881,7 +893,7 @@ if ($socid > 0) { print ''.price($obj->multicurrency_amount_ht).''; } - print ''.vatrate($obj->tva_tx, true).''; + print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; if (!empty($conf->multicurrency->enabled)) { @@ -920,7 +932,8 @@ if ($socid > 0) } // Discount linked to invoice lines - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; + $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; $sql .= " rc.fk_invoice_supplier_source,"; $sql .= " u.login, u.rowid as user_id,"; @@ -939,7 +952,7 @@ if ($socid > 0) $sql .= " ORDER BY dc DESC"; //$sql.= " UNION "; // Discount linked to invoices - $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; $sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; $sql2 .= " rc.fk_invoice_supplier_source,"; $sql2 .= " u.login, u.rowid as user_id,"; @@ -1057,7 +1070,7 @@ if ($socid > 0) { print ''.price($obj->multicurrency_amount_ht).''; } - print ''.vatrate($obj->tva_tx, true).''; + print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; if (!empty($conf->multicurrency->enabled)) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 148fa427fff..372e64e4e43 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -385,7 +385,7 @@ if (empty($reshook)) // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used { - $lines[$i]->fetch_optionals($lines[$i]->rowid); + $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } @@ -1362,7 +1362,7 @@ if (empty($reshook)) $originLine = new $lineClassName($db); if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0) { - $originLine->fetch_optionals($lineId); + $originLine->fetch_optionals(); $desc = $originLine->desc; $pu_ht = $originLine->subprice; $qty = $originLine->qty; @@ -1549,7 +1549,7 @@ if ($action == 'create' && $usercancreate) $objectsrc->fetch_thirdparty(); // Replicate extrafields - $objectsrc->fetch_optionals($originid); + $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); @@ -1602,7 +1602,7 @@ if ($action == 'create' && $usercancreate) } print ''; - print ''; + print ''; print ''; print ''."\n"; print ''; @@ -1741,7 +1741,7 @@ if ($action == 'create' && $usercancreate) $langs->load("projects"); print ''; print ''.$langs->trans("Project").''; - $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0); + $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); print ' id).'">'; print ''; print ''; @@ -2107,7 +2107,7 @@ if ($action == 'create' && $usercancreate) $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); $morehtmlref .= ''; $morehtmlref .= '
'; } else { @@ -2184,7 +2184,7 @@ if ($action == 'create' && $usercancreate) print ''; if ($action == 'editdate') { print '
'; - print ''; + print ''; print ''; print $form->selectDate($object->date, 'order_', '', '', '', "setdate"); print ''; @@ -2205,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 ''; @@ -2499,7 +2499,7 @@ if ($action == 'create' && $usercancreate) $result = $object->getLinesArray(); print ' - + '; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 57eb78df405..b2d1c09bd25 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1381,7 +1381,7 @@ class Commande extends CommonOrder $this->origin_id = $object->id; // get extrafields from original line - $object->fetch_optionals($object->id); + $object->fetch_optionals(); $e = new ExtraFields($this->db); $element_extrafields = $e->fetch_name_optionals_label($this->table_element); @@ -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 ''; 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 ''; 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 ''; 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/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index a473ccbb993..764b31ad0f6 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -287,7 +287,7 @@ if (($action == 'create' || $action == 'add') && !$error) // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { - $lines[$i]->fetch_optionals($lines[$i]->rowid); + $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } 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/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 868ccc006d8..55b16368469 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani @@ -302,10 +302,12 @@ if (empty($reshook)) $array_of_total_ht_per_vat_rate = array(); $array_of_total_ht_devise_per_vat_rate = array(); foreach ($object->lines as $line) { - if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; - if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; - $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->total_ht; - $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_total_ht; + //$vat_src_code_for_line = $line->vat_src_code; // TODO We chek sign of total per vat without taking into account the vat code because for the moment the vat code is lost/unknown when we add a down payment. + $vat_src_code_for_line = ''; + if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] = 0; + if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] = 0; + $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] += $line->total_ht; + $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] += $line->multicurrency_total_ht; } //var_dump($array_of_total_ht_per_vat_rate);exit; @@ -485,10 +487,10 @@ if (empty($reshook)) // POST[remise_id] or POST[remise_id_for_payment] // We use the credit to reduce amount of invoice - if (!empty($_POST["remise_id"])) { + if (GETPOST("remise_id", 'int') > 0) { $ret = $object->fetch($id); if ($ret > 0) { - $result = $object->insert_discount($_POST["remise_id"]); + $result = $object->insert_discount(GETPOST("remise_id", 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -497,11 +499,11 @@ if (empty($reshook)) } } // We use the credit to reduce remain to pay - if (!empty($_POST["remise_id_for_payment"])) + if (GETPOST("remise_id_for_payment", 'int') > 0) { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; $discount = new DiscountAbsolute($db); - $discount->fetch($_POST["remise_id_for_payment"]); + $discount->fetch(GETPOST("remise_id_for_payment", 'int')); //var_dump($object->getRemainToPay(0)); //var_dump($discount->amount_ttc);exit; @@ -809,14 +811,16 @@ if (empty($reshook)) $i = 0; foreach ($object->lines as $line) { - if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 - { // no need to create discount if amount is null - $amount_ht[$line->tva_tx] += $line->total_ht; - $amount_tva[$line->tva_tx] += $line->total_tva; - $amount_ttc[$line->tva_tx] += $line->total_ttc; - $multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht; - $multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva; - $multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc; + if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 and no need to create discount if amount is null + { + $keyforvatrate = $line->tva_tx.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''); + + $amount_ht[$keyforvatrate] += $line->total_ht; + $amount_tva[$keyforvatrate] += $line->total_tva; + $amount_ttc[$keyforvatrate] += $line->total_ttc; + $multicurrency_amount_ht[$keyforvatrate] += $line->multicurrency_total_ht; + $multicurrency_amount_tva[$keyforvatrate] += $line->multicurrency_total_tva; + $multicurrency_amount_ttc[$keyforvatrate] += $line->multicurrency_total_ttc; $i++; } } @@ -830,9 +834,9 @@ if (empty($reshook)) $amount_ht[$vatrate] = price2num($amount_ht[$vatrate] * $ratio, 'MU'); $amount_tva[$vatrate] = price2num($amount_tva[$vatrate] * $ratio, 'MU'); $amount_ttc[$vatrate] = price2num($amount_ttc[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_ht[$line->tva_tx] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_tva[$line->tva_tx] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_ttc[$line->tva_tx] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_ht[$vatrate] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_tva[$vatrate] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_ttc[$vatrate] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU'); } } } @@ -887,6 +891,7 @@ if (empty($reshook)) $discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $object->total_ttc; $discount->amount_tva = 0; $discount->tva_tx = 0; + $discount->vat_src_code = ''; $result = $discount->create($user); if ($result < 0) @@ -904,7 +909,18 @@ if (empty($reshook)) $discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]); $discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]); $discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]); + + // Clean vat code + $reg = array(); + $vat_src_code = ''; + if (preg_match('/\((.*)\)/', $tva_tx, $reg)) + { + $vat_src_code = $reg[1]; + $tva_tx = preg_replace('/\s*\(.*\)/', '', $tva_tx); // Remove code into vatrate. + } + $discount->tva_tx = abs($tva_tx); + $discount->vat_src_code =$vat_src_code; $result = $discount->create($user); if ($result < 0) @@ -1592,7 +1608,7 @@ if (empty($reshook)) // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { - $lines[$i]->fetch_optionals($lines[$i]->rowid); + $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } @@ -1733,7 +1749,7 @@ if (empty($reshook)) $line->origin = $object->origin; $line->origin_id = $line->id; $line->fk_prev_id = $line->id; - $line->fetch_optionals($line->id); + $line->fetch_optionals(); $line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note // Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée @@ -2539,7 +2555,7 @@ if (empty($reshook)) $originLine = new $lineClassName($db); if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0) { - $originLine->fetch_optionals($lineId); + $originLine->fetch_optionals(); $desc = $originLine->desc; $pu_ht = $originLine->subprice; $qty = $originLine->qty; @@ -2794,7 +2810,7 @@ if ($action == 'create') $remise_absolue = (!empty($expesrc->remise_absolue) ? $expesrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); //Replicate extrafields - $expesrc->fetch_optionals($expeoriginid); + $expesrc->fetch_optionals(); $object->array_options = $expesrc->array_options; } else @@ -2812,7 +2828,7 @@ if ($action == 'create') } // Replicate extrafields - $objectsrc->fetch_optionals($originid); + $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; } } @@ -2854,7 +2870,7 @@ if ($action == 'create') } print ''; - print ''; + print ''; print ''; if ($soc->id > 0) print ''."\n"; print ''; @@ -3397,7 +3413,7 @@ if ($action == 'create') { $langs->load('projects'); print ''.$langs->trans('Project').''; - $numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1); + $numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; print ''; } @@ -4459,7 +4475,7 @@ elseif ($id > 0 || !empty($ref)) print ''; if ($action == 'editrevenuestamp') { print ''; - print ''; + print ''; print ''; print ''; print $formother->select_revenue_stamp('', 'revenuestamp_type', $mysoc->country_code); @@ -4963,7 +4979,7 @@ elseif ($id > 0 || !empty($ref)) } print ' - + diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index fdffc320880..524d553effd 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -677,7 +677,7 @@ class FactureRec extends CommonInvoice $line->price = $objp->price; $line->remise = $objp->remise; - $line->fetch_optionals($line->id); + $line->fetch_optionals(); // Multicurrency $line->fk_multicurrency = $objp->fk_multicurrency; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4658af376f1..606d84b256b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1317,7 +1317,7 @@ class Facture extends CommonInvoice $this->origin_id = $object->id; // get extrafields from original line - $object->fetch_optionals($object->id); + $object->fetch_optionals(); foreach ($object->array_options as $options_key => $value) $this->array_options[$options_key] = $value; @@ -1652,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,'; @@ -3076,6 +3076,7 @@ class Facture extends CommonInvoice $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); // Clean vat code + $reg = array(); $vat_src_code = ''; if (preg_match('/\((.*)\)/', $txtva, $reg)) { 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/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/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/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/card.php b/htdocs/contrat/card.php index 4e0e5cb5865..9bcae25badd 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -317,7 +317,7 @@ if (empty($reshook)) $array_options = array(); // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { - $lines[$i]->fetch_optionals($lines[$i]->rowid); + $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } @@ -1128,12 +1128,12 @@ if ($action == 'create') $classname = ucfirst($subelement); $objectsrc = new $classname($db); - $objectsrc->fetch(GETPOST('originid')); + $objectsrc->fetch($originid); if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) $objectsrc->fetch_lines(); $objectsrc->fetch_thirdparty(); // Replicate extrafields - $objectsrc->fetch_optionals($originid); + $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); @@ -1703,7 +1703,8 @@ else // Display lines extrafields if (is_array($extralabelslines) && count($extralabelslines) > 0) { $line = new ContratLigne($db); - $line->fetch_optionals($objp->rowid); + $line->id = $objp->rowid; + $line->fetch_optionals(); print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1); } } @@ -1793,7 +1794,8 @@ else if (is_array($extralabelslines) && count($extralabelslines) > 0) { $line = new ContratLigne($db); - $line->fetch_optionals($objp->rowid); + $line->id = $objp->rowid; + $line->fetch_optionals(); print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1); } } 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 ''; 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 17e063244df..419296b7341 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -744,7 +744,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { - $lines[$i]->fetch_optionals($lines[$i]->rowid); + $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } 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/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index c231a36402d..1c09d2ed48e 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -95,7 +95,7 @@ abstract class CommonInvoice extends CommonObject * This does not include open direct debit requests. * * @param int $multicurrency Return multicurrency_amount instead of amount - * @return double Remain of amount to pay + * @return double Remain of amount to pay */ public function getRemainToPay($multicurrency = 0) { @@ -104,7 +104,7 @@ abstract class CommonInvoice extends CommonObject $alreadypaid+=$this->getSumDepositsUsed($multicurrency); $alreadypaid+=$this->getSumCreditNotesUsed($multicurrency); - $remaintopay = ($this->total_ttc - $alreadypaid); + $remaintopay = price2num($this->total_ttc - $alreadypaid, 'MT'); if ($this->statut == self::STATUS_CLOSED && $this->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment $remaintopay = 0; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e1246d8bc3f..12eb1c62e8c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -87,6 +87,11 @@ abstract class CommonObject */ public $array_options = array(); + /** + * @var mixed Array to store alternative languages values of object + */ + public $array_languages = null; // Value is array() when load already tried + /** * @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked */ @@ -5041,6 +5046,72 @@ abstract class CommonObject } + /* Functions for data in other language */ + + + /** + * Function to get alternative languages of a data into $this->array_languages + * This method is NOT called by method fetch of objects but must be called separately. + * + * @return int <0 if error, 0 if no values of alternative languages to find nor found, 1 if a value was found and loaded + */ + public function fetchValueForAlternateLanguages() + { + // To avoid SQL errors. Probably not the better solution though + if (!$this->element) { + return 0; + } + if (! ($this->id > 0)) { + return 0; + } + + $this->array_languages = array(); + + $element = $this->element; + if ($element == 'categorie') $element = 'categories'; // For compatibility + + // Request to get translation values for object + $sql = "SELECT rowid, property, lang , value"; + $sql .= " FROM ".MAIN_DB_PREFIX."object_lang"; + $sql .= " WHERE type_object = '".$element."'"; + $sql .= " AND fk_object = ".$this->id; + + //dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); // Too verbose + $resql = $this->db->query($sql); + if ($resql) + { + $numrows = $this->db->num_rows($resql); + if ($numrows) + { + $tab = $this->db->fetch_array($resql); + + foreach ($tab as $key => $value) + { + // we can add this attribute to object + if (preg_match('/date/', $key)) + { + $this->array_languages[$key] = $this->db->jdate($value); + } + else + { + $this->array_languages[$key] = $value; + } + } + } + + $this->db->free($resql); + + if ($numrows) return $numrows; + else return 0; + } + else + { + dol_print_error($this->db); + return -1; + } + } + + /* Functions for extrafields */ @@ -5059,6 +5130,7 @@ abstract class CommonObject global $extrafields; if (empty($rowid)) $rowid = $this->id; + if (empty($rowid)) $rowid = $this->rowid; // To avoid SQL errors. Probably not the better solution though if (!$this->table_element) { @@ -5110,7 +5182,6 @@ abstract class CommonObject $resql = $this->db->query($sql); if ($resql) { - $this->array_options = array(); $numrows = $this->db->num_rows($resql); if ($numrows) { @@ -6679,9 +6750,10 @@ abstract class CommonObject if (($mode == 'create' || $mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list elseif ($mode == 'view' && empty($visibility)) continue; if (empty($perms)) continue; - // Load language if required - if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); + if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) { + $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); + } $colspan = ''; if (is_array($params) && count($params) > 0) { @@ -6780,8 +6852,8 @@ abstract class CommonObject { $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix, 'alpha', 3)) : $this->array_options['options_'.$key]; } - $labeltoshow = $langs->trans($label); + $helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]); $out .= ''; 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/discount.class.php b/htdocs/core/class/discount.class.php index c3707b18972..bf85699a9fe 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -62,6 +62,7 @@ class DiscountAbsolute public $multicurrency_amount_ttc; // Vat rate public $tva_tx; + public $vat_src_code; /** * @var int User ID Id utilisateur qui accorde la remise @@ -133,7 +134,7 @@ class DiscountAbsolute $sql = "SELECT sr.rowid, sr.fk_soc, sr.discount_type,"; $sql.= " sr.fk_user,"; - $sql.= " sr.amount_ht, sr.amount_tva, sr.amount_ttc, sr.tva_tx,"; + $sql.= " sr.amount_ht, sr.amount_tva, sr.amount_ttc, sr.tva_tx, sr.vat_src_code,"; $sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,"; $sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.fk_invoice_supplier_line, sr.fk_invoice_supplier, sr.fk_invoice_supplier_source, sr.description,"; $sql.= " sr.datec,"; @@ -168,6 +169,8 @@ class DiscountAbsolute $this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc; $this->tva_tx = $obj->tva_tx; + $this->vat_src_code = $obj->vat_src_code; + $this->fk_user = $obj->fk_user; $this->fk_facture_line = $obj->fk_facture_line; $this->fk_facture = $obj->fk_facture; @@ -244,12 +247,12 @@ class DiscountAbsolute // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except"; $sql .= " (entity, datec, fk_soc, discount_type, fk_user, description,"; - $sql .= " amount_ht, amount_tva, amount_ttc, tva_tx,"; + $sql .= " amount_ht, amount_tva, amount_ttc, tva_tx, vat_src_code,"; $sql .= " multicurrency_amount_ht, multicurrency_amount_tva, multicurrency_amount_ttc,"; $sql .= " fk_facture_source, fk_invoice_supplier_source"; $sql .= ")"; $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec != '' ? $this->datec : dol_now())."', ".$this->fk_soc.", ".(empty($this->discount_type) ? 0 : intval($this->discount_type)).", ".$userid.", '".$this->db->escape($this->description)."',"; - $sql .= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.","; + $sql .= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.", '".$this->db->escape($this->vat_src_code)."',"; $sql .= " ".$this->multicurrency_amount_ht.", ".$this->multicurrency_amount_tva.", ".$this->multicurrency_amount_ttc.", "; $sql .= " ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'" : "null").","; $sql .= " ".($this->fk_invoice_supplier_source ? "'".$this->db->escape($this->fk_invoice_supplier_source)."'" : "null"); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 94504686718..47634408a97 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -392,6 +392,7 @@ class ExtraFields if (empty($list)) $list = '0'; if (empty($required)) $required = 0; if (empty($unique)) $unique = 0; + if (empty($printable)) $printable = 0; if (empty($alwayseditable)) $alwayseditable = 0; if (empty($totalizable)) $totalizable = 0; @@ -1590,9 +1591,9 @@ class ExtraFields if ($type == 'date') $out.=' (YYYY-MM-DD)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; */ - if (! empty($help) && $keyprefix != 'search_options_') { + /*if (! empty($help) && $keyprefix != 'search_options_') { $out .= $form->textwithpicto('', $help, 1, 'help', '', 0, 3); - } + }*/ return $out; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2c22e83f786..37897738c38 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -316,6 +316,56 @@ 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]'...) + * @param string $check Same coe than $check parameter of GETPOST() + * @param string $morecss More CSS + * @return string HTML code for the edit of alternative language + */ + public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string', $check = '', $morecss = '') + { + global $conf, $langs; + + $result = ''; + + if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) { + $langcode = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE; + + $result .='
'; + $s=img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang'); + $result .= $s; + $result .= '
'; + + $result .=''; + $result .= ''; + } + + return $result; + } + /** * Output edit in place form * @@ -642,12 +692,14 @@ class Form /* console.log( index + ": " + $( this ).text() ); */ if ($(this).is(\':checked\')) atleastoneselected++; }); + console.log("initCheckForSelect mode="+mode+" atleastoneselected="+atleastoneselected); + if (atleastoneselected || '.$alwaysvisible.') { jQuery(".massaction").show(); - '.($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'"); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').' - '.($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0"); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').' + '.($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'").trigger(\'change\'); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').' + '.($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0").trigger(\'change\'); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').' } else { @@ -2114,7 +2166,7 @@ class Form } } - $selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; + $selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; if (count($warehouseStatusArray)) { $selectFieldsGrouped = ", sum(".$db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock @@ -2418,6 +2470,7 @@ class Form $outlabel = ''; $outdesc = ''; $outbarcode = ''; + $outorigin = ''; $outtype = ''; $outprice_ht = ''; $outprice_ttc = ''; @@ -2437,6 +2490,7 @@ class Form $outlabel = $objp->label; $outdesc = $objp->description; $outbarcode = $objp->barcode; + $outorigin = $objp->fk_country; $outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid; $outtype = $objp->fk_product_type; @@ -2498,12 +2552,15 @@ class Form $opt .= $objp->ref; if ($outbarcode) $opt .= ' ('.$outbarcode.')'; $opt .= ' - '.dol_trunc($label, $maxlengtharticle); + if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) $opt .= ' ('.getCountry($outorigin, 1).')'; $objRef = $objp->ref; if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey).')/i', '$1', $objRef, 1); $outval .= $objRef; if ($outbarcode) $outval .= ' ('.$outbarcode.')'; $outval .= ' - '.dol_trunc($label, $maxlengtharticle); + if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) $outval .= ' ('.getCountry($outorigin, 1).')'; + // Units $opt .= $outvalUnits; $outval .= $outvalUnits; @@ -3514,11 +3571,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 @@ -3559,9 +3616,12 @@ class Form elseif ($format == 1) print '
'.$langs->trans("Statistics").' - '.$langs->trans("Services").'
attributes[$this->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$this->table_element]['help'][$key]); + if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $helptoshow); else $out .= $labeltoshow; if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) $out .= ' *'; } else { if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) $out .= ' fieldrequired'; - $out .= '"'; - $out .= '>'; - if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$this->table_element]['help'][$key]); + $out .= '">'; + if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $helptoshow); else $out .= $labeltoshow; } $out .= '
'."\n"; +print '
'."\n"; // Fields title search @@ -509,6 +509,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { 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/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 ' - + diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index e14053075cb..6a4abe24019 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -398,7 +398,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table -print '
'."\n"; +print '
'."\n"; // Fields title search @@ -418,7 +418,7 @@ foreach ($object->fields as $key => $val) elseif (strpos($val['type'], 'integer:') === 0) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); } - elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print ''; + elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; print ''; } } @@ -498,6 +498,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right'; + if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index d3b589fe88a..2085678f583 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2020 Laurent Destailleur * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php'; + /** * Class Currency * @@ -92,6 +93,7 @@ class MultiCurrency extends CommonObject */ public $rate; + /** * Constructor * @@ -99,7 +101,7 @@ class MultiCurrency extends CommonObject */ public function __construct(DoliDB $db) { - $this->db = &$db; + $this->db = $db; return 1; } @@ -107,16 +109,15 @@ class MultiCurrency extends CommonObject /** * Create object into database * - * @param User $user User that creates - * @param bool $trigger true=launch triggers after, false=disable triggers - * - * @return int <0 if KO, Id of created object if OK + * @param User $user User that creates + * @param bool $trigger true=launch triggers after, false=disable triggers + * @return int <0 if KO, Id of created object if OK */ public function create(User $user, $trigger = true) { global $conf,$langs; - dol_syslog('Currency::create', LOG_DEBUG); + dol_syslog('MultiCurrency::create', LOG_DEBUG); $error = 0; @@ -152,7 +153,7 @@ class MultiCurrency extends CommonObject if (!$resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::create ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::create ' . join(',', $this->errors), LOG_ERR); } if (!$error) { @@ -180,14 +181,13 @@ class MultiCurrency extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $code code - * - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $code code + * @return int <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $code = null) { - dol_syslog('Currency::fetch', LOG_DEBUG); + dol_syslog('MultiCurrency::fetch', LOG_DEBUG); global $conf; @@ -224,7 +224,7 @@ class MultiCurrency extends CommonObject } } else { $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::fetch ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::fetch ' . join(',', $this->errors), LOG_ERR); return -1; } @@ -260,7 +260,7 @@ class MultiCurrency extends CommonObject return $num; } else { $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::fetchAllCurrencyRate ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::fetchAllCurrencyRate ' . join(',', $this->errors), LOG_ERR); return - 1; } @@ -269,16 +269,15 @@ class MultiCurrency extends CommonObject /** * Update object into database * - * @param User $user User that modifies - * @param bool $trigger true=launch triggers after, false=disable triggers - * - * @return int <0 if KO, >0 if OK + * @param User $user User that modifies + * @param bool $trigger true=launch triggers after, false=disable triggers + * @return int <0 if KO, >0 if OK */ public function update(User $user, $trigger = true) { $error = 0; - dol_syslog('Currency::update', LOG_DEBUG); + dol_syslog('MultiCurrency::update', LOG_DEBUG); // Clean parameters $this->name = trim($this->name); @@ -287,7 +286,7 @@ class MultiCurrency extends CommonObject // Check parameters if (empty($this->code)) { $error++; - dol_syslog('Currency::update $this->code can not be empty', LOG_ERR); + dol_syslog('MultiCurrency::update $this->code can not be empty', LOG_ERR); return -1; } @@ -298,14 +297,13 @@ class MultiCurrency extends CommonObject $sql .= ' code=\''.$this->db->escape($this->code).'\''; $sql .= ' WHERE rowid=' . $this->id; - dol_syslog(__METHOD__, LOG_DEBUG); $this->db->begin(); $resql = $this->db->query($sql); if (!$resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::update ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::update ' . join(',', $this->errors), LOG_ERR); } if (!$error && $trigger) { @@ -329,14 +327,13 @@ class MultiCurrency extends CommonObject * Delete object in database * * @param bool $trigger true=launch triggers after, false=disable triggers - * * @return int <0 if KO, >0 if OK */ public function delete($trigger = true) { global $user; - dol_syslog('Currency::delete', LOG_DEBUG); + dol_syslog('MultiCurrency::delete', LOG_DEBUG); $error = 0; @@ -363,7 +360,7 @@ class MultiCurrency extends CommonObject if (!$resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::delete ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::delete ' . join(',', $this->errors), LOG_ERR); } } @@ -398,16 +395,15 @@ class MultiCurrency extends CommonObject } /** - * Delete rate in database + * Add a Rate into database * * @param double $rate rate value - * - * @return int -1 if KO, 1 if OK + * @return int -1 if KO, 1 if OK */ public function addRate($rate) { $currencyRate = new CurrencyRate($this->db); - $currencyRate->rate = $rate; + $currencyRate->rate = price2num($rate); if ($currencyRate->create($this->id) > 0) { @@ -427,7 +423,6 @@ class MultiCurrency extends CommonObject * * @param string $code currency code * @param double $rate new rate - * * @return int -1 if KO, 1 if OK, 2 if label found and OK */ public function addRateFromDolibarr($code, $rate) @@ -459,10 +454,9 @@ class MultiCurrency extends CommonObject } /** - * Add new entry into llx_multicurrency_rate to historise + * Add new entry into llx_multicurrency_rate * * @param double $rate rate value - * * @return int <0 if KO, >0 if OK */ public function updateRate($rate) @@ -628,11 +622,11 @@ class MultiCurrency extends CommonObject } /** - * Sync rates from api + * Sync rates from API * * @param string $key Key to use. Come from $conf->global->MULTICURRENCY_APP_ID. * @param int $addifnotfound Add if not found - * @return void + * @return int <0 if KO, >0 if OK */ public static function syncRates($key, $addifnotfound = 0) { @@ -672,11 +666,15 @@ class MultiCurrency extends CommonObject } } } - } + + return 1; + } else { dol_syslog("Failed to call endpoint ".$response->error->info, LOG_WARNING); setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors'); + + return -1; } } diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index eb1a20800ce..369840efc71 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'); @@ -89,15 +89,11 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print ''."\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 ''."\n"; // Define urllogo $urllogo = ''; 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").'

'; $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/card.php b/htdocs/product/card.php index d9e0295c7a2..b2cab72a0a1 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1487,7 +1487,7 @@ else // Default warehouse print '
'; /* print "".''; - print "\n"; - print ''; + print ''."\n"; + print ''; print "\n"; $i++; } $db->free($result); } + if ($num > $max) { + print ''; + } + print "
'.$langs->trans("DefaultWarehouse").''; print $formproduct->selectWarehouses($object->fk_default_warehouse, 'fk_default_warehouse', 'warehouseopen', 1); - print ' '.$langs->trans("AddWarehouse").''; + print ' '; print '
'.$langs->trans("StockLimit").''; 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.= '

'.$langs->trans("PriceExpressionEditorHelp3"); $help_text.= '

'.$langs->trans("PriceExpressionEditorHelp4"); $help_text.= '

'.$langs->trans("PriceExpressionEditorHelp5"); foreach ($price_globals->listGlobalVariables() as $entry) { - $help_text.= '
#globals_'.$entry->code.'# '.$entry->description.' = '.$entry->value; + $help_text.= '
#globals_'.$entry->code.'# '.$entry->description.' = '.$entry->value; } //Price expression editor diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 7ff90dc296a..22b4ac6e651 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -10,6 +10,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 Frédéric France * Copyright (C) 2019 Tim Otte + * Copyright (C) 2020 Pierre Ardoin * * 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 @@ -1070,6 +1071,7 @@ SCRIPT; // Modify-Remove print '
'; + if ($usercancreate) { print ''.img_edit().""; 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ódulo_Productos'; + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; } elseif ($type == '1') { - $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } else { - $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Mó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 ''; - print ''; + print ''; print ''; print ''; @@ -1185,7 +1185,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) { print ''."\n"; print ''; - print ''; + print ''; print ''; print ''; @@ -1660,7 +1660,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print load_fiche_titre($langs->trans('PriceByCustomer')); print ''; - print ''; + print ''; print ''; print ''; @@ -1747,7 +1747,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) } print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 35e16e5c840..fd85bcfd5b0 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -45,6 +45,7 @@ $result=restrictedArea($user, 'stock'); */ $producttmp=new Product($db); +$warehouse=new Entrepot($db); $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("", $langs->trans("Stocks"), $help_url); @@ -65,18 +66,19 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; print ""; print ''; - print "'; print "
'.$langs->trans("Search").'
"; + print '
'; print $langs->trans("Warehouse").':

"; } +$max = 15; -$sql = "SELECT e.ref as label, e.rowid, e.statut"; +$sql = "SELECT e.rowid, e.ref as label, e.lieu, e.statut as status"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " WHERE e.statut in (0,1)"; $sql.= " AND e.entity IN (".getEntity('stock').")"; $sql.= $db->order('e.statut', 'DESC'); -$sql.= $db->plimit(15, 0); +$sql.= $db->plimit($max + 1, 0); $result = $db->query($sql); @@ -92,20 +94,31 @@ if ($result) if ($num) { - $entrepot=new Entrepot($db); - - while ($i < $num) + while ($i < min($max, $num)) { $objp = $db->fetch_object($result); + $warehouse->id = $objp->rowid; + $warehouse->statut = $objp->status; + $warehouse->label = $objp->label; + $warehouse->lieu = $objp->lieu; + print '
rowid\">".img_object($langs->trans("ShowStock"), "stock")." ".$objp->label."'.$entrepot->LibStatut($objp->statut, 5).''; + print $warehouse->getNomUrl(1); + print ''; + print $warehouse->getLibStatut(5); + print '
'.$langs->trans("More").'...
"; print '
'; } @@ -119,10 +132,10 @@ else print '
'; -// 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,"; +$sql.= " e.ref as warehouse_ref, e.rowid as warehouse_id, e.ref as warehouse_label, e.lieu, e.statut as warehouse_status,"; $sql.= " m.value as qty, m.datem, m.batch, m.eatby, m.sellby"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= ", ".MAIN_DB_PREFIX."stock_mouvement as m"; @@ -166,8 +179,14 @@ if ($resql) $producttmp->status_sell = $objp->tosell; $producttmp->status_buy = $objp->tobuy; + $warehouse->id = $objp->warehouse_id; + $warehouse->ref = $objp->warehouse_ref; + $warehouse->statut = $objp->warehouse_status; + $warehouse->label = $objp->warehouse_label; + $warehouse->lieu = $objp->lieu; + print ''; - print ''.dol_print_date($db->jdate($objp->datem), 'dayhour').''; + print ''.dol_print_date($db->jdate($objp->datem), 'dayhour').''; print ''; print $producttmp->getNomUrl(1); print "\n"; @@ -177,9 +196,9 @@ if ($resql) print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; } - print ''; - print img_object($langs->trans("ShowWarehouse"), "stock").' '.$objp->stock; - print "\n"; + print ''; + print $warehouse->getNomUrl(1); + print "\n"; print ''; if ($objp->qty > 0) print '+'; print $objp->qty.''; @@ -190,6 +209,8 @@ if ($resql) print ""; print '
'; +} else { + dol_print_error($db); } //print ''; 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 0b145c7ca10..39f42575e25 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -369,7 +369,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table -print ''."\n"; +print '
'."\n"; // Fields title search // -------------------------------------------------------------------- diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 7f61b9d49ab..63115350bbc 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -85,16 +85,14 @@ $morehtml .= ''; if ($usertoprocess->id == $user->id) print ''; else print '';*/ -print ''; -print ''; +print ''; +print ''; print ''; print ''; print ''; print ''; -$countWeek = count($TWeek); -for ($idw=0;$idw<$countWeek;$idw++) +foreach ($TWeek as $week_number) { print ''; } @@ -501,8 +500,8 @@ print ''; if ($usertoprocess->id == $user->id) print ''; else print '';*/ -print ''; -print ''; +print ''; +print ''; 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 "
'.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
('.dol_trunc($usertoprocess->firstname, 10).')' : '').'
'.$langs->trans("TimeSpent").'
'.$langs->trans("Everybody").'
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.dol_trunc($usertoprocess->firstname, 10).'' : '').'
'.$langs->trans("HourStart").''; // 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..da0459f9521 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"; @@ -410,11 +410,11 @@ dol_fiche_end(); print '
'.$nav.'
'; // We move this before the assign to components so, the default submit button is not the assign to. -print '
'; +print '
'; $titleassigntask = $langs->transnoentities("AssignTaskToMe"); if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs)); print '
'; -$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1); +$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1); print '
'; print ' '; print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); @@ -480,8 +480,7 @@ print '
'.$langs->trans("ProgressDeclared"). /*print ''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
('.dol_trunc($usertoprocess->firstname, 10).')' : '').'
'.$langs->trans("TimeSpent").'
'.$langs->trans("Everybody").'
'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.dol_trunc($usertoprocess->firstname, 10).'' : '').'
"; print '
'; print ''."\n"; +print ''."\n"; print '
'; print ''; @@ -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 ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 563b7ca19c9..3bb024b29f3 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) @@ -502,11 +503,11 @@ dol_fiche_end(); print '
'.$nav.'
'; // We move this before the assign to components so, the default submit button is not the assign to. -print '
'; +print '
'; $titleassigntask = $langs->transnoentities("AssignTaskToMe"); if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs)); print '
'; -$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, 1, 1, 0, 0, '', '', 'all', $usertoprocess); +$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1, 0, 0, '', '', 'all', $usertoprocess); print '
'; print ' '; print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); @@ -659,8 +660,8 @@ if (!empty($arrayfields['t.progress']['checked'])) /*print ''.$langs->trans("TimeSpent").''; if ($usertoprocess->id == $user->id) print ''.$langs->trans("TimeSpentByYou").''; else print ''.$langs->trans("TimeSpentByUser").'';*/ -print ''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')'; -print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
('.dol_trunc($usertoprocess->firstname, 10).')' : '').''; +print ''.$langs->trans("TimeSpent").'
'.$langs->trans("Everybody").''; +print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.dol_trunc($usertoprocess->firstname, 10).'' : '').''; 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 @@ - * Copyright (C) 2005-2016 Laurent Destailleur + * Copyright (C) 2005-2020 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2017 Marcos García @@ -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/class/task.class.php b/htdocs/projet/class/task.class.php index 613daa18ab0..3b91c867ebe 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2014 Marcos García * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,7 +155,8 @@ class Task extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task ("; - $sql .= "fk_projet"; + $sql .= "entity"; + $sql .= ", fk_projet"; $sql .= ", ref"; $sql .= ", entity"; $sql .= ", fk_task_parent"; @@ -167,7 +169,8 @@ class Task extends CommonObject $sql .= ", planned_workload"; $sql .= ", progress"; $sql .= ") VALUES ("; - $sql .= $this->fk_project; + $sql .= $conf->entity; + $sql .= ", ".$this->fk_project; $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); $sql .= ", ".$conf->entity; $sql .= ", ".$this->fk_task_parent; 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.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); } $morehtmlref.='
'; // 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=''.$task['task_name'].''; - $name=$task['task_name']; + // Name + //$name=''.$task['task_name'].''; + $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)); @@ -247,30 +247,30 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje
pGantt
(required) javascript JSGantt.GanttChart object from which to take settings. Defaults to "g" for backwards compatibility
*/ - //$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/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index e535756ce0c..2dc4c90338b 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -29,19 +29,15 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $obj = $db->fetch_object($resql); if ($obj) { - //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) - { - $valsnb[$obj->opp_status] = $obj->nb; - $valsamount[$obj->opp_status] = $obj->opp_amount; - $totalnb += $obj->nb; - if ($obj->opp_status) $totaloppnb += $obj->nb; - if (!in_array($obj->code, array('WON', 'LOST'))) - { + $valsnb[$obj->opp_status] = $obj->nb; + $valsamount[$obj->opp_status] = $obj->opp_amount; + $totalnb += $obj->nb; + if ($obj->opp_status) $totaloppnb += $obj->nb; + if (!in_array($obj->code, array('WON', 'LOST'))) { $totalamount += $obj->opp_amount; $ponderated_opp_amount += $obj->ponderated_opp_amount; } - } - $total += $row[0]; + $total += $obj->nb; } $i++; } diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index ddb66bc3317..e590e4ad82b 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -88,17 +88,15 @@ $morehtml.=''; $morehtml.=''; $morehtml.=''; -print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'project', 0, $morehtml); - -// Show description of content -print '
'; -if ($mine) print $langs->trans("MyProjectsDesc").'

'; +if ($mine) $tooltiphelp = $langs->trans("MyProjectsDesc"); else { - if (!empty($user->rights->projet->all->lire) && !$socid) print $langs->trans("ProjectsDesc").'

'; - else print $langs->trans("ProjectsPublicDesc").'

'; + if (!empty($user->rights->projet->all->lire) && !$socid) $tooltiphelp = $langs->trans("ProjectsDesc"); + else $tooltiphelp = $langs->trans("ProjectsPublicDesc"); } -print '
'; + +print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'project', 0, $morehtml); + // Get list of ponderated percent for each status $listofoppstatus = array(); $listofopplabel = array(); $listofoppcode = array(); 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 'Export agenda cal'; + print 'Export agenda cal'; } /** * Footer function @@ -55,7 +55,7 @@ function llxHeaderVierge() */ function llxFooterVierge() { - print ''; + print ''; } 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 '
'.$langs->trans("ErrorWrongValueForParameterX", 'format').'
'; + print '
'.$langs->trans("ErrorWrongValueForParameterX", 'format').'
'; 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 "\n"; print "\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 "\n"; - print "\n"; - print "".$title."\n"; - if ($head) print $head."\n"; - print "\n"; + print "\n"; + print "".$title."\n"; + if ($head) print $head."\n"; + print "\n"; print ''."\n"; } @@ -70,9 +70,9 @@ function llxHeaderVierge($title, $head = "") */ function llxFooterVierge() { - printCommonFooter('public'); + printCommonFooter('public'); - print "\n"; + print "\n"; print "\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.
'; - print 'You need to be connected to network to use this software.
'; + print 'Sorry, it seems your internet connexion is off.
'; + print 'You need to be connected to network to use this software.
'; } 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 c9697e2e1e4..ef5458456c5 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -255,13 +255,13 @@ 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 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.='
'; if (! empty($moreforfilter)) { - print '
'; - print $moreforfilter; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print '
'; + print '
'; + print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; } ?> @@ -245,12 +245,12 @@ if (! empty($moreforfilter)) $(document).ready(function(){ $('#idtableexample2').dataTable( { + 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..c67dc9a3aeb 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1175,8 +1175,9 @@ if ($action == 'create') $extrafields->fetch_name_optionals_label($srcLine->table_element); $extrafields->fetch_name_optionals_label($line->table_element); - $srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline - $line->fetch_optionals($object->id); + $srcLine->id = $line->id; + $srcLine->fetch_optionals(); // fetch extrafields also available in orderline + $line->fetch_optionals(); $line->array_options = array_merge($line->array_options, $srcLine->array_options); @@ -1231,7 +1232,7 @@ elseif ($id || $ref) $soc = new Societe($db); $soc->fetch($object->socid); - $res = $object->fetch_optionals($object->id); + $res = $object->fetch_optionals(); $head = reception_prepare_head($object); dol_fiche_head($head, 'reception', $langs->trans("Reception"), -1, 'reception'); @@ -1610,7 +1611,7 @@ elseif ($id || $ref) if ($action == 'editline') { print '
- + '; @@ -1986,7 +1987,8 @@ elseif ($id || $ref) { $colspan = empty($conf->productbatch->enabled) ? 8 : 9; $line = new CommandeFournisseurDispatch($db); - $line->fetch_optionals($lines[$i]->id); + $line->id = $lines[$i]->id; + $line->fetch_optionals(); if ($action == 'editline' && $lines[$i]->id == $line_id) { diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 0381892d9e3..2814b7e1d11 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -477,7 +477,7 @@ class Reception extends CommonObject require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); $extrafields->fetch_name_optionals_label($this->table_element, true); - $this->fetch_optionals($this->id); + $this->fetch_optionals(); /* * Lines diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php index a9ed8667474..b10c2ffe295 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 "

\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 '
'; + print ''; + print ''; + print ''; + $num = $db->num_rows($resql); if ($num) { - print '
'; - print '
'.$langs->trans("ReceptionsToValidate").'
'; - print ''; - print ''; $i = 0; while ($i < $num) { @@ -118,132 +120,24 @@ if ($resql) print ''; $i++; } - print "
'.$langs->trans("ReceptionsToValidate").'

"; } -} - - -/* - * 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 '
'; - print ''; - print ''; - print ''; - 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 ''; - print ''; - print ''; - print ''; - print ''; - $i++; - } - print "
'.$langs->trans("SuppliersOrdersToProcess").'
'; - print $orderstatic->getNomUrl(1); - print ''; - print $companystatic->getNomUrl(1, 'customer', 32); - print ''; - print $orderstatic->getLibStatut(3); - print '

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

"; } //print ''; print '
'; +$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 '
'; - print ''; - print ''; - print ''; - 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 ''; - print ''; - print ''; - print ''; - $i++; - } - print "
'.$langs->trans("SuppliersOrdersInProcess").'
'; - print $orderstatic->getNomUrl(1); - print ''; - print $companystatic->getNomUrl(1, 'customer'); - print ''; - print $orderstatic->getLibStatut(3); - print '

"; - } -} -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 '
'; + print '
'; print ''; print ''; print ''; @@ -301,6 +194,64 @@ if ($resql) else dol_print_error($db); + +/* + * Open pruchase 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 '
'; + print '
'.$langs->trans("LastReceptions", $num).'
'; + print ''; + print ''; + 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 ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + print "
'.$langs->trans("SuppliersOrdersToProcess").' '.$num.'
'; + print $orderstatic->getNomUrl(1); + print ''; + print $companystatic->getNomUrl(1, 'customer', 32); + print ''; + print $orderstatic->getLibStatut(3); + print '

"; + } +} + print '
'; $parameters = array('user' => $user); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index de558a6bee4..7b2ce169d33 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -$langs->loadLangs(array("sendings", "receptions", "deliveries", 'companies', 'bills')); +$langs->loadLangs(array("sendings", "receptions", "deliveries", 'companies', 'bills', 'orders')); $socid = GETPOST('socid', 'int'); $massaction = GETPOST('massaction', 'alpha'); @@ -172,7 +172,7 @@ if (empty($reshook)) $rcp = new Reception($db); // On ne facture que les réceptions validées if ($rcp->fetch($id_reception) <= 0 || $rcp->statut != 1) { - $errors[] = $langs->trans('StatusMustBeValidate', $rcp->ref); + $errors[] = $langs->trans('StatusOfRefMustBe', $rcp->ref, $langs->transnoentities("StatusSupplierOrderValidatedShort")); $error++; continue; } @@ -184,12 +184,12 @@ if (empty($reshook)) if (!empty($object->rowid))$object->fetchObjectLinked(); $rcp->fetchObjectLinked(); - if (count($rcp->linkedObjectsIds['order_supplier']) > 0) + if (count($rcp->linkedObjectsIds['reception']) > 0) { - foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value) + foreach ($rcp->linkedObjectsIds['reception'] as $key => $value) { - if (empty($object->linkedObjectsIds['order_supplier']) || !in_array($value, $object->linkedObjectsIds['order_supplier']))//Dont try to link if already linked - $object->add_object_linked('order_supplier', $value); // add supplier order linked object + if (empty($object->linkedObjectsIds['reception']) || !in_array($value, $object->linkedObjectsIds['reception']))//Dont try to link if already linked + $object->add_object_linked('reception', $value); // add supplier order linked object } } } @@ -216,11 +216,11 @@ if (empty($reshook)) $object->origin_id = $id_reception; $rcp->fetchObjectLinked(); - if (count($rcp->linkedObjectsIds['order_supplier']) > 0) + if (count($rcp->linkedObjectsIds['reception']) > 0) { - foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value) + foreach ($rcp->linkedObjectsIds['reception'] as $key => $value) { - $object->linked_objects['order_supplier'] = $value; + $object->linked_objects['reception'] = $value; } } 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 ''; */ print '
'; -print ''.$langs->trans("StatsOnReceptionsOnlyValidated").''; +print ''.$langs->trans("StatsOnReceptionsOnlyValidated").''; 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/class/salariesstats.class.php b/htdocs/salaries/class/salariesstats.class.php index 41449cca0cd..37e950b1bbe 100644 --- a/htdocs/salaries/class/salariesstats.class.php +++ b/htdocs/salaries/class/salariesstats.class.php @@ -126,6 +126,7 @@ class SalariesStats extends Stats $res=$this->_getAmountByMonth($year, $sql, $format); //var_dump($res);print '
'; + return $res; } 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 '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -96,7 +96,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'; } /* ************************************************************************** */ @@ -106,10 +106,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/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 '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -93,10 +93,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'; } /* ************************************************************************** */ @@ -106,10 +106,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/societe/card.php b/htdocs/societe/card.php index edc00088c39..dc6b9db0eac 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 ''; // Name, firstname - print 'global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; - print ''; + print ''; + print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); + print ''; if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; @@ -1286,24 +1295,30 @@ else // Barcode if (!empty($conf->barcode->enabled)) { - print ''; + print ''; print ''; } // Address - print ''; - print ''; + print ''; + print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent'); + print ''; // Zip / Town print ''; if ($conf->browser->layout == 'phone') print ''; - print ''; // Country @@ -1330,17 +1345,17 @@ else } // Phone / Fax - print ''; - print ''; + print ''; + print ''; if ($conf->browser->layout == 'phone') print ''; - print ''; - print ''; + print ''; + print ''; // Email / Web - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ad5c66a50b8..e6e9e42aa75 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 * @@ -1986,11 +1987,11 @@ class Societe extends CommonObject * @param float $remise Amount of discount * @param User $user User adding discount * @param string $desc Reason of discount - * @param float $tva_tx VAT rate + * @param string $vatrate VAT rate (may contain the vat code too). Exemple: '1.23', '1.23 (ABC)', ... * @param int $discount_type 0 => customer discount, 1 => supplier discount - * @return int <0 if KO, id of discount record if OK + * @return int <0 if KO, id of discount record if OK */ - public function set_remise_except($remise, User $user, $desc, $tva_tx = 0, $discount_type = 0) + public function set_remise_except($remise, User $user, $desc, $vatrate = '', $discount_type = 0) { // phpcs:enable global $langs; @@ -2011,8 +2012,17 @@ class Societe extends CommonObject return -2; } - if ($this->id) + if ($this->id > 0) { + // Clean vat code + $reg = array(); + $vat_src_code = ''; + if (preg_match('/\((.*)\)/', $vatrate, $reg)) + { + $vat_src_code = $reg[1]; + $vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate. + } + require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; $discount = new DiscountAbsolute($this->db); @@ -2021,10 +2031,12 @@ class Societe extends CommonObject $discount->discount_type = $discount_type; $discount->amount_ht = $discount->multicurrency_amount_ht = price2num($remise, 'MT'); - $discount->amount_tva = $discount->multicurrency_amount_tva = price2num($remise * $tva_tx / 100, 'MT'); + $discount->amount_tva = $discount->multicurrency_amount_tva = price2num($remise * $vatrate / 100, 'MT'); $discount->amount_ttc = $discount->multicurrency_amount_ttc = price2num($discount->amount_ht + $discount->amount_tva, 'MT'); - $discount->tva_tx = price2num($tva_tx, 'MT'); + $discount->tva_tx = price2num($vatrate, 'MT'); + $discount->vat_src_code = $vat_src_code; + $discount->description = $desc; $result = $discount->create($user); diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index c961b04d8ce..2b362268c4b 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -141,7 +141,7 @@ llxHeader('', $title, $help_url); $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -if (!empty($object->id)) $res = $object->fetch_optionals($object->id, null); +if (!empty($object->id)) $res = $object->fetch_optionals(); //if ($res < 0) { dol_print_error($db); exit; } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 04ad577bff9..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; @@ -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,8 +252,8 @@ if ($action == "change") // Change customer for TakePOS $resql = $db->query($sql); ?>
'; + print '
'; if ($object->particulier || $private) { print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; @@ -1196,7 +1203,9 @@ else print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; } print ''.$langs->trans('Prefix').'
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).'
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); print '
'.$form->editfieldkey('Town', 'town', '', $object, 0).''; + print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); + print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent'); print '
'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.img_picto('', 'object_phoning').'
'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$form->editfieldkey('Fax', 'fax', '', $object, 0).''.img_picto('', 'object_phoning_fax').'
'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).'
'.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', '', $object, 0).'
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).''.img_picto('', 'object_email').'
'.$form->editfieldkey('Web', 'url', '', $object, 0).''.img_picto('', 'globe').'