diff --git a/ChangeLog b/ChangeLog index 1d6e2e39b45..2527864a862 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,7 @@ English Dolibarr ChangeLog -------------------------------------------------------------- -***** ChangeLog for 12.0 compared to 11.0 ***** +***** ChangeLog for 12.0.0 compared to 11.0.0 ***** For users: NEW: Module MO (Manufacturing Order) is available as stable module. @@ -230,6 +230,16 @@ Following changes may create regressions for some external modules, but were nec - remove input field in form '';' - add parameter $pagenavastextinput to value 1 when calling print_barre_liste() +WARNING FOR DOLIWAMP USERS ONLY: + +Only people that installed Dolibarr using the all-in-one autoinstaller for Windows called "DoliWAMP" are concerned by the following warnings: + +* DoliWAMP autoinstaller for Windows is not more available on 32bits systems. Use standard package if you need to use such architecture. +* It is not possible to migrate from an installation done with the old DoliWAMP autoinstaller for Windows by using this new one. You must make a backup + of your database, make a fresh installation using the new installer and reload. +* Don't forget that DoliWAMP is a good solution to make a quick test of Dolibarr on your local computer but was never recommanded as a production + solution on a local desktop since a desktop computer has not a backup and security policy as good as on a server (when there is one). + DoliWAMP remains a solution for fast test or demo purposes. ***** ChangeLog for 11.0.4 compared to 11.0.3 ***** diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 9705cc198da..1b79648279c 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -41,7 +41,7 @@ Compression=lzma SolidCompression=yes WizardImageFile=build\exe\doliwamp\doliwamp.bmp WizardSmallImageFile=build\exe\doliwamp\doliwampsmall.bmp -SetupIconFile=doc\images\dolibarr.ico +SetupIconFile=doc\images\dolibarr_favicon.ico ;To say the installer must be ran as admin PrivilegesRequired=admin DisableProgramGroupPage=yes @@ -104,7 +104,7 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi ; 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.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) +; Value To test: apache 2.4.41, php 7.3.12, mariadb10.4.10 (wampserver3.2.0_x64.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:\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" diff --git a/build/exe/doliwamp/php.ini.install b/build/exe/doliwamp/php.ini.install index a2576c7652d..78903a8a53a 100644 --- a/build/exe/doliwamp/php.ini.install +++ b/build/exe/doliwamp/php.ini.install @@ -304,7 +304,7 @@ expose_php = On max_execution_time = 30 ; Maximum execution time of each script, in seconds max_input_time = 60 ; Maximum amount of time each script may spend parsing request data ;max_input_nesting_level = 64 ; Maximum input variable nesting level -memory_limit = 64M ; Maximum amount of memory a script may consume (128MB) +memory_limit = 256M ; Maximum amount of memory a script may consume (128MB) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 110eae0a3a2..115edcef397 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -90,7 +90,7 @@ cui hai bisogno ed essere facile da usare. %{__install} -m 644 build/rpm/install.forced.php.fedora $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/install.forced.php %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/pixmaps -%{__install} -m 644 doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png +%{__install} -m 644 doc/images/appicon_64.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/applications #desktop-file-install --delete-original --dir=$RPM_BUILD_ROOT%{_datadir}/applications build/rpm/%{name}.desktop %{__install} -m 644 build/rpm/dolibarr.desktop $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index ba5c426ea3f..64293ff6580 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -150,7 +150,7 @@ cui hai bisogno ed essere facile da usare. %endif %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/pixmaps -%{__install} -m 644 doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png +%{__install} -m 644 doc/images/appicon_64.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/applications %{__install} -m 644 build/rpm/dolibarr.desktop $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mdkversion} || 0%{?suse_version} diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 073ef0389ce..28b58a4da96 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -89,7 +89,7 @@ cui hai bisogno ed essere facile da usare. %{__install} -m 644 build/rpm/install.forced.php.mandriva $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/install.forced.php %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/pixmaps -%{__install} -m 644 doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png +%{__install} -m 644 doc/images/appicon_64.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/applications #desktop-file-install --delete-original --dir=$RPM_BUILD_ROOT%{_datadir}/applications build/rpm/%{name}.desktop %{__install} -m 644 build/rpm/dolibarr.desktop $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index be61853e165..8b4ccf37808 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -90,7 +90,7 @@ cui hai bisogno ed essere facile da usare. %{__install} -m 644 build/rpm/install.forced.php.opensuse $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/install.forced.php %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/pixmaps -%{__install} -m 644 doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png +%{__install} -m 644 doc/images/appicon_64.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/applications #desktop-file-install --delete-original --dir=$RPM_BUILD_ROOT%{_datadir}/applications build/rpm/%{name}.desktop %{__install} -m 644 build/rpm/dolibarr.desktop $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop diff --git a/dev/translation/txpull.sh b/dev/translation/txpull.sh index 65d5af3689b..1b0ce7614c5 100755 --- a/dev/translation/txpull.sh +++ b/dev/translation/txpull.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash #------------------------------------------------------ # Script to pull language files to Transifex # diff --git a/dev/translation/txpush.sh b/dev/translation/txpush.sh index 428f7b8cbc2..ef8da74dde9 100755 --- a/dev/translation/txpush.sh +++ b/dev/translation/txpush.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash #------------------------------------------------------ # Script to push language files to Transifex # diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f8fa0774400..ba4c7260519 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -41,7 +41,7 @@ $action = GETPOST('action', 'aZ09'); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id', 'int'); // id of record -$mode = GETPOST('mode', 'aZ09'); // '' or 'tmp' +$mode = GETPOST('mode', 'aZ09'); // '' or '_tmp' $piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id) // Security check diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 3bf41e6326f..e52e4251ee7 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1085,7 +1085,7 @@ class AccountancyExport print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead // MONT - print price(abs($line->montant), 0, '', 1, 2).$separator; + print price(abs($line->montant), 0, '', 1, 2, 2).$separator; // CODC print $line->sens.$separator; // CPTG diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0162a98394e..a700ebecb1b 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1127,7 +1127,7 @@ class BookKeeping extends CommonObject * * @param User $user User that modifies * @param bool $notrigger false=launch triggers after, true=disable triggers - * @param string $mode Mode + * @param string $mode Mode ('' or _tmp') * @return int <0 if KO, >0 if OK */ public function update(User $user, $notrigger = false, $mode = '') @@ -1254,12 +1254,12 @@ class BookKeeping extends CommonObject } /** - * Update movement + * Update accounting movement * * @param string $piece_num Piece num * @param string $field Field * @param string $value Value - * @param string $mode Mode + * @param string $mode Mode ('' or _tmp') * @return number <0 if KO, >0 if OK */ public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '') @@ -1268,9 +1268,9 @@ class BookKeeping extends CommonObject $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode." as ab"; - $sql .= ' SET ab.'.$field.'='.(is_numeric($value) ? $value : "'".$this->db->escape($value)."'"); - $sql .= ' WHERE ab.piece_num='.$piece_num; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode; + $sql .= ' SET '.$field.'='.(is_numeric($value) ? $value : "'".$this->db->escape($value)."'"); + $sql .= " WHERE piece_num = '".$this->db->escape($piece_num)."'"; $resql = $this->db->query($sql); if (!$resql) { diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index e52243a65be..15472558125 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -996,7 +996,8 @@ else print ''; // EMail - print ''.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').''; + print ''.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').''; + print ''.img_picto('', 'object_email').' '; // Address print ''.$langs->trans("Address").''; @@ -1033,13 +1034,16 @@ else } // Pro phone - print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").''; + print ''.$langs->trans("PhonePro").''; + print ''.img_picto('', 'object_phoning').' '; // Personal phone - print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").''; + print ''.$langs->trans("PhonePerso").''; + print ''.img_picto('', 'object_phoning').' '; // Mobile phone - print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").''; + print ''.$langs->trans("PhoneMobile").''; + print ''.img_picto('', 'object_phoning_mobile').' '; if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -1249,7 +1253,8 @@ else print ''; // EMail - print ''.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').'email).'">'; + print ''.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').''; + print ''.img_picto('', 'object_email').' email).'">'; // Address print ''.$langs->trans("Address").''; @@ -1279,13 +1284,16 @@ else } // Pro phone - print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'phone).'">'; + print ''.$langs->trans("PhonePro").''; + print ''.img_picto('', 'object_phoning').' phone).'">'; // Personal phone - print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'phone_perso).'">'; + print ''.$langs->trans("PhonePerso").''; + print ''.img_picto('', 'object_phoning').' phone_perso).'">'; // Mobile phone - print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'phone_mobile).'">'; + print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").''; + print ''.img_picto('', 'object_phoning_mobile').' phone_mobile).'">'; if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 8730f148c07..76aaa14d84c 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -260,7 +260,8 @@ if ($mode == 'config' && $user->admin) { print ''; } - dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic'); + + dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic'); print $langs->trans("ReceiptPrinterDesc")."

\n"; @@ -346,11 +347,11 @@ if ($mode == 'config' && $user->admin) { } print ''; - print '

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

\n"; + print load_fiche_titre($langs->trans("ReceiptPrinterTypeDesc"), '', '')."\n"; + print ''."\n"; print ''; print ''; @@ -358,12 +359,12 @@ if ($mode == 'config' && $user->admin) { print ''; print ''; print '
'.$langs->trans("CONNECTOR_DUMMY").':'.$langs->trans("CONNECTOR_DUMMY_HELP").'
'.$langs->trans("CONNECTOR_NETWORK_PRINT").':'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'
'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'
'.$langs->trans("CONNECTOR_CUPS_PRINT").':'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").'
'; - dol_fiche_end(); - print '

'; + print '
'; + + + print load_fiche_titre($langs->trans("ReceiptPrinterProfileDesc"), '', '')."\n"; - dol_fiche_head(); - print $langs->trans("ReceiptPrinterProfileDesc")."

\n"; print ''."\n"; print ''; print ''; @@ -371,7 +372,6 @@ if ($mode == 'config' && $user->admin) { print ''; print ''; print '
'.$langs->trans("PROFILE_DEFAULT").':'.$langs->trans("PROFILE_DEFAULT_HELP").'
'.$langs->trans("PROFILE_SIMPLE").':'.$langs->trans("PROFILE_SIMPLE_HELP").'
'.$langs->trans("PROFILE_P822D").':'.$langs->trans("PROFILE_P822D_HELP").'
'.$langs->trans("PROFILE_STAR").':'.$langs->trans("PROFILE_STAR_HELP").'
'; - dol_fiche_end(); } if ($mode == 'template' && $user->admin) { @@ -383,9 +383,9 @@ if ($mode == 'template' && $user->admin) { print ''; } - dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic'); - print $langs->trans("ReceiptPrinterTemplateDesc")."

\n"; + print load_fiche_titre($langs->trans("ReceiptPrinterTemplateDesc"), '', '')."

\n"; + print ''."\n"; print ''; print ''; @@ -412,15 +412,15 @@ if ($mode == 'template' && $user->admin) { print ''; print ''; // edit icon - print ''; } @@ -441,21 +441,22 @@ if ($mode == 'template' && $user->admin) { print '
'; } print ''; - print '

'; + + print '
'; + print '
'.$langs->trans("Name").''.$printer->listprinterstemplates[$line]['name'].''.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).''; + print ''; print img_picto($langs->trans("Edit"), 'edit'); print ''; // delete icon - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); print ''; // test icon - print ''; + print ''; print img_picto($langs->trans("TestPrinterTemplate"), 'printer'); print '
'."\n"; print ''; print ''; print ''; print "\n"; - $max = count($printer->tags); - for ($tag = 0; $tag < $max; $tag++) { + + $langs->loadLangs(array("bills", "companies")); + foreach ($printer->tags as $key => $val) { print ''; - print ''; + print ''; print ''; } print '
'.$langs->trans("Tag").''.$langs->trans("Description").'
<'.$printer->tags[$tag].'>'.$langs->trans(strtoupper($printer->tags[$tag])).'<'.$key.'>'.$langs->trans($val).'
'; - - dol_fiche_end(); } // End of page diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index a6f48df1026..ce734aadeb5 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -608,6 +608,12 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $object = new ExpenseReport($this->db); } + elseif ($modulepart == 'adherent' || $modulepart == 'member') + { + $modulepart = 'adherent'; + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + $object = new Adherent($this->db); + } // TODO Implement additional moduleparts else { @@ -652,6 +658,7 @@ class Documents extends DolibarrApi else { if ($modulepart == 'invoice') $modulepart = 'facture'; + if ($modulepart == 'member') $modulepart = 'adherent'; $relativefile = $subdir; diff --git a/htdocs/api/index.php b/htdocs/api/index.php index c5edbc74d66..112eb58059f 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -32,6 +32,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +if (!defined("NOSESSION")) define("NOSESSION", '1'); // Force entity if a value is provided into HTTP header. Otherwise, will use the entity of user of token used. @@ -72,7 +73,8 @@ if (empty($conf->global->MAIN_MODULE_API)) dol_syslog("Call Dolibarr API interfaces with module REST disabled"); print $langs->trans("WarningModuleNotActive", 'Api').'.

'; print $langs->trans("ToActivateModule"); - exit; + //session_destroy(); + exit(0); } // Test if explorer is not disabled @@ -81,7 +83,8 @@ if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API $langs->load("admin"); dol_syslog("Call Dolibarr API interfaces with module REST disabled"); print $langs->trans("WarningAPIExplorerDisabled").'.

'; - exit; + //session_destroy(); + exit(0); } @@ -138,7 +141,7 @@ if (!empty($conf->global->API_RESTRICT_ON_IP)) dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP); print 'APIs are not allowed from the IP '.$ipremote; header('HTTP/1.1 503 API not allowed from your IP '.$ipremote); - //print $conf->global->API_RESTRICT_ON_IP; + //session_destroy(); exit(0); } } @@ -235,19 +238,19 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $ $regbis = array(); if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root'))) { - $module = $reg[1]; - if ($module == 'explorer') // If we call page to explore details of a service + $moduleobject = $reg[1]; + if ($moduleobject == 'explorer') // If we call page to explore details of a service { - $module = $regbis[2]; + $moduleobject = $regbis[2]; } - $module = strtolower($module); - $moduledirforclass = getModuleDirForApiClass($module); + $moduleobject = strtolower($moduleobject); + $moduledirforclass = getModuleDirForApiClass($moduleobject); // Load a dedicated API file - dol_syslog("Load a dedicated API file module=".$module." moduledirforclass=".$moduledirforclass); + dol_syslog("Load a dedicated API file moduleobject=".$moduleobject." moduledirforclass=".$moduledirforclass); - $tmpmodule = $module; + $tmpmodule = $moduleobject; if ($tmpmodule != 'api') $tmpmodule = preg_replace('/api$/i', '', $tmpmodule); $classfile = str_replace('_', '', $tmpmodule); @@ -264,7 +267,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php', 0, 2); - $classname = ucwords($module); + $classname = ucwords($moduleobject); dol_syslog('Search api file /'.$moduledirforclass.'/class/api_'.$classfile.'.class.php => dir_part_file='.$dir_part_file.' classname='.$classname); @@ -275,6 +278,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && dol_syslog('Failed to make include_once '.$dir_part_file, LOG_WARNING); print 'API not found (failed to include API file)'; header('HTTP/1.1 501 API not found (failed to include API file)'); + //session_destroy(); exit(0); } @@ -282,9 +286,16 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $api->r->addAPIClass($classname); } + //var_dump($api->r->apiVersionMap); //exit; // Call API (we suppose we found it). // The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404. + +//Luracast\Restler\Defaults::$returnResponse = true; +//print $api->r->handle(); + $api->r->handle(); + +//session_destroy(); diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 1bfb1836a39..a75aaa5543d 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -193,7 +193,7 @@ llxHeader('', $langs->trans("MassBarcodeInit")); print load_fiche_titre($langs->trans("MassBarcodeInit"), '', 'title_setup.png'); print '
'; -print $langs->trans("MassBarcodeInitDesc").'
'; +print ''.$langs->trans("MassBarcodeInitDesc").'
'; print '
'; //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'
'; @@ -317,6 +317,12 @@ if ($conf->product->enabled || $conf->product->service) } +print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'generic'); +print '
'."\n"; +print $langs->trans("ClickHereToGoTo").' : '.$langs->trans("BarCodePrintsheet").''; + + + print ''; print '
'; diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 5cd988a5bed..cf74a46bb2a 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -267,7 +267,7 @@ llxHeader('', $langs->trans("BarCodePrintsheet")); print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'barcode'); print '
'; -print $langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'
'; +print ''.$langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'
'; print '
'; dol_htmloutput_errors($mesg); diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index d21d82b5ca9..806b75cb9eb 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -24,11 +24,11 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; /** * \file bom/class/api_boms.class.php * \ingroup bom - * \brief File for API management of bom. + * \brief File for API management of BOM. */ /** - * API class for bom + * API class for BOM * * @access protected * @class DolibarrApiAccess {@requires user,external} @@ -120,7 +120,7 @@ class Boms extends DolibarrApi //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; - if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity('bom').')'; + if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')'; if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc"; if ($restrictonsocid && $socid) $sql .= " AND t.fk_soc = ".$socid; if ($restrictonsocid && $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index a8cb6b5de8f..e09bc905b96 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -248,7 +248,7 @@ class AgendaEvents extends DolibarrApi throw new RestException(404, 'actioncomm not found'); } - if (!DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) { + if (!DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach ($request_data as $field => $value) { @@ -290,7 +290,7 @@ class AgendaEvents extends DolibarrApi throw new RestException(404, 'Agenda Event not found'); } - if (!DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) { + if (!DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index b9782515735..06962600edf 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -341,74 +341,6 @@ class FormAdvTargetEmailing extends Form return $return; } - /** - * Return combo list with customer categories - * - * @param string $htmlname Name of categorie - * @param array $selected_array value selected - * @return string HTML combo - */ - public function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array()) - { - return $this->multiselectCategories($htmlname, $selected_array, 2); - } - - /** - * Return combo list with customer contact - * - * @param string $htmlname Name of categorie - * @param array $selected_array value selected - * @return string HTML combo - */ - public function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array()) - { - return $this->multiselectCategories($htmlname, $selected_array, 4); - } - - /** - * Return combo list of categories - * - * @param string $htmlname Name of categorie - * @param array $selected_array Value selected - * @param int $type Type - * @return string HTML combo - */ - public function multiselectCategories($htmlname = '', $selected_array = array(), $type = 0) - { - global $conf, $langs, $user; - $langs->load("dict"); - - $options_array = array(); - - $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie"; - $sql .= " WHERE type=".$type; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - if ($num) - { - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - $options_array[$obj->rowid] = $obj->label; - - $i++; - } - } - } - else - { - dol_print_error($this->db); - } - - return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } - /** * Return a combo list to select emailing target selector * diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 67d9f523f05..3270c3a9663 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -323,15 +323,23 @@ if (empty($reshook)) if (($tmp_total_ht < 0 || $tmp_total_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) { - $langs->load("errors"); if ($object->type == $object::TYPE_DEPOSIT) { + $langs->load("errors"); // Using negative lines on deposit lead to headach and blocking problems when you want to consume them. setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors'); + $error++; + $action = ''; } else { - setEventMessages($langs->trans("ErrorLinesCantBeNegativeForOneVATRate"), null, 'errors'); + $tmpvatratetoshow = explode('_', $vatrate); + $tmpvatratetoshow[0] = round($tmpvatratetoshow[0], 2); + + if ($tmpvatratetoshow[0] != 0) { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorLinesCantBeNegativeForOneVATRate", $tmpvatratetoshow[0]), null, 'errors'); + $error++; + $action = ''; + } } - $error++; - $action = ''; } } } @@ -3536,10 +3544,19 @@ if ($action == 'create') } // Other attributes - $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2'); + $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid'=>$socid); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { + if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE)) { + // copy from thirdparty + $tpExtrafields = new Extrafields($db); + $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); + if ($soc->fetch_optionals() > 0) { + $object->array_options = array_merge($object->array_options, $soc->array_options); + } + }; + print $object->showOptionals($extrafields, 'edit', $parameters); } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index b09f7f00ffe..6bb3e0cc5ca 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -455,6 +455,7 @@ if (!$sall) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.f if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) @@ -462,7 +463,7 @@ if ($search_user > 0) $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; } -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; + $sql .= ' WHERE f.fk_soc = s.rowid'; $sql .= ' AND f.entity IN ('.getEntity('invoice').')'; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 9b0ee645fc7..7a759dde543 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -68,9 +68,11 @@ class Paiement extends CommonObject */ public $montant; - public $amount; // Total amount of payment - public $amounts = array(); // Array of amounts - public $multicurrency_amounts = array(); // Array of amounts + public $amount; // Total amount of payment (in the main currency) + public $multicurrency_amount; // Total amount of payment (in the currency of the bank account) + public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)> + public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)> + public $author; public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement public $paiementcode; // Code of payment. @@ -159,7 +161,7 @@ class Paiement extends CommonObject */ public function fetch($id, $ref = '', $fk_bank = '') { - $sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank,'; + $sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank, p.multicurrency_amount,'; $sql .= ' c.code as type_code, c.libelle as type_label,'; $sql .= ' p.num_paiement as num_payment, p.note,'; $sql .= ' b.fk_account'; @@ -179,6 +181,7 @@ class Paiement extends CommonObject if ($this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); + $this->id = $obj->rowid; $this->ref = $obj->ref ? $obj->ref : $obj->rowid; $this->date = $this->db->jdate($obj->dp); @@ -187,6 +190,7 @@ class Paiement extends CommonObject $this->num_payment = $obj->num_payment; $this->montant = $obj->amount; // deprecated $this->amount = $obj->amount; + $this->multicurrency_amount = $obj->multicurrency_amount; $this->note = $obj->note; $this->type_label = $obj->type_label; $this->type_code = $obj->type_code; @@ -513,8 +517,10 @@ class Paiement extends CommonObject { $accline = new AccountLine($this->db); - $result = $accline->fetch($bank_line_id); - if ($result == 0) $accline->rowid = $bank_line_id; // If not found, we set artificially rowid to allow delete of llx_bank_url + $result=$accline->fetch($bank_line_id); + if ($result == 0) { + $accline->id = $accline->rowid = $bank_line_id; // If not found, we set artificially rowid to allow delete of llx_bank_url + } // Delete bank account url lines linked to payment $result = $accline->delete_urls($user); diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index cefb55f2f42..6172b3f1284 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -78,13 +78,13 @@ print ''.$langs->trans("Statistics").''.$langs->trans("NbOfInvoiceToPayByBankTransfer").''; print ''; print ''; -print $bprev->nbOfInvoiceToPay('credit-transfer'); +print $bprev->nbOfInvoiceToPay('bank-transfer'); print ''; print ''; print ''.$langs->trans("AmountToWithdraw").''; print ''; -print price($bprev->SommeAPrelever('credit-transfer'), '', '', 1, -1, -1, 'auto'); +print price($bprev->SommeAPrelever('bank-transfer'), '', '', 1, -1, -1, 'auto'); print '
'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 0997fb593cb..1a13eb2edb9 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -688,7 +688,7 @@ class BonPrelevement extends CommonObject /** * Returns amount of withdrawal * - * @param string $mode 'direct-debit' or 'credit-transfer' + * @param string $mode 'direct-debit' or 'bank-transfer' * @return double trans("NbOfInvoiceToPayByBankTransfer"); } -print ''.$title.''; +print ''.$title.''; print ''; print $nb; print ''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 9f825cdf009..33c1d098b63 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1200,7 +1200,7 @@ if ($action == 'create') { print ''; print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300'); - print ' '.$langs->trans("AddThirdParty").''; + print ' '; print ''; } print ''."\n"; @@ -1242,7 +1242,7 @@ if ($action == 'create') print ''.$langs->trans("Project").''; $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, "projectid", 0, 0, 1, 1); - print '   id).'">'.$langs->trans("AddProject").''; + print '   id).'">'; print ""; } diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 1e98f0df1da..a1b2c12e10b 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -217,8 +217,10 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) if (empty($reshook)) { - if (!file_exists($destpath)) - { + if (preg_match('/^\./', $filenameto)) { + $langs->load("errors"); // lang must be loaded because we can't rely on loading during output, we need var substitution to be done now. + setEventMessages($langs->trans("ErrorFilenameCantStartWithDot", $filenameto), null, 'errors'); + } elseif (!file_exists($destpath)) { $result = dol_move($srcpath, $destpath); if ($result) { @@ -244,13 +246,13 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) } else { - $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. + $langs->load("errors"); // lang must be loaded because we can't rely on loading during output, we need var substitution to be done now. setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); } } else { - $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. + $langs->load("errors"); // lang must be loaded because we can't rely on loading during output, we need var substitution to be done now. setEventMessages($langs->trans("ErrorDestinationAlreadyExists", $filenameto), null, 'errors'); } } diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 93ac43d6c22..7672c47880d 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -101,7 +101,9 @@ class box_external_rss extends ModeleBoxes if ($result < 0 || !empty($rssparser->error)) { // Show warning - $title .= " ".img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate", ($rssparser->getLastFetchDate() ?dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown")))); + $errormessage = $langs->trans("FailedToRefreshDataInfoNotUpToDate", ($rssparser->getLastFetchDate() ? dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown"))); + if ($rssparser->error) $errormessage .= " - ".$rssparser->error; + $title .= " ".img_error($errormessage); $this->info_box_head = array('text' => $title, 'limit' => 0); } else @@ -109,7 +111,7 @@ class box_external_rss extends ModeleBoxes $this->info_box_head = array( 'text' => $title, 'sublink' => $link, - 'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate() ?dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown")), + 'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate() ? dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown")), 'subpicto'=>'globe', 'target'=>'_blank', ); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e3f0b692079..138d4d0a62b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6091,7 +6091,7 @@ abstract class CommonObject { $morecss = 'minwidth100imp'; } - elseif ($type == 'datetime' || $type == 'link') + elseif ($type == 'datetime' || $type == 'link') // link means an foreign key to another primary id { $morecss = 'minwidth200imp'; } @@ -6563,11 +6563,13 @@ abstract class CommonObject $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]' $param_list_array = explode(':', $param_list[0]); $showempty = (($required && $default != '') ? 0 : 1); + if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button + $morecss .= ' widthcentpercentminusx'; + } $out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, empty($val['disabled']) ? 0 : 1); - if (!empty($param_list_array[2])) // If we set to add a create button - { + if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button if (!GETPOSTISSET('backtopage') && empty($val['disabled']) && empty($nonewbutton)) // To avoid to open several times the 'Create Object' button and to avoid to have button if field is protected by a "disabled". { list($class, $classfile) = explode(':', $param_list[0]); diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index f921e8ad638..8d9c449b972 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -158,79 +158,72 @@ class dolReceiptPrinter extends Printer { $this->db = $db; $this->tags = array( - 'dol_line_feed', - 'dol_line_feed_reverse', - 'dol_align_left', - 'dol_align_center', - 'dol_align_right', - 'dol_use_font_a', - 'dol_use_font_b', - 'dol_use_font_c', - 'dol_bold', - 'dol_bold_disabled', - 'dol_double_height', - 'dol_double_width', - 'dol_default_height_width', - 'dol_underline', - 'dol_underline_disabled', - 'dol_cut_paper_full', - 'dol_cut_paper_partial', - 'dol_open_drawer', - 'dol_beep', - 'dol_print_text', - 'dol_print_barcode', - 'dol_value_date', - 'dol_value_date_time', - 'dol_value_year', - 'dol_value_month_letters', - 'dol_value_month', - 'dol_value_day', - 'dol_value_day_letters', + 'dol_line_feed' => 'DOL_LINE_FEED', + 'dol_line_feed_reverse' => 'DOL_LINE_FEED_REVERSE', + 'dol_align_left' => 'DOL_ALIGN_LEFT', + 'dol_align_center' => 'DOL_ALIGN_CENTER', + 'dol_align_right' => 'DOL_ALIGN_RIGHT', + 'dol_use_font_a' => 'DOL_USE_FONT_A', + 'dol_use_font_b' => 'DOL_USE_FONT_B', + 'dol_use_font_c' => 'DOL_USE_FONT_C', + 'dol_bold' => 'DOL_BOLD', + 'dol_bold_disabled' => 'DOL_BOLD_DISABLED', + 'dol_double_height' => 'DOL_DOUBLE_HEIGHT', + 'dol_double_width' => 'DOL_DOUBLE_WIDTH', + 'dol_default_height_width' => 'DOL_DEFAULT_HEIGHT_WIDTH', + 'dol_underline' => 'DOL_UNDERLINE', + 'dol_underline_disabled' => 'DOL_UNDERLINE_DISABLED', + 'dol_cut_paper_full' => 'DOL_CUT_PAPER_FULL', + 'dol_cut_paper_partial' => 'DOL_CUT_PAPER_PARTIAL', + 'dol_open_drawer' => 'DOL_OPEN_DRAWER', + 'dol_beep' => 'DOL_BEEP', + 'dol_print_text' => 'DOL_PRINT_TEXT', + 'dol_print_barcode' => 'DOL_PRINT_BARCODE', + 'dol_value_date' => 'DateInvoice', + 'dol_value_date_time' => 'DateInvoiceWithTime', + 'dol_value_year' => 'YearInvoice', + 'dol_value_month_letters' => 'DOL_VALUE_MONTH_LETTERS', + 'dol_value_month' => 'DOL_VALUE_MONTH', + 'dol_value_day' => 'DOL_VALUE_DAY', + 'dol_value_day_letters' => 'DOL_VALUE_DAY', //'dol_print_payment', - 'dol_print_logo', - 'dol_print_logo_old', - 'dol_value_object_id', - 'dol_value_object_ref', - 'dol_print_object_lines', - 'dol_print_object_tax', - 'dol_print_object_local_tax', - 'dol_print_object_total', - 'dol_print_object_number', - 'dol_print_order_lines', - 'dol_value_customer_firstname', - 'dol_value_customer_lastname', - 'dol_value_customer_mail', - 'dol_value_customer_phone', - 'dol_value_customer_mobile', - 'dol_value_customer_skype', - 'dol_value_customer_tax_number', - 'dol_value_customer_account_balance', - 'dol_value_mysoc_name', - 'dol_value_mysoc_address', - 'dol_value_mysoc_zip', - 'dol_value_mysoc_town', - 'dol_value_mysoc_country', - 'dol_value_mysoc_idprof1', - 'dol_value_mysoc_idprof2', - 'dol_value_mysoc_idprof3', - 'dol_value_mysoc_idprof4', - 'dol_value_mysoc_idprof5', - 'dol_value_mysoc_idprof6', - 'dol_value_mysoc_tva_intra', - 'dol_value_mysoc_capital', - 'dol_value_vendor_lastname', - 'dol_value_vendor_firstname', - 'dol_value_vendor_mail', - 'dol_value_customer_points', - 'dol_value_object_points', - //'dol_print_if_customer', - //'dol_print_if_vendor', - //'dol_print_if_happy_hour', - //'dol_print_if_num_object_unique', - //'dol_print_if_customer_points', - //'dol_print_if_object_points', - //'dol_print_if_customer_tax_number', - //'dol_print_if_customer_account_balance_positive', + 'dol_print_logo' => 'DOL_PRINT_LOGO', + 'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD', + 'dol_value_object_id' => 'InvoiceID', + 'dol_value_object_ref' => 'InvoiceRef', + 'dol_print_object_lines' => 'DOL_PRINT_OBJECT_LINES', + 'dol_print_object_tax' => 'TotalVAT', + 'dol_print_object_local_tax1' => 'TotalLT1', + 'dol_print_object_local_tax2' => 'TotalLT2', + 'dol_print_object_total' => 'Total', + 'dol_print_object_number' => 'DOL_PRINT_OBJECT_NUMBER', + 'dol_value_object_points' => 'DOL_VALUE_OBJECT_POINTS', + 'dol_print_order_lines' => 'DOL_PRINT_ORDER_LINES', + 'dol_value_customer_firstname' => 'DOL_VALUE_CUSTOMER_FIRSTNAME', + 'dol_value_customer_lastname' => 'DOL_VALUE_CUSTOMER_LASTNAME', + 'dol_value_customer_mail' => 'DOL_VALUE_CUSTOMER_MAIL', + 'dol_value_customer_phone' => 'DOL_VALUE_CUSTOMER_PHONE', + 'dol_value_customer_mobile' => 'DOL_VALUE_CUSTOMER_MOBILE', + 'dol_value_customer_skype' => 'DOL_VALUE_CUSTOMER_SKYPE', + 'dol_value_customer_tax_number' => 'DOL_VALUE_CUSTOMER_TAX_NUMBER', + 'dol_value_customer_account_balance' => 'DOL_VALUE_CUSTOMER_ACCOUNT_BALANCE', + 'dol_value_customer_points' => 'DOL_VALUE_CUSTOMER_POINTS', + 'dol_value_mysoc_name' => 'DOL_VALUE_MYSOC_NAME', + 'dol_value_mysoc_address' => 'Address', + 'dol_value_mysoc_zip' => 'Zip', + 'dol_value_mysoc_town' => 'Town', + 'dol_value_mysoc_country' => 'Country', + 'dol_value_mysoc_idprof1' => 'ProfId1', + 'dol_value_mysoc_idprof2' => 'ProfId2', + 'dol_value_mysoc_idprof3' => 'ProfId3', + 'dol_value_mysoc_idprof4' => 'ProfId4', + 'dol_value_mysoc_idprof5' => 'ProfId5', + 'dol_value_mysoc_idprof6' => 'ProfId6', + 'dol_value_mysoc_tva_intra' => 'VATIntra', + 'dol_value_mysoc_capital' => 'Capital', + 'dol_value_vendor_lastname' => 'VendorLastname', + 'dol_value_vendor_firstname' => 'VendorFirstname', + 'dol_value_vendor_mail' => 'VendorEmail', ); } @@ -545,14 +538,14 @@ class dolReceiptPrinter extends Printer /** * Function to Print Receipt Ticket * - * @param object $object order or invoice object - * @param int $templateid Template id - * @param int $printerid Printer id - * @return int 0 if OK; >0 if KO + * @param Facture|Commande $object Order or invoice object + * @param int $templateid Template id + * @param int $printerid Printer id + * @return int 0 if OK; >0 if KO */ public function sendToPrinter($object, $templateid, $printerid) { - global $conf, $mysoc, $langs; + global $conf, $mysoc, $langs, $user; $error = 0; $ret = $this->loadTemplate($templateid); @@ -560,15 +553,23 @@ class dolReceiptPrinter extends Printer $this->template = str_replace('', $object->id, $this->template); $this->template = str_replace('', $object->ref, $this->template); $this->template = str_replace('', $object->points, $this->template); - $this->template = str_replace('', $object->customer_firstname, $this->template); - $this->template = str_replace('', $object->customer_lastname, $this->template); - $this->template = str_replace('', $object->customer_mail, $this->template); - $this->template = str_replace('', $object->customer_phone, $this->template); - $this->template = str_replace('', $object->customer_mobile, $this->template); - $this->template = str_replace('', $object->customer_skype, $this->template); - $this->template = str_replace('', $object->customer_tax_number, $this->template); + $this->template = str_replace('', dol_print_date($object->date, 'day'), $this->template); + $this->template = str_replace('', dol_print_date($object->date, 'dayhour'), $this->template); + $this->template = str_replace('', dol_print_date($object->date, '%Y'), $this->template); + $this->template = str_replace('', $langs->trans("Month".dol_print_date($object->date, '%m')), $this->template); + $this->template = str_replace('', dol_print_date($object->date, '%m'), $this->template); + $this->template = str_replace('', dol_print_date($object->date, '%d'), $this->template); + $this->template = str_replace('', $langs->trans("Day".dol_print_date($object->date, '%m')[1]), $this->template); + + $this->template = str_replace('', $object->thirdparty->firstname, $this->template); + $this->template = str_replace('', $object->thirdparty->lastname, $this->template); + $this->template = str_replace('', $object->thirdparty->mail, $this->template); + $this->template = str_replace('', $object->thirdparty->phone, $this->template); + $this->template = str_replace('', $object->thirdparty->mobile, $this->template); + $this->template = str_replace('', $object->thirdparty->vatintra, $this->template); $this->template = str_replace('', $object->customer_account_balance, $this->template); $this->template = str_replace('', $object->customer_points, $this->template); + $this->template = str_replace('', $mysoc->name, $this->template); $this->template = str_replace('', $mysoc->address, $this->template); $this->template = str_replace('', $mysoc->zip, $this->template); @@ -582,16 +583,10 @@ class dolReceiptPrinter extends Printer $this->template = str_replace('', $mysoc->idprof6, $this->template); $this->template = str_replace('', $mysoc->tva_intra, $this->template); $this->template = str_replace('', $mysoc->capital, $this->template); - $this->template = str_replace('', $object->vendor_firstname, $this->template); - $this->template = str_replace('', $object->vendor_lastname, $this->template); - $this->template = str_replace('', $object->vendor_mail, $this->template); - $this->template = str_replace('', dol_print_date($object->date, 'day'), $this->template); - $this->template = str_replace('', dol_print_date($object->date, 'dayhour'), $this->template); - $this->template = str_replace('', dol_print_date($object->date, '%Y'), $this->template); - $this->template = str_replace('', $langs->trans("Month".dol_print_date($object->date, '%m')), $this->template); - $this->template = str_replace('', dol_print_date($object->date, '%m'), $this->template); - $this->template = str_replace('', dol_print_date($object->date, '%d'), $this->template); - $this->template = str_replace('', $langs->trans("Day".dol_print_date($object->date, '%m')[1]), $this->template); + + $this->template = str_replace('', $user->firstname, $this->template); + $this->template = str_replace('', $user->lastname, $this->template); + $this->template = str_replace('', $user->email, $this->template); // parse template $p = xml_parser_create(); @@ -634,6 +629,26 @@ class dolReceiptPrinter extends Printer $this->printer->text($spaces.$vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n"); } break; + case 'DOL_PRINT_OBJECT_TAX1': + //var_dump($object); + $total_localtax1 = 0; + foreach ($object->lines as $line) { + $total_localtax1 += $line->total_localtax1; + } + foreach ($vatarray as $vatkey => $vatvalue) { + $this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n"); + } + break; + case 'DOL_PRINT_OBJECT_TAX2': + //var_dump($object); + $total_localtax2 = 0; + foreach ($object->lines as $line) { + $total_localtax2 += $line->total_localtax2; + } + foreach ($vatarray as $vatkey => $vatvalue) { + $this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n"); + } + break; case 'DOL_PRINT_OBJECT_TOTAL': $title = $langs->trans('TotalHT'); $spacestoadd = $nbcharactbyline - strlen($title) - 10; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0d1295b0429..c38e69eaa50 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5933,7 +5933,7 @@ class Form } elseif ($typehour == 'text' || $typehour == 'textselect') { - $retstring .= ''; + $retstring .= ''; } else return 'BadValueForParameterTypeHour'; @@ -5957,7 +5957,7 @@ class Form } elseif ($typehour == 'text') { - $retstring .= ''; + $retstring .= ''; } if ($typehour != 'text') $retstring .= ' '.$langs->trans('MinuteShort'); diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index dd02bf365c1..4ad70ac1f78 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -261,9 +261,15 @@ class RssParser } else { + if (! function_exists('xml_parser_create')) { + $this->error = 'Function xml_parser_create are not supported by your PHP'; + return -1; + } + $xmlparser = xml_parser_create(''); if (!is_resource($xmlparser)) { - $this->error = "ErrorFailedToCreateParser"; return -1; + $this->error = "ErrorFailedToCreateParser"; + return -1; } xml_set_object($xmlparser, $this); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index adb1201df1d..f849be78865 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -273,10 +273,10 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle if ($offsetforchartofaccount > 0) { // Replace lines - // 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);' + // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', '0', '...', 1);' // with - // 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);' - $newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql); + // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', '0', '...', 1);' + $newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql); $newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql); //var_dump($newsql); $arraysql[$i] = $newsql; diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php index 839be4c4e3d..8afbf7a654d 100644 --- a/htdocs/core/lib/emailing.lib.php +++ b/htdocs/core/lib/emailing.lib.php @@ -48,7 +48,7 @@ function emailing_prepare_head(Mailing $object) $h++; } - if (empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) + if (!empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) { $head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id; $head[$h][1] = $langs->trans("MailAdvTargetRecipients"); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index e9e9d64da52..f0916d6c9ef 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -324,11 +324,13 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) // Complete filearray with properties found into $filearrayindatabase foreach ($filearray as $key => $val) { + $tmpfilename = preg_replace('/\.noexe$/', '', $filearray[$key]['name']); + $found = 0; // Search if it exists into $filearrayindatabase foreach ($filearrayindatabase as $key2 => $val2) { - if ($filearrayindatabase[$key2]['name'] == $filearray[$key]['name']) + if ($filearrayindatabase[$key2]['name'] == $tmpfilename) { $filearray[$key]['position_name'] = ($filearrayindatabase[$key2]['position'] ? $filearrayindatabase[$key2]['position'] : '0').'_'.$filearrayindatabase[$key2]['name']; $filearray[$key]['position'] = $filearrayindatabase[$key2]['position']; @@ -349,7 +351,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) $filearray[$key]['acl'] = ''; $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filearray[$key]['fullname']); - if (!preg_match('/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filetorenameafter)) // If not a tmp file + if (!preg_match('/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filename)) // If not a tmp file { dol_syslog("list_of_documents We found a file called '".$filearray[$key]['name']."' not indexed into database. We add it"); include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; @@ -1548,6 +1550,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess if (!empty($_FILES[$varfiles])) // For view $_FILES[$varfiles]['error'] { dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession.' savingdocmask='.$savingdocmask, LOG_DEBUG); + if (dol_mkdir($upload_dir) >= 0) { $TFile = $_FILES[$varfiles]; @@ -1574,6 +1577,13 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess $destfile = preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask); } + $filenameto = basename($destfile); + if (preg_match('/^\./', $filenameto)) { + $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. + setEventMessages($langs->trans("ErrorFilenameCantStartWithDot", $filenameto), null, 'errors'); + break; + } + // dol_sanitizeFileName the file name and lowercase extension $info = pathinfo($destfull); $destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].($info['extension'] != '' ? ('.'.strtolower($info['extension'])) : '')); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b912fb5a31a..a72d2057004 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8872,15 +8872,16 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '') /** * Return if a file can contains executable content * - * @param string $filename File NamedRange + * @param string $filename File name to test * @return boolean True if yes, False if no */ function isAFileWithExecutableContent($filename) { - if (preg_match('/\.(htm|html|js|php|php\d+|phtml|pl|py|cgi|ksh|sh|bash|bat|cmd|wpk|exe|dmg)$/i', $filename)) + if (preg_match('/\.(htm|html|js|phar|php|php\d+|phtml|pht|pl|py|cgi|ksh|sh|shtml|bash|bat|cmd|wpk|exe|dmg)$/i', $filename)) { return true; } + return false; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 531e0fe242c..b50090ee2cf 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2289,82 +2289,70 @@ function cartesianArray(array $input) /** * Get name of directory where the api_...class.php file is stored * - * @param string $module Module name - * @return string Directory name + * @param string $moduleobject Module object name + * @return string Directory name */ -function getModuleDirForApiClass($module) +function getModuleDirForApiClass($moduleobject) { - $moduledirforclass = $module; + $moduledirforclass = $moduleobject; if ($moduledirforclass != 'api') $moduledirforclass = preg_replace('/api$/i', '', $moduledirforclass); - if ($module == 'contracts') { + if ($moduleobject == 'contracts') { $moduledirforclass = 'contrat'; } - elseif (in_array($module, array('admin', 'login', 'setup', 'access', 'status', 'tools', 'documents'))) { + elseif (in_array($moduleobject, array('admin', 'login', 'setup', 'access', 'status', 'tools', 'documents'))) { $moduledirforclass = 'api'; } - elseif ($module == 'contact' || $module == 'contacts' || $module == 'customer' || $module == 'thirdparty' || $module == 'thirdparties') { + elseif ($moduleobject == 'contact' || $moduleobject == 'contacts' || $moduleobject == 'customer' || $moduleobject == 'thirdparty' || $moduleobject == 'thirdparties') { $moduledirforclass = 'societe'; } - elseif ($module == 'propale' || $module == 'proposals') { + elseif ($moduleobject == 'propale' || $moduleobject == 'proposals') { $moduledirforclass = 'comm/propal'; } - elseif ($module == 'agenda' || $module == 'agendaevents') { + elseif ($moduleobject == 'agenda' || $moduleobject == 'agendaevents') { $moduledirforclass = 'comm/action'; } - elseif ($module == 'adherent' || $module == 'members' || $module == 'memberstypes' || $module == 'subscriptions') { + elseif ($moduleobject == 'adherent' || $moduleobject == 'members' || $moduleobject == 'memberstypes' || $moduleobject == 'subscriptions') { $moduledirforclass = 'adherents'; } - elseif ($module == 'don' || $module == 'donations') { + elseif ($moduleobject == 'don' || $moduleobject == 'donations') { $moduledirforclass = 'don'; } - elseif ($module == 'banque' || $module == 'bankaccounts') { + elseif ($moduleobject == 'banque' || $moduleobject == 'bankaccounts') { $moduledirforclass = 'compta/bank'; } - elseif ($module == 'category' || $module == 'categorie') { + elseif ($moduleobject == 'category' || $moduleobject == 'categorie') { $moduledirforclass = 'categories'; } - elseif ($module == 'order' || $module == 'orders') { + elseif ($moduleobject == 'order' || $moduleobject == 'orders') { $moduledirforclass = 'commande'; } - elseif ($module == 'shipments') { + elseif ($moduleobject == 'shipments') { $moduledirforclass = 'expedition'; } - elseif ($module == 'facture' || $module == 'invoice' || $module == 'invoices') { + elseif ($moduleobject == 'facture' || $moduleobject == 'invoice' || $moduleobject == 'invoices') { $moduledirforclass = 'compta/facture'; } - elseif ($module == 'products') { - $moduledirforclass = 'product'; - } - elseif ($module == 'project' || $module == 'projects' || $module == 'tasks') { + elseif ($moduleobject == 'project' || $moduleobject == 'projects' || $moduleobject == 'task' || $moduleobject == 'tasks') { $moduledirforclass = 'projet'; } - elseif ($module == 'task') { - $moduledirforclass = 'projet'; - } - elseif ($module == 'stock' || $module == 'stockmovements' || $module == 'warehouses') { + elseif ($moduleobject == 'stock' || $moduleobject == 'stockmovements' || $moduleobject == 'warehouses') { $moduledirforclass = 'product/stock'; } - elseif ($module == 'supplierproposals' || $module == 'supplierproposal' || $module == 'supplier_proposal') { + elseif ($moduleobject == 'supplierproposals' || $moduleobject == 'supplierproposal' || $moduleobject == 'supplier_proposal') { $moduledirforclass = 'supplier_proposal'; } - elseif ($module == 'fournisseur' || $module == 'supplierinvoices' || $module == 'supplierorders') { + elseif ($moduleobject == 'fournisseur' || $moduleobject == 'supplierinvoices' || $moduleobject == 'supplierorders') { $moduledirforclass = 'fourn'; } - elseif ($module == 'expensereports') { - $moduledirforclass = 'expensereport'; - } - elseif ($module == 'users') { - $moduledirforclass = 'user'; - } - elseif ($module == 'ficheinter' || $module == 'interventions') { + elseif ($moduleobject == 'ficheinter' || $moduleobject == 'interventions') { $moduledirforclass = 'fichinter'; } - elseif ($module == 'tickets') { - $moduledirforclass = 'ticket'; + elseif ($moduleobject == 'mos') { + $moduledirforclass = 'mrp'; } - elseif ($module == 'boms') { - $moduledirforclass = 'bom'; + elseif (in_array($moduleobject, array('products', 'expensereports', 'users', 'tickets', 'boms'))) { + $moduledirforclass = preg_replace('/s$/', '', $moduleobject); } return $moduledirforclass; diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index a669b12adfe..f081fc94120 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -164,10 +164,12 @@ function invoice_admin_prepare_head() $head[$h][2] = 'attributeslinesrec'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php'; - $head[$h][1] = $langs->trans("InvoiceSituation"); - $head[$h][2] = 'situation'; - $h++; + if ($conf->global->INVOICE_USE_SITUATION) { // Warning, implementation is seriously bugged and a new one not compatible is expected to become stable + $head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php'; + $head[$h][1] = $langs->trans("InvoiceSituation"); + $head[$h][2] = 'situation'; + $h++; + } complete_head_from_modules($conf, $langs, null, $head, $h, 'invoice_admin', 'remove'); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index bef3d9fd0dc..b451d2f4939 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2191,7 +2191,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks { if (!in_array('prospectionstatus', $hiddenfields)) print_liste_field_titre("OpportunityStatus", "", "", "", "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder); + //print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder); } if (empty($conf->global->PROJECT_HIDE_TASKS)) { @@ -2225,10 +2225,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print ''; - print ''; + print ''; print $projectstatic->getNomUrl(1, '', 0, '', '-', 0, -1, 'nowraponall'); if (!in_array('projectlabel', $hiddenfields)) print '
'.dol_trunc($objp->title, 24).''; print ''; + print ''; if ($objp->fk_soc > 0) { @@ -2242,7 +2243,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { if (!in_array('prospectionstatus', $hiddenfields)) { - print ''; + print ''; // Because color of prospection status has no meaning yet, it is used if hidden constant is set if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) { $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); @@ -2269,14 +2270,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } print ''; - if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); - print ''; - print ''; - if ($objp->opp_percent && $objp->opp_amount) { - $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100; - print price($opp_weighted_amount, 0, '', 1, -1, -1, $conf->currency); - $ponderated_opp_amount += price2num($opp_weighted_amount); - } + if ($objp->opp_percent && $objp->opp_amount) { + $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100; + $alttext = $langs->trans("OpportunityWeightedAmount").' '.price($opp_weighted_amount, 0, '', 1, -1, 0, $conf->currency); + $ponderated_opp_amount += price2num($opp_weighted_amount); + } + if ($objp->opp_amount) print ''.price($objp->opp_amount, 0, '', 1, -1, 0, $conf->currency).''; print ''; } @@ -2317,14 +2316,16 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } print ''; - print ''.$langs->trans("Total").""; + print ''.$langs->trans("Total").""; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { if (!in_array('prospectionstatus', $hiddenfields)) { print ''; } - print ''.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).''; - print ''.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).''; + print ''; + //$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1); + print $form->textwithpicto(price($total_opp_amount, 0, '', 1, -1, 0, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc").' : '.price($ponderated_opp_amount, 0, '', 1, -1, 0, $conf->currency)); + print ''; } if (empty($conf->global->PROJECT_HIDE_TASKS)) { diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index c12882b032e..a4f1a30bd4d 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -287,9 +287,12 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (!$readok) accessforbidden(); //print "Read access is ok"; - // Check write permission from module (we need to know write permission to create but also to delete drafts record) + // Check write permission from module (we need to know write permission to create but also to delete drafts record or to upload files) $createok = 1; $nbko = 0; - if (GETPOST('action', 'aZ09') == 'create' || GETPOST('action', 'aZ09') == 'update' || ((GETPOST("action", "aZ09") == 'confirm_delete' && GETPOST("confirm", "aZ09") == 'yes') || GETPOST("action", "aZ09") == 'delete')) + $wemustcheckpermissionforcreate = (GETPOST('sendit', 'alpha') || GETPOST('linkit', 'alpha') || GETPOST('action', 'aZ09') == 'create' || GETPOST('action', 'aZ09') == 'update'); + $wemustcheckpermissionfordeletedraft = ((GETPOST("action", "aZ09") == 'confirm_delete' && GETPOST("confirm", "aZ09") == 'yes') || GETPOST("action", "aZ09") == 'delete'); + + if ($wemustcheckpermissionforcreate || $wemustcheckpermissionfordeletedraft) { foreach ($featuresarray as $feature) { @@ -351,7 +354,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f // If a or and at least one ok if (preg_match('/\|/', $features) && $nbko < count($featuresarray)) $createok = 1; - if ((GETPOST('action', 'aZ09') == 'create' || GETPOST('action', 'aZ09') == 'update') && !$createok) accessforbidden(); + if ($wemustcheckpermissionforcreate && !$createok) accessforbidden(); //print "Write access is ok"; } diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 39d1d7ca899..84a30c13d0a 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -460,7 +460,7 @@ function showWebsiteTemplates(Website $website) $colspan = 2; - print ''."\n"; + print ''."\n"; print ''; // Title diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 624311c74f0..b65c4fd956b 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -298,6 +298,14 @@ class modFournisseur extends DolibarrModules 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'p.accountancy_code_buy'=>'ProductAccountancyBuyCode', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' ); + if (! empty($conf->multicurrency->enabled)) + { + $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; + $this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; + $this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; + $this->export_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; + $this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; + } //$this->export_TypeFields_array[$r]=array( // 's.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text', // 's.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.total_tva'=>"Numeric", @@ -425,6 +433,14 @@ class modFournisseur extends DolibarrModules 'f.fk_statut'=>'InvoiceStatus', 'f.note_public'=>"InvoiceNote", 'p.rowid'=>'PaymentId', 'pf.amount'=>'AmountPayment', 'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber', 'p.fk_bank'=>'IdTransaction', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' ); + if (! empty($conf->multicurrency->enabled)) + { + $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; + $this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; + $this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; + $this->export_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; + $this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; + } //$this->export_TypeFields_array[$r]=array( // 's.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text', // 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date", @@ -511,6 +527,14 @@ class modFournisseur extends DolibarrModules 'fd.total_tva'=>"LineTotalVAT", 'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.ref'=>'RefSupplier', 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' ); + if (! empty($conf->multicurrency->enabled)) + { + $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; + $this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; + $this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; + $this->export_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; + $this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; + } if (empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) { unset($this->export_fields_array['f.date_approve2']); diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 23727e4ad97..245cd4f7f00 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -15,6 +15,10 @@ * along with this program. If not, see . */ +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +} + print '