diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 8c01eea6d99..015733ed95f 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -186,7 +186,7 @@ - + diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 5402236f47e..92bc2ff18f6 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -57,12 +57,12 @@ if ($action == 'builddoc' && $permissioncreate) // Special case to force bank account //if (property_exists($object, 'fk_bank')) //{ - if (GETPOST('fk_bank', 'int')) { - // this field may come from an external module - $object->fk_bank = GETPOST('fk_bank', 'int'); - } elseif (! empty($object->fk_account)) { - $object->fk_bank = $object->fk_account; - } + if (GETPOST('fk_bank', 'int')) { + // this field may come from an external module + $object->fk_bank = GETPOST('fk_bank', 'int'); + } elseif (! empty($object->fk_account)) { + $object->fk_bank = $object->fk_account; + } //} $outputlangs = $langs; diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 760a54bc7b2..90c93f6177b 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -81,78 +81,79 @@ elseif (GETPOST('linkit', 'none') && ! empty($conf->global->MAIN_UPLOAD_DOC)) // Delete file/link if ($action == 'confirm_deletefile' && $confirm == 'yes') { - $urlfile = GETPOST('urlfile', 'alpha', 0, null, null, 1); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - if (GETPOST('section', 'alpha')) // For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir + $urlfile = GETPOST('urlfile', 'alpha', 0, null, null, 1); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + if (GETPOST('section', 'alpha')) { + // For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir + $file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile; + } + else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. + { + $urlfile=basename($urlfile); + $file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile; + if (! empty($upload_dirold)) $fileold = $upload_dirold . "/" . $urlfile; + } + $linkid = GETPOST('linkid', 'int'); + + if ($urlfile) { + // delete of a file + $dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine + $dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette (if file is an image) + + $ret = dol_delete_file($file, 0, 0, 0, (is_object($object)?$object:null)); + if (! empty($fileold)) dol_delete_file($fileold, 0, 0, 0, (is_object($object)?$object:null)); // Delete file using old path + + // Si elle existe, on efface la vignette + if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) { - $file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile; - } - else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. - { - $urlfile=basename($urlfile); - $file = $upload_dir . (preg_match('/\/$/', $upload_dir) ? '' : '/') . $urlfile; - if (! empty($upload_dirold)) $fileold = $upload_dirold . "/" . $urlfile; - } - $linkid = GETPOST('linkid', 'int'); - - if ($urlfile) // delete of a file - { - $dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine - $dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette (if file is an image) - - $ret = dol_delete_file($file, 0, 0, 0, (is_object($object)?$object:null)); - if (! empty($fileold)) dol_delete_file($fileold, 0, 0, 0, (is_object($object)?$object:null)); // Delete file using old path - - // Si elle existe, on efface la vignette - if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) + $photo_vignette=basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]); + if (file_exists(dol_osencode($dirthumb.$photo_vignette))) { - $photo_vignette=basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]); - if (file_exists(dol_osencode($dirthumb.$photo_vignette))) - { - dol_delete_file($dirthumb.$photo_vignette); - } - - $photo_vignette=basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]); - if (file_exists(dol_osencode($dirthumb.$photo_vignette))) - { - dol_delete_file($dirthumb.$photo_vignette); - } + dol_delete_file($dirthumb.$photo_vignette); } - if ($ret) setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors'); + $photo_vignette=basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]); + if (file_exists(dol_osencode($dirthumb.$photo_vignette))) + { + dol_delete_file($dirthumb.$photo_vignette); + } } - elseif ($linkid) // delete of external link - { - require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; - $link = new Link($db); - $link->fetch($linkid); - $res = $link->delete($user); - $langs->load('link'); - if ($res > 0) { - setEventMessages($langs->trans("LinkRemoved", $link->label), null, 'mesgs'); + if ($ret) { + setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs'); + } else { + setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors'); + } + } + elseif ($linkid) // delete of external link + { + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $link = new Link($db); + $link->fetch($linkid); + $res = $link->delete($user); + + $langs->load('link'); + if ($res > 0) { + setEventMessages($langs->trans("LinkRemoved", $link->label), null, 'mesgs'); + } else { + if (count($link->errors)) { + setEventMessages('', $link->errors, 'errors'); } else { - if (count($link->errors)) { - setEventMessages('', $link->errors, 'errors'); - } else { - setEventMessages($langs->trans("ErrorFailedToDeleteLink", $link->label), null, 'errors'); - } + setEventMessages($langs->trans("ErrorFailedToDeleteLink", $link->label), null, 'errors'); } } + } - if (is_object($object) && $object->id > 0) - { - if ($backtopage) - { - header('Location: ' . $backtopage); - exit; - } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha')?'§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')):'').(!empty($withproject)?'&withproject=1':'')); - exit; - } + if (is_object($object) && $object->id > 0) { + if ($backtopage) { + header('Location: ' . $backtopage); + exit; } + else + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha')?'§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')):'').(!empty($withproject)?'&withproject=1':'')); + exit; + } + } } elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('link', 'alpha')) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 7d8d621ff92..febcba244c0 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1085,7 +1085,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se } else { - setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); } } } diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 51a77b87c30..2c489b25181 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -220,11 +220,10 @@ class DoliDBMssql extends DoliDB */ public function close() { - if ($this->db) - { - if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened, LOG_ERR); - $this->connected=false; - return mssql_close($this->db); + if ($this->db) { + if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened, LOG_ERR); + $this->connected=false; + return mssql_close($this->db); } return false; } @@ -407,15 +406,15 @@ class DoliDBMssql extends DoliDB // Inserer la date en parametre et le reste de la requete $query = $newquery." DATEPART(week, ".$extractvalue.$endofquery; } - if (preg_match('/^insert\h+(?:INTO)?\h*(\w+?)\h*\(.*\b(?:row)?id\b.*\)\h+VALUES/i', $query, $matches)) - { - //var_dump($query); - //var_dump($matches); - //if (stripos($query,'llx_c_departements') !== false) var_dump($query); - $sql='SET IDENTITY_INSERT ['.trim($matches[1]).'] ON;'; - @mssql_query($sql, $this->db); - $post_query='SET IDENTITY_INSERT ['.trim($matches[1]).'] OFF;'; - } + if (preg_match('/^insert\h+(?:INTO)?\h*(\w+?)\h*\(.*\b(?:row)?id\b.*\)\h+VALUES/i', $query, $matches)) + { + //var_dump($query); + //var_dump($matches); + //if (stripos($query,'llx_c_departements') !== false) var_dump($query); + $sql='SET IDENTITY_INSERT ['.trim($matches[1]).'] ON;'; + @mssql_query($sql, $this->db); + $post_query='SET IDENTITY_INSERT ['.trim($matches[1]).'] OFF;'; + } } //print ""; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 2347d3d77e5..2388b60c7e1 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; class DoliDBPgsql extends DoliDB { //! Database type - public $type='pgsql'; // Name of manager + public $type='pgsql'; // Name of manager //! Database label const LABEL='PostgreSQL'; // Label of manager //! Charset @@ -174,9 +174,9 @@ class DoliDBPgsql extends DoliDB if ($type == 'auto') { - if (preg_match('/ALTER TABLE/i', $line)) $type='dml'; - elseif (preg_match('/CREATE TABLE/i', $line)) $type='dml'; - elseif (preg_match('/DROP TABLE/i', $line)) $type='dml'; + if (preg_match('/ALTER TABLE/i', $line)) $type='dml'; + elseif (preg_match('/CREATE TABLE/i', $line)) $type='dml'; + elseif (preg_match('/DROP TABLE/i', $line)) $type='dml'; } $line=preg_replace('/ as signed\)/i', ' as integer)', $line); @@ -457,8 +457,8 @@ class DoliDBPgsql extends DoliDB $resql=$this->query('SHOW server_version'); if ($resql) { - $liste=$this->fetch_array($resql); - return $liste['server_version']; + $liste=$this->fetch_array($resql); + return $liste['server_version']; } return ''; } @@ -483,9 +483,9 @@ class DoliDBPgsql extends DoliDB { if ($this->db) { - if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened, LOG_ERR); - $this->connected=false; - return pg_close($this->db); + if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened, LOG_ERR); + $this->connected=false; + return pg_close($this->db); } return false; } @@ -955,10 +955,10 @@ class DoliDBPgsql extends DoliDB $result = $this->query($sql); if ($result) { - while($row = $this->fetch_row($result)) - { + while($row = $this->fetch_row($result)) + { $infotables[] = $row; - } + } } return $infotables; } @@ -1127,21 +1127,24 @@ class DoliDBPgsql extends DoliDB $sql= "ALTER TABLE ".$table." ADD ".$field_name." "; $sql .= $field_desc['type']; if (preg_match("/^[^\s]/i", $field_desc['value'])) - if (! in_array($field_desc['type'], array('int','date','datetime'))) - { - $sql.= "(".$field_desc['value'].")"; - } + if (! in_array($field_desc['type'], array('int','date','datetime'))) + { + $sql.= "(".$field_desc['value'].")"; + } if (preg_match("/^[^\s]/i", $field_desc['attribute'])) $sql .= " ".$field_desc['attribute']; if (preg_match("/^[^\s]/i", $field_desc['null'])) $sql .= " ".$field_desc['null']; - if (preg_match("/^[^\s]/i", $field_desc['default'])) - if (preg_match("/null/i", $field_desc['default'])) + if (preg_match("/^[^\s]/i", $field_desc['default'])) { + if (preg_match("/null/i", $field_desc['default'])) { $sql .= " default ".$field_desc['default']; - else - $sql .= " default '".$field_desc['default']."'"; - if (preg_match("/^[^\s]/i", $field_desc['extra'])) - $sql .= " ".$field_desc['extra']; + } else { + $sql .= " default '".$field_desc['default']."'"; + } + } + if (preg_match("/^[^\s]/i", $field_desc['extra'])) { + $sql .= " ".$field_desc['extra']; + } $sql .= " ".$field_position; dol_syslog($sql, LOG_DEBUG); diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 29308ab7b77..af529e97fae 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -149,9 +149,9 @@ class DoliDBSqlite3 extends DoliDB { if ($type == 'auto') { - if (preg_match('/ALTER TABLE/i', $line)) $type='dml'; - elseif (preg_match('/CREATE TABLE/i', $line)) $type='dml'; - elseif (preg_match('/DROP TABLE/i', $line)) $type='dml'; + if (preg_match('/ALTER TABLE/i', $line)) $type='dml'; + elseif (preg_match('/CREATE TABLE/i', $line)) $type='dml'; + elseif (preg_match('/DROP TABLE/i', $line)) $type='dml'; } if ($type == 'dml') diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 54c0f02abde..103e3df3c5b 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1081,7 +1081,7 @@ function price2numjs(amount) { global->MAIN_DISABLE_JQUERY_JNOTIFY) && ! defined('DISABLE_JQUERY_JNOTIFY')) { -?> + ?> // Defined properties for JNotify $(document).ready(function() { if (typeof $.jnotify == 'function') diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 57a26523c12..63a4c6d01e6 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -156,41 +156,41 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) // ldap2dolibarr synchronisation if ($login && ! empty($conf->ldap->enabled) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') // ldap2dolibarr synchronisation { - dol_syslog("functions_ldap::check_user_password_ldap Sync ldap2dolibarr"); + dol_syslog("functions_ldap::check_user_password_ldap Sync ldap2dolibarr"); - // On charge les attributs du user ldap - if ($ldapdebug) print "DEBUG: login ldap = ".$login."
\n"; - $resultFetchLdapUser = $ldap->fetch($login, $userSearchFilter); + // On charge les attributs du user ldap + if ($ldapdebug) print "DEBUG: login ldap = ".$login."
\n"; + $resultFetchLdapUser = $ldap->fetch($login, $userSearchFilter); - if ($ldapdebug) print "DEBUG: UACF = ".join(',', $ldap->uacf)."
\n"; - if ($ldapdebug) print "DEBUG: pwdLastSet = ".dol_print_date($ldap->pwdlastset, 'day')."
\n"; - if ($ldapdebug) print "DEBUG: badPasswordTime = ".dol_print_date($ldap->badpwdtime, 'day')."
\n"; + if ($ldapdebug) print "DEBUG: UACF = ".join(',', $ldap->uacf)."
\n"; + if ($ldapdebug) print "DEBUG: pwdLastSet = ".dol_print_date($ldap->pwdlastset, 'day')."
\n"; + if ($ldapdebug) print "DEBUG: badPasswordTime = ".dol_print_date($ldap->badpwdtime, 'day')."
\n"; - // On recherche le user dolibarr en fonction de son SID ldap (only for Active Directory) - $sid = null; - if ($conf->global->LDAP_SERVER_TYPE == "activedirectory") + // On recherche le user dolibarr en fonction de son SID ldap (only for Active Directory) + $sid = null; + if ($conf->global->LDAP_SERVER_TYPE == "activedirectory") + { + $sid = $ldap->getObjectSid($login); + if ($ldapdebug) print "DEBUG: sid = ".$sid."
\n"; + } + + $usertmp=new User($db); + $resultFetchUser=$usertmp->fetch('', $login, $sid); + if ($resultFetchUser > 0) + { + dol_syslog("functions_ldap::check_user_password_ldap Sync user found user id=".$usertmp->id); + // On verifie si le login a change et on met a jour les attributs dolibarr + + if ($usertmp->login != $ldap->login && $ldap->login) { - $sid = $ldap->getObjectSid($login); - if ($ldapdebug) print "DEBUG: sid = ".$sid."
\n"; + $usertmp->login = $ldap->login; + $usertmp->update($usertmp); + // TODO Que faire si update echoue car on update avec un login deja existant. } - $usertmp=new User($db); - $resultFetchUser=$usertmp->fetch('', $login, $sid); - if ($resultFetchUser > 0) - { - dol_syslog("functions_ldap::check_user_password_ldap Sync user found user id=".$usertmp->id); - // On verifie si le login a change et on met a jour les attributs dolibarr - - if ($usertmp->login != $ldap->login && $ldap->login) - { - $usertmp->login = $ldap->login; - $usertmp->update($usertmp); - // TODO Que faire si update echoue car on update avec un login deja existant. - } - - //$resultUpdate = $usertmp->update_ldap2dolibarr($ldap); - } - unset($usertmp); + //$resultUpdate = $usertmp->update_ldap2dolibarr($ldap); + } + unset($usertmp); } if (! empty($conf->multicompany->enabled)) // We must check entity (even if sync is not active) @@ -240,7 +240,6 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) // Load translation files required by the page $langs->loadLangs(array('main', 'other', 'errors')); -; $_SESSION["dol_loginmesg"]=($ldap->error?$ldap->error:$langs->trans("ErrorBadLoginPassword")); } diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 089194aec2a..b5913bbde20 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -79,7 +79,7 @@ class MenuManager $_SESSION["leftmenuopened"]=""; } else - { + { // On va le chercher en session si non defini par le lien $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; } diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 11d6ac9dd34..f3f0a5795c5 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -307,10 +307,12 @@ class MenuManager print $val2['titre']; if ($relurl2) { - if ($val2['enabled']) // Allowed - print ''; - else - print ''; + if ($val2['enabled']) { + // Allowed + print ''; + } else { + print ''; + } } print ''."\n"; } @@ -448,7 +450,7 @@ class MenuManager unset($this->menu->liste); } } -/* + /* if ($mode == 'jmobile') { foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' @@ -506,7 +508,7 @@ class MenuManager break; // Only first menu entry (so home) } } -*/ + */ unset($this->menu); return $res; diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index f66fc13770c..c90eca21ae4 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -486,7 +486,7 @@ class doc_generic_order_odt extends ModelePDFCommandes } else { try { - $odfHandler->saveToDisk($file); + $odfHandler->saveToDisk($file); } catch (Exception $e) { $this->error=$e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index c101f73fca0..5d69840644e 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -912,66 +912,64 @@ class pdf_einstein extends ModelePDFCommandes //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // VAT foreach($this->tva as $tvakey => $tvaval) @@ -1001,67 +999,67 @@ class pdf_einstein extends ModelePDFCommandes //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // Total TTC diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index d3f7f3016a0..30b8604a298 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1,13 +1,13 @@ - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * 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 @@ -1099,66 +1099,63 @@ class pdf_eratosthene extends ModelePDFCommandes //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // VAT foreach($this->tva as $tvakey => $tvaval) @@ -1188,67 +1185,67 @@ class pdf_eratosthene extends ModelePDFCommandes //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // Total TTC diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index a6d9514d7a7..f1324605874 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -342,7 +342,7 @@ class doc_generic_contract_odt extends ModelePDFContract // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->contrat->dir_temp, @@ -470,7 +470,7 @@ class doc_generic_contract_odt extends ModelePDFContract } else { try { - $odfHandler->saveToDisk($file); + $odfHandler->saveToDisk($file); } catch (Exception $e) { $this->error=$e->getMessage(); return -1; diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 311f1d8f813..bcda35459f6 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -322,82 +322,80 @@ class html_cerfafr extends ModeleDon } elseif ($dix[$i]==2) { if ($unite[$i]==1) { - $secon[$i]='vingt et'; - $prim[$i]=$chif[$unite[$i]]; - } - else { - $secon[$i]='vingt'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='vingt et'; + $prim[$i]=$chif[$unite[$i]]; + } else { + $secon[$i]='vingt'; + $prim[$i]=$chif[$unite[$i]]; } } elseif ($dix[$i]==3) { if ($unite[$i]==1) { - $secon[$i]='trente et'; - $prim[$i]=$chif[$unite[$i]]; - } - else { - $secon[$i]='trente'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='trente et'; + $prim[$i]=$chif[$unite[$i]]; + } else { + $secon[$i]='trente'; + $prim[$i]=$chif[$unite[$i]]; } } elseif ($dix[$i]==4) { if ($unite[$i]==1) { - $secon[$i]='quarante et'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='quarante et'; + $prim[$i]=$chif[$unite[$i]]; } else { - $secon[$i]='quarante'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='quarante'; + $prim[$i]=$chif[$unite[$i]]; } } elseif ($dix[$i]==5) { if ($unite[$i]==1) { - $secon[$i]='cinquante et'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='cinquante et'; + $prim[$i]=$chif[$unite[$i]]; } else { - $secon[$i]='cinquante'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='cinquante'; + $prim[$i]=$chif[$unite[$i]]; } } elseif ($dix[$i]==6) { if ($unite[$i]==1) { - $secon[$i]='soixante et'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='soixante et'; + $prim[$i]=$chif[$unite[$i]]; } else { - $secon[$i]='soixante'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='soixante'; + $prim[$i]=$chif[$unite[$i]]; } } elseif ($dix[$i]==7) { if ($unite[$i]==1) { - $secon[$i]='soixante et'; - $prim[$i]=$chif[$unite[$i]+10]; + $secon[$i]='soixante et'; + $prim[$i]=$chif[$unite[$i]+10]; } else { - $secon[$i]='soixante'; - $prim[$i]=$chif[$unite[$i]+10]; + $secon[$i]='soixante'; + $prim[$i]=$chif[$unite[$i]+10]; } } elseif ($dix[$i]==8) { if ($unite[$i]==1) { - $secon[$i]='quatre-vingts et'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='quatre-vingts et'; + $prim[$i]=$chif[$unite[$i]]; } else { - $secon[$i]='quatre-vingt'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i]='quatre-vingt'; + $prim[$i]=$chif[$unite[$i]]; } } elseif ($dix[$i]==9) { if ($unite[$i]==1) { - $secon[$i]='quatre-vingts et'; - $prim[$i]=$chif[$unite[$i]+10]; + $secon[$i]='quatre-vingts et'; + $prim[$i]=$chif[$unite[$i]+10]; } else { - $secon[$i]='quatre-vingts'; - $prim[$i]=$chif[$unite[$i]+10]; + $secon[$i]='quatre-vingts'; + $prim[$i]=$chif[$unite[$i]+10]; } } if($cent[$i]==1) $trio[$i]='cent'; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 797049e8f57..7dbd3002e33 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -562,7 +562,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } else { try { - $odfHandler->saveToDisk($file); + $odfHandler->saveToDisk($file); } catch (Exception $e) { $this->error=$e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 7757e3c9b56..25b691aaa70 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -218,26 +218,25 @@ class pdf_rouget extends ModelePdfExpedition $realpath=''; - foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) + foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { + if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) { + // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo + if ($obj['photo_vignette']) { - if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo - { - if ($obj['photo_vignette']) - { - $filename= $obj['photo_vignette']; - } - else - { - $filename=$obj['photo']; - } - } - else - { - $filename=$obj['photo']; - } + $filename= $obj['photo_vignette']; + } + else + { + $filename=$obj['photo']; + } + } + else + { + $filename=$obj['photo']; + } - $realpath = $dir.$filename; - break; + $realpath = $dir.$filename; + break; } if ($realpath) $realpatharray[$i]=$realpath; @@ -541,8 +540,8 @@ class pdf_rouget extends ModelePdfExpedition if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) { - $pdf->SetXY($this->posxqtyordered, $curY); - $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked, '', 'C'); + $pdf->SetXY($this->posxqtyordered, $curY); + $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked, '', 'C'); } if (empty($conf->global->SHIPPING_PDF_HIDE_QTYTOSHIP)) diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index 412446166d7..f703561ea03 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -139,19 +139,19 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport $result = $db->query($sql); - if($db->num_rows($result) > 0): - $objp = $db->fetch_object($result); - $newref = $objp->max; - $newref++; - while(strlen($newref) < $num_car): - $newref = "0".$newref; - endwhile; - else: - $newref = 1; - while(strlen($newref) < $num_car): - $newref = "0".$newref; - endwhile; - endif; + if ($db->num_rows($result) > 0) { + $objp = $db->fetch_object($result); + $newref = $objp->max; + $newref++; + while (strlen($newref) < $num_car) { + $newref = "0".$newref; + } + } else { + $newref = 1; + while (strlen($newref) < $num_car) { + $newref = "0".$newref; + } + } $ref_number_int = ($newref+1)-1; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 008b9a191c2..bb39f88c45d 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -344,7 +344,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->facture->dir_temp, diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 4320c63f58b..2b198c35336 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1177,69 +1177,69 @@ class pdf_crabe extends ModelePDFFactures //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} @@ -1271,43 +1271,12 @@ class pdf_crabe extends ModelePDFFactures //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) - { - if ($tvakey != 0) // On affiche pas taux 0 - { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); - } - } - } - //} - //Local tax 2 after VAT - //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) - { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -1320,15 +1289,45 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } + //} + //Local tax 2 after VAT + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) + { + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) + { + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; + } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + } + } //} // Revenue stamp diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index ae8b33793d2..07ed5f5783c 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -371,10 +371,10 @@ class pdf_sponge extends ModelePDFFactures // Does we have at least one line with discount $this->atleastonediscount foreach ($object->lines as $line) { - if ($line->remise_percent){ + if ($line->remise_percent) { $this->atleastonediscount = true; break; - } + } } @@ -769,65 +769,62 @@ class pdf_sponge extends ModelePDFFactures } // retrieve global local tax - if ($localtax1_type && $localtax1ligne != 0) - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; - if ($localtax2_type && $localtax2ligne != 0) - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + if ($localtax1_type && $localtax1ligne != 0) { + $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + } + if ($localtax2_type && $localtax2ligne != 0) { + $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + } - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; - $this->tva[$vatrate] += $tvaligne; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; + if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + $this->tva[$vatrate] += $tvaligne; - $nexY = max($nexY, $posYAfterImage); + $nexY = max($nexY, $posYAfterImage); - // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) - { - $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); - //$pdf->SetDrawColor(190,190,200); - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); - $pdf->SetLineStyle(array('dash'=>0)); - } + // Add line + if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { + $pdf->setPage($pageposafter); + $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + //$pdf->SetDrawColor(190,190,200); + $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->SetLineStyle(array('dash'=>0)); + } - $nexY+=2; // Add space between lines + $nexY+=2; // Add space between lines - // Detect if some page were added automatically and output _tableau for past pages - while ($pagenb < $pageposafter) - { - $pdf->setPage($pagenb); - if ($pagenb == $pageposbeforeprintlines) - { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); - } - else - { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); - } - $this->_pagefoot($pdf, $object, $outputlangs, 1); - $pagenb++; - $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - } + // Detect if some page were added automatically and output _tableau for past pages + while ($pagenb < $pageposafter) { + $pdf->setPage($pagenb); + if ($pagenb == $pageposbeforeprintlines) { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); + } + $this->_pagefoot($pdf, $object, $outputlangs, 1); + $pagenb++; + $pdf->setPage($pagenb); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + } - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) - { - if ($pagenb == $pageposafter) - { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); - } - else - { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); - } - $this->_pagefoot($pdf, $object, $outputlangs, 1); - // New page - $pdf->AddPage(); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); - $pagenb++; - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - } + if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { + if ($pagenb == $pageposafter) { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); + } + $this->_pagefoot($pdf, $object, $outputlangs, 1); + // New page + $pdf->AddPage(); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + } } // Show square @@ -1266,14 +1263,11 @@ class pdf_sponge extends ModelePDFFactures $deja_paye = 0; $i = 1; - if(!empty($TPreviousIncoice)){ + if (!empty($TPreviousIncoice)) { $pdf->setY($tab2_top); $posy = $pdf->GetY(); - - - - foreach ($TPreviousIncoice as &$fac){ + foreach ($TPreviousIncoice as &$fac) { if($posy > $this->page_hauteur - 4 ) { $this->_pagefoot($pdf, $object, $outputlangs, 1); $pdf->addPage(); @@ -1290,8 +1284,8 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($col2x, $posy); $facSign = ''; - if($i>1){ - $facSign = $fac->total_ht>=0?'+':''; + if ($i>1) { + $facSign = $fac->total_ht>=0?'+':''; } $displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs); @@ -1312,11 +1306,11 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($col2x, $posy); $facSign = ''; - if($i>1){ + if ($i>1) { $facSign = $object->total_ht>=0?'+':''; // management of a particular customer case } - if($fac->type === facture::TYPE_CREDIT_NOTE){ + if ($fac->type === facture::TYPE_CREDIT_NOTE) { $facSign = '-'; // les avoirs } @@ -1375,7 +1369,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount"), 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + 0); + $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1); $index++; @@ -1410,70 +1404,67 @@ class pdf_sponge extends ModelePDFFactures //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } - + } //} // VAT @@ -1527,68 +1518,68 @@ class pdf_sponge extends ModelePDFFactures //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + // retrieve global local tax + if ($tvakey != 0) // On affiche pas taux 0 { - // retrieve global local tax - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } // Revenue stamp diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index ac59960cf59..ff7bff51230 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -502,7 +502,7 @@ class pdf_soleil extends ModelePDFFicheinter $default_font_size = pdf_getPDFFontSize($outputlangs); -/* + /* $pdf->SetXY($this->marge_gauche, $tab_top); $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8); @@ -526,7 +526,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); $pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also. -*/ + */ // Output Rect $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+1, 0, 0); // Rect takes a length in 3rd parameter and 4th parameter diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index cb3ae176026..08ac267445d 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -217,9 +217,9 @@ class ImportCsv extends ModeleImports * @return int <0 if KO, >=0 if OK */ public function import_get_nb_of_lines($file) - { + { // phpcs:enable - return dol_count_nb_of_line($file); + return dol_count_nb_of_line($file); } diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 670b831c25f..25ffcb717fd 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -255,9 +255,11 @@ class mailing_fraise extends MailingTargets $sql.= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false $sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$this->db->escape($mailing_id).")"; // Filter on status - if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1"; - if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)"; - if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql.= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)"; + if (isset($_POST["filter"]) && $_POST["filter"] == '-1') { + $sql.= " AND a.statut=-1"; + } + if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)"; + if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql.= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)"; if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND a.statut=0"; // Filter on date if ($dateendsubscriptionafter > 0) $sql.=" AND datefin > '".$this->db->idate($dateendsubscriptionafter)."'"; diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 00db6eb89ea..68cb49e10d9 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -288,29 +288,28 @@ class mailing_thirdparties extends MailingTargets } $s.=' '; - $s.= $langs->trans('ProspectCustomer'); - $s.=': '; + $s.= ''; + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $s.= ''; + } + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { + $s.= ''; + } + if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + $s.= ''; + } + $s.= ''; - $s.=' '; + $s.= ' '; - $s.=$langs->trans("Status"); - $s.=': '; + $s.= $langs->trans("Status"); + $s.= ': '; return $s; } diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php index dbea2fe8d8a..fc8557497b8 100644 --- a/htdocs/core/modules/modComptabilite.class.php +++ b/htdocs/core/modules/modComptabilite.class.php @@ -35,11 +35,11 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; class modComptabilite extends DolibarrModules { - /** - * Constructor. Define names, constants, directories, boxes, permissions - * - * @param DoliDB $db Database handler - */ + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ public function __construct($db) { global $conf; @@ -72,11 +72,12 @@ class modComptabilite extends DolibarrModules $this->const = array(); // Data directories to create when module is enabled - $this->dirs = array("/comptabilite/temp", - "/comptabilite/rapport", - "/comptabilite/export", - "/comptabilite/bordereau" - ); + $this->dirs = array( + "/comptabilite/temp", + "/comptabilite/rapport", + "/comptabilite/export", + "/comptabilite/bordereau" + ); // Boxes $this->boxes = array(); diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index bd11774eb21..1aefb52ea1c 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -32,10 +32,10 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; class modECM extends DolibarrModules { - /** - * Constructor. Define names, constants, directories, boxes, permissions - * - * @param DoliDB $db Database handler + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler */ public function __construct($db) { diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 152f2101893..68f4a3d5fba 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -298,11 +298,10 @@ class modExpedition extends DolibarrModules $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commandedet as cd'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extraprod ON p.rowid = extraprod.fk_object'; - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) - { - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object'; + if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) { + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object'; } $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid'; $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('expedition').')'; diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php index 06c8f51f76b..63146e87318 100644 --- a/htdocs/core/modules/modReception.class.php +++ b/htdocs/core/modules/modReception.class.php @@ -223,11 +223,10 @@ class modReception extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch_extrafields as extra2 ON ed.rowid = extra2.fk_object'; $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; - if ($idcontacts && ! empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) - { - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object'; + if ($idcontacts && ! empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) { + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object'; } $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_reception AND ed.fk_commandefourndet = cd.rowid'; $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('reception').')'; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index a225fe47005..5a2c5040e88 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -148,7 +148,7 @@ class modSociete extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; -/* $r++; + /*$r++; $this->rights[$r][0] = 241; $this->rights[$r][1] = 'Read thirdparties customers'; $this->rights[$r][2] = 'r'; @@ -163,7 +163,7 @@ class modSociete extends DolibarrModules $this->rights[$r][3] = 0; $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'read'; -*/ + */ $r++; $this->rights[$r][0] = 122; // id de la permission @@ -172,8 +172,8 @@ class modSociete extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'creer'; -/* $r++; - $this->rights[$r][0] = 251; + /* $r++; + $this->rights[$r][0] = 251; $this->rights[$r][1] = 'Create thirdparties customers'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; @@ -187,7 +187,7 @@ class modSociete extends DolibarrModules $this->rights[$r][3] = 0; $this->rights[$r][4] = 'thirdparty_supplier_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'read'; -*/ + */ $r++; $this->rights[$r][0] = 125; // id de la permission diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index 7baf96f8d96..30d90b8a0c6 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -82,8 +82,8 @@ class modStripe extends DolibarrModules // New pages on tabs $this->tabs = array(); - // Boxes - $this->boxes = array(); // List of boxes + // List of boxes + $this->boxes = array(); $r=0; // Permissions @@ -92,8 +92,8 @@ class modStripe extends DolibarrModules // Main menu entries $r=0; - /* $this->menu[$r]=array( - 'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + /* $this->menu[$r]=array( + 'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'mainmenu'=>'billing', 'leftmenu'=>'customers_bills_payment_stripe', 'type'=>'left', // This is a Left menu entry diff --git a/htdocs/core/modules/modVariants.class.php b/htdocs/core/modules/modVariants.class.php index 728107ea08f..2c9aad59425 100644 --- a/htdocs/core/modules/modVariants.class.php +++ b/htdocs/core/modules/modVariants.class.php @@ -92,7 +92,7 @@ class modVariants extends DolibarrModules // Array to add new pages in new tabs $this->tabs = array( -// 'product:+combinations:Combinaciones:products:1:/variants/combinations.php?id=__ID__' + // 'product:+combinations:Combinaciones:products:1:/variants/combinations.php?id=__ID__' ); // Dictionaries diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index 7c11a4b98b0..375d7c8c209 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -186,17 +186,15 @@ class modWebsite extends DolibarrModules dol_mkdir($destroot); $docs=dol_dir_list($srcroot, 'files', 0, 'website_.*(\.zip|\.jpg)$'); - foreach($docs as $cursorfile) - { - $src=$srcroot.'/'.$cursorfile['name']; - $dest=$destroot.'/'.$cursorfile['name']; + foreach($docs as $cursorfile) { + $src=$srcroot.'/'.$cursorfile['name']; + $dest=$destroot.'/'.$cursorfile['name']; - $result=dol_copy($src, $dest, 0, 0); - if ($result < 0) - { - $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); - } + $result=dol_copy($src, $dest, 0, 0); + if ($result < 0) { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + } } $sql = array(); diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index ca0fbd50333..b5e857866b5 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -668,8 +668,7 @@ class pdf_standard extends ModelePDFProduct $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); - $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', - 'C'); + $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C'); } } diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index a9593c6bbef..b26b46604ff 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -107,7 +107,7 @@ class pdf_beluga extends ModelePDFProjects $this->emetteur=$mysoc; if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined - // Define position of columns + // Define position of columns if ($this->orientation == 'L' || $this->orientation == 'Landscape') { $this->posxref=$this->marge_gauche+1; $this->posxdate=$this->marge_gauche+105; diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 5ccac833601..d73ee22fbae 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -116,13 +116,13 @@ class mod_project_simple extends ModeleNumRefProjects } - /** - * Return next value - * - * @param Societe $objsoc Object third party - * @param Project $project Object project - * @return string Value if OK, 0 if KO - */ + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param Project $project Object project + * @return string Value if OK, 0 if KO + */ public function getNextValue($objsoc, $project) { global $db,$conf; diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index edd90585089..342eaa26320 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -116,13 +116,13 @@ class mod_project_universal extends ModeleNumRefProjects return $numExample; } - /** - * Return next value - * - * @param Societe $objsoc Object third party - * @param Project $project Object project - * @return string Value if OK, 0 if KO - */ + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param Project $project Object project + * @return string Value if OK, 0 if KO + */ public function getNextValue($objsoc, $project) { global $db,$conf; diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 811d5b1c97b..65c7deb8edf 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -117,13 +117,13 @@ class mod_task_simple extends ModeleNumRefTask } - /** - * Return next value - * - * @param Societe $objsoc Object third party - * @param Task $object Object Task - * @return string Value if OK, 0 if KO - */ + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param Task $object Object Task + * @return string Value if OK, 0 if KO + */ public function getNextValue($objsoc, $object) { global $db,$conf; diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index cfba42090d1..018a10c80a2 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -116,13 +116,13 @@ class mod_task_universal extends ModeleNumRefTask return $numExample; } - /** - * Return next value - * - * @param Societe $objsoc Object third party - * @param Task $object Object task - * @return string Value if OK, 0 if KO - */ + /** + * Return next value + * + * @param Societe $objsoc Object third party + * @param Task $object Object task + * @return string Value if OK, 0 if KO + */ public function getNextValue($objsoc, $object) { global $db,$conf; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index c7303683d5c..5412343941c 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -515,7 +515,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales } else { try { - $odfHandler->saveToDisk($file); + $odfHandler->saveToDisk($file); } catch (Exception $e) { $this->error=$e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index d3693932f76..a79c17b47ca 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1088,68 +1088,68 @@ class pdf_azur extends ModelePDFPropales //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // VAT foreach($this->tva as $tvakey => $tvaval) @@ -1179,68 +1179,68 @@ class pdf_azur extends ModelePDFPropales //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + // retrieve global local tax + if ($tvakey != 0) // On affiche pas taux 0 { - // retrieve global local tax - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // Total TTC diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 319f563ad28..7db062d3cbc 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1191,68 +1191,68 @@ class pdf_cyan extends ModelePDFPropales //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // VAT foreach($this->tva as $tvakey => $tvaval) @@ -1282,68 +1282,68 @@ class pdf_cyan extends ModelePDFPropales //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + // retrieve global local tax + if ($tvakey != 0) // On affiche pas taux 0 { - // retrieve global local tax - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // Total TTC diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 9741a8fbfc5..0cd252924f3 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -497,7 +497,7 @@ class doc_generic_reception_odt extends ModelePdfReception } else { try { - $odfHandler->saveToDisk($file); + $odfHandler->saveToDisk($file); } catch (Exception $e){ $this->error=$e->getMessage(); return -1; diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index a84b86e908b..9dffb0eee69 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -142,26 +142,25 @@ class pdf_squille extends ModelePdfReception $realpath=''; - foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) + foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { + if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) { + // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo + if ($obj['photo_vignette']) { - if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo - { - if ($obj['photo_vignette']) - { - $filename= $obj['photo_vignette']; - } - else - { - $filename=$obj['photo']; - } - } - else - { - $filename=$obj['photo']; - } + $filename= $obj['photo_vignette']; + } + else + { + $filename=$obj['photo']; + } + } + else + { + $filename=$obj['photo']; + } - $realpath = $dir.$filename; - break; + $realpath = $dir.$filename; + break; } if ($realpath) $realpatharray[$i]=$realpath; @@ -461,14 +460,13 @@ class pdf_squille extends ModelePdfReception $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'
':'').$voltxt, 0, 0, false, true, 'C'); //$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 3, $weighttxt.(($weighttxt && $voltxt)?'
':'').$voltxt,'','C'); - if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) - { - $pdf->SetXY($this->posxqtyordered, $curY); - if($object->lines[$i]->fk_commandefourndet!=$fk_commandefourndet){ - $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked, '', 'C'); - $totalOrdered+=$object->lines[$i]->qty_asked; - } - $fk_commandefourndet = $object->lines[$i]->fk_commandefourndet; + if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) { + $pdf->SetXY($this->posxqtyordered, $curY); + if($object->lines[$i]->fk_commandefourndet!=$fk_commandefourndet){ + $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked, '', 'C'); + $totalOrdered+=$object->lines[$i]->qty_asked; + } + $fk_commandefourndet = $object->lines[$i]->fk_commandefourndet; } $pdf->SetXY($this->posxqtytoship, $curY); diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index c389a6f77ed..2f78deefe68 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -197,14 +197,13 @@ class doc_generic_odt extends ModeleThirdPartyDoc return -1; } - // Add odtgeneration hook - if (! is_object($hookmanager)) - { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); - } - $hookmanager->initHooks(array('odtgeneration')); - global $action; + // Add odtgeneration hook + if (! is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('odtgeneration')); + global $action; if (! is_object($outputlangs)) $outputlangs=$langs; $sav_charset_output=$outputlangs->charset_output; @@ -408,17 +407,16 @@ class doc_generic_odt extends ModeleThirdPartyDoc } else { try { - $odfHandler->creator = $user->getFullName($outputlangs); - $odfHandler->title = $object->builddoc_filename; - $odfHandler->subject = $object->builddoc_filename; + $odfHandler->creator = $user->getFullName($outputlangs); + $odfHandler->title = $object->builddoc_filename; + $odfHandler->subject = $object->builddoc_filename; - if (! empty($conf->global->ODT_ADD_DOLIBARR_ID)) - { - $odfHandler->userdefined['dol_id'] = $object->id; - $odfHandler->userdefined['dol_element'] = $object->element; - } + if (! empty($conf->global->ODT_ADD_DOLIBARR_ID)) { + $odfHandler->userdefined['dol_id'] = $object->id; + $odfHandler->userdefined['dol_element'] = $object->element; + } - $odfHandler->saveToDisk($file); + $odfHandler->saveToDisk($file); } catch (Exception $e){ $this->error=$e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index e19814c3cd4..0d6d2e3d420 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -495,7 +495,7 @@ class doc_generic_stock_odt extends ModelePDFStock } else { try { - $odfHandler->saveToDisk($file); + $odfHandler->saveToDisk($file); } catch (Exception $e) { $this->error=$e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index dd002a95766..89dbd9898bc 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -714,58 +714,56 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - //Local tax 1 - foreach($this->localtax1 as $tvakey => $tvaval) + //Local tax 1 + foreach ($this->localtax1 as $tvakey => $tvaval) { + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.= vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } + } //} //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - //Local tax 2 - foreach($this->localtax2 as $tvakey => $tvaval) + //Local tax 2 + foreach($this->localtax2 as $tvakey => $tvaval) { + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.= vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat.= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } + } //} } diff --git a/htdocs/core/modules/supplier_order/pdf/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/pdf/doc_generic_supplier_order_odt.modules.php index b139f0330a1..bdb5e88bdb8 100644 --- a/htdocs/core/modules/supplier_order/pdf/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/doc_generic_supplier_order_odt.modules.php @@ -4,7 +4,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2019 Philippe Grand - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2019 Tim Otte * * This program is free software; you can redistribute it and/or modify @@ -485,7 +485,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders } else { try { - $odfHandler->saveToDisk($file); + $odfHandler->saveToDisk($file); } catch (Exception $e) { $this->error=$e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index 5977764ca8a..f9b0d1b106c 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -674,7 +674,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $text=$this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } -/* + /* $pdf->SetFont('','B', $default_font_size + 3); $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); @@ -734,7 +734,7 @@ class pdf_standard extends ModelePDFSuppliersPayments // Show list of linked objects $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); -*/ + */ if ($showaddress) { // Sender properties diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index eb53b7b74be..95f7b0e45d0 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -365,7 +365,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->supplier_proposal->dir_temp, diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 7e23b6b8c91..ff8ab76c674 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -941,68 +941,68 @@ class pdf_aurore extends ModelePDFSupplierProposal //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1','3','5'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey!=0) // On affiche pas taux 0 { - if ($tvakey!=0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // VAT foreach($this->tva as $tvakey => $tvaval) @@ -1032,68 +1032,68 @@ class pdf_aurore extends ModelePDFSupplierProposal //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + if ($tvakey != 0) // On affiche pas taux 0 { - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach($localtax_rate as $tvakey => $tvaval) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach($localtax_rate as $tvakey => $tvaval) + // retrieve global local tax + if ($tvakey != 0) // On affiche pas taux 0 { - // retrieve global local tax - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/', $tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/', $tvakey)) - { - $tvakey=str_replace('*', '', $tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*', '', $tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } + } //} // Total TTC @@ -1240,7 +1240,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxunit - 1, $tab_top + 1); - $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C'); + $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C'); } } @@ -1345,12 +1345,12 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } -/* PHFAVRE + /* PHFAVRE $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R'); -*/ + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison, "day", false, $outputlangs, true), '', 'R'); + */ if ($object->thirdparty->code_fournisseur) { diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index b59ca8c2b22..d1b1dfe1093 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -47,499 +47,492 @@ print ''; - print load_fiche_titre($langs->trans("AdvTgtTitle")); +print load_fiche_titre($langs->trans("AdvTgtTitle")); - print '
' . "\n"; - print '
' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; +print '
' . "\n"; +print '' . "\n"; +print '' . "\n"; +print '' . "\n"; +print '
' . "\n"; - print '' . "\n"; - print '' . "\n"; +print '' . "\n"; - print '' . "\n"; +print '' . "\n"; +print '' . "\n"; - print '' . "\n"; +print '' . "\n"; - print '' . "\n"; +print '' . "\n"; - // Customer name - print '' . "\n"; +// Customer name +print '' . "\n"; - // Code Client - print '' . "\n"; +// Code Client +print '' . "\n"; - // Address Client - print '' . "\n"; +// Address Client +print '' . "\n"; - // Zip Client - print '' . "\n"; +// Zip Client +print '' . "\n"; - // City Client - print '' . "\n"; +// City Client +print '' . "\n"; - // Customer Country - print '' . "\n"; +// Customer Country +print '' . "\n"; - // State Customer - print '' . "\n"; +// State Customer +print '' . "\n"; - // Mother Company - print '' . "\n"; +// Mother Company +print '' . "\n"; - // Prospect/Customer - $selected = $array_query['cust_typecust']; - print '' . "\n"; +// Prospect/Customer +$selected = $array_query['cust_typecust']; +print '' . "\n"; - // Prospection status - print '' . "\n"; +// Prospection status +print '' . "\n"; - // Prospection comm status - print '' . "\n"; +// Prospection comm status +print '' . "\n"; - // Customer Type - print '' . "\n"; +// Customer Type +print '' . "\n"; - // Staff number - print '' . "\n"; +// Staff number +print '' . "\n"; - // Sales manager - print '' . "\n"; +// Sales manager +print '' . "\n"; - // Customer Default Langauge - if (! empty($conf->global->MAIN_MULTILANGS)) { - print '' . "\n"; +} + +if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + // Customer Categories + print '' . "\n"; +} + +// Standard Extrafield feature +if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + $elementtype = Societe::$table_element; + // fetch optionals attributes and labels + dol_include_once('/core/class/extrafields.class.php'); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label($elementtype); + foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) { + if ($key != 'ts_nameextra' && $key != 'ts_payeur') { + print '' . "\n"; - } + print '' . "\n"; - } - - // Standard Extrafield feature - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - $elementtype = Societe::$table_element; - // fetch optionals attributes and labels - dol_include_once('/core/class/extrafields.class.php'); - $extrafields = new ExtraFields($db); - $extrafields->fetch_name_optionals_label($elementtype); - foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) { - if ($key != 'ts_nameextra' && $key != 'ts_payeur') { - print '' . "\n"; - } - } - } else { - $std_soc = new Societe($db); - $action_search = 'query'; - - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($db); - $hookmanager->initHooks(array ('thirdpartycard')); - - $parameters=array(); - if (! empty($advTarget->id)) { - $parameters = array('array_query' => $advTarget->filtervalue); - } - // Other attributes - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search); - print $hookmanager->resPrint; - } - - // State Contact - print '' . "\n"; - - // Civility - print ''; - - // contact name - print '' . "\n"; - print '' . "\n"; - - // Contact Country - print '' . "\n"; - - // Never send mass mailing - print '' . "\n"; - - // Contact Date Create - print '' . "\n"; - - // Contact update Create - print '' . "\n"; - - if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { - // Customer Categories - print '' . "\n"; - } - - // Standard Extrafield feature - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - $elementype=Contact::$table_element; - // fetch optionals attributes and labels - dol_include_once('/core/class/extrafields.class.php'); - $extrafields = new ExtraFields($db); - $extrafields->fetch_name_optionals_label($elementype); - foreach($extrafields->attributes[$elementtype]['type'] as $key=>&$value) { - if($value == 'radio')$value = 'select'; - } - - foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) - { - print '' . "\n"; } + } +} else { + $std_soc = new Societe($db); + $action_search = 'query'; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '
' . "\n"; +print '
' . "\n"; - print '' . "\n"; +print '' . "\n"; - print '
' . $langs->trans('AdvTgtNameTemplate') . ''; - if (! empty($template_id)) { - $default_template = $template_id; - } else { - $default_template = $advTarget->id; - } - print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template, 0, $advTarget->type_element); - print ''; - print ''; - print ''; - print $langs->trans('AdvTgtOrCreateNewFilter'); - print ''; - print ''; - print '' . "\n"; - print '
' . $langs->trans('AdvTgtNameTemplate') . ''; +if (! empty($template_id)) { + $default_template = $template_id; +} else { + $default_template = $advTarget->id; +} +print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template, 0, $advTarget->type_element); +print ''; +print ''; +print ''; +print $langs->trans('AdvTgtOrCreateNewFilter'); +print ''; +print ''; +print '' . "\n"; +print '
' . $langs->trans('AdvTgtTypeOfIncude') . ''; - print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']); - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help'); - print '
' . $langs->trans('AdvTgtTypeOfIncude') . ''; +print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']); +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help'); +print '
' . $langs->trans('ThirdPartyName'); - if (! empty($array_query['cust_name'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('ThirdPartyName'); +if (! empty($array_query['cust_name'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); +print '
' . $langs->trans('CustomerCode'); - if (! empty($array_query['cust_code'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('CustomerCode'); +if (! empty($array_query['cust_code'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); +print '
' . $langs->trans('Address'); - if (! empty($array_query['cust_adress'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Address'); +if (! empty($array_query['cust_adress'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); +print '
' . $langs->trans('Zip'); - if (! empty($array_query['cust_zip'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Zip'); +if (! empty($array_query['cust_zip'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); +print '
' . $langs->trans('Town'); - if (! empty($array_query['cust_city'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Town'); +if (! empty($array_query['cust_city'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); +print '
' . $langs->trans("Country"); - if (count($array_query['cust_country']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']); - print '' . "\n"; - print '
' . $langs->trans("Country"); +if (count($array_query['cust_country']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']); +print '' . "\n"; +print '
' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty'); - if (count($array_query['cust_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray( - 'cust_status', array ( - '0' => $langs->trans('ActivityCeased'), - '1' => $langs->trans('InActivity') - ), - $array_query['cust_status'] - ); - print '' . "\n"; - print '
' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty'); +if (count($array_query['cust_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print ''; +print $formadvtargetemaling->advMultiselectarray( + 'cust_status', array ( + '0' => $langs->trans('ActivityCeased'), + '1' => $langs->trans('InActivity') + ), + $array_query['cust_status'] +); +print '' . "\n"; +print '
' . $langs->trans("Maison mère"); - if (! empty($array_query['cust_mothercompany'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print ''; - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans("Maison mère"); +if (! empty($array_query['cust_mothercompany'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print ''; +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); +print '
' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty'); - if (count($array_query['cust_typecust']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - $options_array = array ( - 2 => $langs->trans('Prospect'), - 3 => $langs->trans('ProspectCustomer'), - 1 => $langs->trans('Customer'), - 0 => $langs->trans('NorProspectNorCustomer') - ); - print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']); - print '' . "\n"; - print '
' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty'); +if (count($array_query['cust_typecust']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print ''; +$options_array = array ( + 2 => $langs->trans('Prospect'), + 3 => $langs->trans('ProspectCustomer'), + 1 => $langs->trans('Customer'), + 0 => $langs->trans('NorProspectNorCustomer') +); +print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']); +print '' . "\n"; +print '
' . $langs->trans('ProspectLevel'); - if (count($array_query['cust_prospect_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1); - print '' . "\n"; - print '
' . $langs->trans('ProspectLevel'); +if (count($array_query['cust_prospect_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print ''; +print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1); +print '' . "\n"; +print '
' . $langs->trans('StatusProsp'); - if (count($array_query['cust_comm_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']); - print '' . "\n"; - print '
' . $langs->trans('StatusProsp'); +if (count($array_query['cust_comm_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print ''; +print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']); +print '' . "\n"; +print '
' . $langs->trans("ThirdPartyType"); - if (count($array_query['cust_typeent']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']); - print '' . "\n"; - print '
' . $langs->trans("ThirdPartyType"); +if (count($array_query['cust_typeent']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']); +print '' . "\n"; +print '
' . $langs->trans("Staff"); - if (count($array_query['cust_effectif_id']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']); - print '' . "\n"; - print '
' . $langs->trans("Staff"); +if (count($array_query['cust_effectif_id']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print ''; +print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']); +print '' . "\n"; +print '
' . $langs->trans("SalesRepresentatives"); - if (count($array_query['cust_saleman']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user); - print '' . "\n"; - print '
' . $langs->trans("SalesRepresentatives"); +if (count($array_query['cust_saleman']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user); +print '' . "\n"; +print '
' . $langs->trans("DefaultLang"); - if (count($array_query['cust_language']) > 0) { +// Customer Default Langauge +if (! empty($conf->global->MAIN_MULTILANGS)) { + print '
' . $langs->trans("DefaultLang"); + if (count($array_query['cust_language']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']); + print '' . "\n"; + print '
' . $langs->trans("CustomersCategoryShort"); + if (count($array_query['cust_categ']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']); + print '' . "\n"; + print '
' . $extrafields->attributes[$elementtype]['label'][$key]; + if (! empty($array_query['options_' . $key]) || (is_array($array_query['options_' . $key]) && count($array_query['options_' . $key]) > 0)) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } - print '' . "\n"; - print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']); - print '' . "\n"; - print '
'; + if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) { + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) { + print $langs->trans("AdvTgtMinVal") . ''; + print $langs->trans("AdvTgtMaxVal") . ''; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) { + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->selectDate('', 'options_' . $key . '_st_dt'); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->selectDate('', 'options_' . $key . '_end_dt'); + print '
'; - if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { - // Customer Categories - print '
' . $langs->trans("CustomersCategoryShort"); - if (count($array_query['cust_categ']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']); - print '' . "\n"; - print '
' . $extrafields->attributes[$elementtype]['label'][$key]; - if (! empty($array_query['options_' . $key]) || (is_array($array_query['options_' . $key]) && count($array_query['options_' . $key]) > 0)) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) { - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) { - print $langs->trans("AdvTgtMinVal") . ''; - print $langs->trans("AdvTgtMaxVal") . ''; - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) { - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->selectDate('', 'options_' . $key . '_st_dt'); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->selectDate('', 'options_' . $key . '_end_dt'); - print '
'; - - print '
' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'boolean')) { - print $form->selectarray( - 'options_' . $key, - array ( - '' => '', - '1' => $langs->trans('Yes'), - '0' => $langs->trans('No') - ), - $array_query['options_' . $key] - ); - print '' . "\n"; - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) { - print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); - print '' . "\n"; - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) { - print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); - print '' . "\n"; - } else { - print ''; - print '
'; - if (is_array($array_query['options_' . $key])) { - print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key])); - } else { - print $extrafields->showInputField($key, $array_query['options_' . $key]); - } - print '
'; - - print '
' . "\n"; - } - print '
' . $langs->trans('Status') . ' ' . $langs->trans('Contact'); - if (count($array_query['contact_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray( - 'contact_status', - array ( - '0' => $langs->trans('ActivityCeased'), - '1' => $langs->trans('InActivity') - ), - $array_query['contact_status'] - ); - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help'); - print '
' . $langs->trans("UserTitle"); - if (count($array_query['contact_civility']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']); - print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname'); - if (! empty($array_query['contact_lastname'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname'); - if (! empty($array_query['contact_firstname'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("Country"); - if (count($array_query['contact_country']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']); - print '' . "\n"; - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email"); - if (! empty($array_query['contact_no_email'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->selectarray( - 'contact_no_email', - array ( - '' => '', - '1' => $langs->trans('Yes'), - '0' => $langs->trans('No') - ), - $array_query['contact_no_email'] - ); - print '' . "\n"; - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation"); - if (! empty($array_query['contact_create_st_dt'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->selectDate($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->selectDate($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1); - print '
'; - print '
' . "\n"; - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification"); - if (! empty($array_query['contact_update_st_dt'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->selectDate($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->selectDate($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1); - print '
'; - print '
' . "\n"; - print '
' . $langs->trans("ContactCategoriesShort"); - if (count($array_query['contact_categ']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']); - print '' . "\n"; - print '
' . $extrafields->attributes[$elementtype]['label'][$key]; - if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) { - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) { - print $langs->trans("AdvTgtMinVal") . ''; - print $langs->trans("AdvTgtMaxVal") . ''; - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) { - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->selectDate('', 'options_' . $key . '_st_dt' . '_cnct'); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->selectDate('', 'options_' . $key . '_end_dt' . '_cnct'); - print '
'; - - print '
' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'boolean')) { - print $form->selectarray( - 'options_' . $key . '_cnct', - array ( - '' => '', - '1' => $langs->trans('Yes'), - '0' => $langs->trans('No') - ), - $array_query['options_' . $key . '_cnct'] - ); - print '' . "\n"; - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) { - print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); - print '' . "\n"; - } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) { - print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); - print '' . "\n"; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'boolean')) { + print $form->selectarray( + 'options_' . $key, + array ( + '' => '', + '1' => $langs->trans('Yes'), + '0' => $langs->trans('No') + ), + $array_query['options_' . $key] + ); + print '' . "\n"; + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) { + print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); + print '' . "\n"; + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) { + print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); + print '' . "\n"; + } else { + print ''; + print '' . "\n"; + print '
'; + if (is_array($array_query['options_' . $key])) { + print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key])); } else { - print ''; - print '
'; - if (is_array($array_query['options_' . $key . '_cnct'])) { - print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct'); - } else { - print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct'); - } - print '
'; - - print '
' . "\n"; + print $extrafields->showInputField($key, $array_query['options_' . $key]); } - print '
'; + + print '
' . "\n"; } + print '
' . "\n"; + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context + include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($db); + $hookmanager->initHooks(array ('thirdpartycard')); - print '' . "\n"; + $parameters=array(); + if (! empty($advTarget->id)) { + $parameters = array('array_query' => $advTarget->filtervalue); + } + // Other attributes + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search); + print $hookmanager->resPrint; +} - print '
' . "\n"; - print '
' . "\n"; - print '
' . "\n"; +// State Contact +print '' . $langs->trans('Status') . ' ' . $langs->trans('Contact'); +if (count($array_query['contact_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print ''; +print $formadvtargetemaling->advMultiselectarray( + 'contact_status', + array ( + '0' => $langs->trans('ActivityCeased'), + '1' => $langs->trans('InActivity') + ), + $array_query['contact_status'] +); +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help'); +print '' . "\n"; - print '
'; - print ''; - print load_fiche_titre($langs->trans("ToClearAllRecipientsClickHere")); - print ''; - print ''; - print ''; - print ''; - print '
'; - print '
'; - print '
'; +// Civility +print '' . $langs->trans("UserTitle"); +if (count($array_query['contact_civility']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print ''; +print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']); +print ''; + +// contact name +print '' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname'); +if (! empty($array_query['contact_lastname'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); +print '' . "\n"; +print '' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname'); +if (! empty($array_query['contact_firstname'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); +print '' . "\n"; + +// Contact Country +print '' . $langs->trans('Contact') . ' ' . $langs->trans("Country"); +if (count($array_query['contact_country']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']); +print '' . "\n"; +print '' . "\n"; + +// Never send mass mailing +print '' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email"); +if (! empty($array_query['contact_no_email'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print $form->selectarray( + 'contact_no_email', + array ( + '' => '', + '1' => $langs->trans('Yes'), + '0' => $langs->trans('No') + ), + $array_query['contact_no_email'] +); +print '' . "\n"; +print '' . "\n"; + +// Contact Date Create +print '' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation"); +if (! empty($array_query['contact_create_st_dt'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print ''; +print '
' . $langs->trans("AdvTgtStartDt") . ''; +print $form->selectDate($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1); +print '' . $langs->trans("AdvTgtEndDt") . ''; +print $form->selectDate($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1); +print '
'; +print '' . "\n"; +print '' . "\n"; + +// Contact update Create +print '' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification"); +if (! empty($array_query['contact_update_st_dt'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); +} +print '' . "\n"; +print ''; +print '
' . $langs->trans("AdvTgtStartDt") . ''; +print $form->selectDate($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1); +print '' . $langs->trans("AdvTgtEndDt") . ''; +print $form->selectDate($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1); +print '
'; +print '' . "\n"; +print '' . "\n"; + +if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + // Customer Categories + print '' . $langs->trans("ContactCategoriesShort"); + if (count($array_query['contact_categ']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']); + print '' . "\n"; + print '' . "\n"; +} + +// Standard Extrafield feature +if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + $elementype=Contact::$table_element; + // fetch optionals attributes and labels + dol_include_once('/core/class/extrafields.class.php'); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label($elementype); + foreach($extrafields->attributes[$elementtype]['type'] as $key=>&$value) { + if($value == 'radio')$value = 'select'; + } + + foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) { + print '' . $extrafields->attributes[$elementtype]['label'][$key]; + if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) { + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) { + print $langs->trans("AdvTgtMinVal") . ''; + print $langs->trans("AdvTgtMaxVal") . ''; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) { + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->selectDate('', 'options_' . $key . '_st_dt' . '_cnct'); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->selectDate('', 'options_' . $key . '_end_dt' . '_cnct'); + print '
'; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'boolean')) { + print $form->selectarray( + 'options_' . $key . '_cnct', + array ( + '' => '', + '1' => $langs->trans('Yes'), + '0' => $langs->trans('No') + ), + $array_query['options_' . $key . '_cnct'] + ); + print '' . "\n"; + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) { + print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); + print '' . "\n"; + } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) { + print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); + print '' . "\n"; + } else { + print ''; + print '
'; + if (is_array($array_query['options_' . $key . '_cnct'])) { + print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct'); + } else { + print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct'); + } + print '
'; + print '' . "\n"; + } + print '' . "\n"; + } +} +print '' . "\n"; +print '' . "\n"; +print '' . "\n"; +print '' . "\n"; +print '' . "\n"; +print '' . "\n"; +print '' . "\n"; +print '' . "\n"; +print '
'; +print ''; +print load_fiche_titre($langs->trans("ToClearAllRecipientsClickHere")); +print ''; +print ''; +print ''; +print ''; +print '
'; +print '
'; +print '
'; diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index ca2cd9e1fd7..821881314d3 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -67,7 +67,7 @@ $userstatic=new User($db); + ?>
trans("NatureOfContact"); ?>
trans("ThirdParty"); ?>
@@ -81,13 +81,13 @@ if ($permission) { if (empty($hideaddcontactforuser)) { - ?> + ?> " /> - '; ?> + '; ?>
trans("Users"); ?>
global->MAIN_INFO_SOCIETE_NOM; ?>
select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56, '', 0, '', 'minwidth200imp'); ?>
@@ -101,19 +101,19 @@ if ($permission) {
">
- + ?>
" /> - '; ?> + '; ?>
trans("ThirdPartyContacts"); ?>
socid; ?> @@ -141,7 +141,7 @@ if ($permission) {
- @@ -155,21 +155,21 @@ if ($permission) {
 
- element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; +$arrayofsource=array('internal','external'); // Show both link to user and thirdparties contacts +foreach($arrayofsource as $source) { + $tmpobject=$object; + if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc; - $tab = $tmpobject->liste_contact(-1, $source); - $num=count($tab); + $tab = $tmpobject->liste_contact(-1, $source); + $num=count($tab); - $i = 0; - while ($i < $num) { - $var = ! $var; - ?> + $i = 0; + while ($i < $num) { + $var = ! $var; + ?>
@@ -177,75 +177,68 @@ if ($permission) { trans("ThirdPartyContact"); ?>
- 0) - { - $companystatic->fetch($tab[$i]['socid']); - echo $companystatic->getNomUrl(1); - } - if ($tab[$i]['socid'] < 0) - { - echo $conf->global->MAIN_INFO_SOCIETE_NOM; - } - if (! $tab[$i]['socid']) - { - echo ' '; - } - ?> + 0) + { + $companystatic->fetch($tab[$i]['socid']); + echo $companystatic->getNomUrl(1); + } + if ($tab[$i]['socid'] < 0) + { + echo $conf->global->MAIN_INFO_SOCIETE_NOM; + } + if (! $tab[$i]['socid']) + { + echo ' '; + } + ?>
- fetch($tab[$i]['id']); - echo $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); - } - if ($tab[$i]['source']=='external') - { - $contactstatic->fetch($tab[$i]['id']); - echo $contactstatic->getNomUrl(1, '', 0, '', 0, 0); - } - ?> + if ($tab[$i]['source']=='internal') + { + $userstatic->fetch($tab[$i]['id']); + echo $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle'); + } + if ($tab[$i]['source']=='external') + { + $contactstatic->fetch($tab[$i]['id']); + echo $contactstatic->getNomUrl(1, '', 0, '', 0, 0); + } + ?>
- - +} - - - -initHooks(array('contacttpl')); - $parameters=array(); - $reshook=$hookmanager->executeHooks('formContactTpl', $parameters, $object, $action); - } -?> - +print "\n"; +print "\n"; +print "\n"; +if (is_object($hookmanager)) { + $hookmanager->initHooks(array('contacttpl')); + $parameters=array(); + $reshook=$hookmanager->executeHooks('formContactTpl', $parameters, $object, $action); +} +print "\n"; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 2a0fe46dfdd..ba0c550debc 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -63,19 +63,17 @@ if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_ $colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1):(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' -?> - +print "\n"; -global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { // For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random' -?> + ?> - + ?> global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file=logos/'.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> - @@ -179,7 +177,7 @@ if ($captcha) { if (preg_match('/\?/', $php_self)) $php_self.='&time='.dol_print_date(dol_now(), 'dayhourlog'); else $php_self.='?time='.dol_print_date(dol_now(), 'dayhourlog'); // TODO: provide accessible captcha variants -?> + ?>
@@ -279,11 +277,11 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->fil // Show error message if defined if (! empty($_SESSION['dol_loginmesg'])) { -?> + ?> -global->MAIN_EASTER_EGG_COMMITSTRIP)) { + ?>
- @@ -362,7 +360,7 @@ if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLI { if (empty($conf->dol_use_jmobile)) { -?> + ?>

-
-
+ diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index cb8138eedae..73d86fa56a5 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -90,13 +90,11 @@ if (!empty($extrafields)) } } -?> - -\n"; $nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); if ($nolinesbefore) { -?> + ?> global->MAIN_VIEW_LINE_NUMBER)) { ?> @@ -107,9 +105,9 @@ if ($nolinesbefore) { element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines { - ?> + ?> trans('SupplierRef'); ?> - trans('VAT'); ?> @@ -156,109 +154,109 @@ if ($nolinesbefore) { ?>   - global->MAIN_VIEW_LINE_NUMBER)) { - $coldisplay++; - echo ''; - } +$coldisplay=0; +// Adds a line numbering column +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay++; - ?> + echo ''; +} + +$coldisplay++; +?> - global->MAIN_DISABLE_FREE_LINES)) +$freelines = false; +if (empty($conf->global->MAIN_DISABLE_FREE_LINES)) +{ + $freelines = true; + $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) + if ($object->element == 'contrat') { - $freelines = true; - $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) - if ($object->element == 'contrat') - { - if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set - elseif (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=3; - } - - // Free line - echo ''; - // Show radio free line - if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) - { - echo ''; - echo ' '; - } - else - { - echo ''; - // Show type selector - if ($forceall >= 0) - { - if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type"); - else echo $langs->trans("FreeLineOfType"); - echo ' '; - } - } - - echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type", 'alpha', 2):-1, 'type', 1, 1, $forceall); - - echo ''; + if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set + elseif (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=3; } - // Predefined product/service - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) + // Free line + echo ''; + // Show radio free line + if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) { - if ($forceall >= 0 && $freelines) echo '
'; - echo ''; - echo ''; +} + +// Predefined product/service +if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) +{ + if ($forceall >= 0 && $freelines) echo '
'; + echo ''; + echo ''; + echo ' '; + + $filtertype=''; + if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; + + if (empty($senderissupplier)) + { + $statustoshow = 1; + if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) + { + // hide products in closed warehouse, but show products for internal transfer + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } else { - if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToPurchase'); - elseif (empty($conf->product->enabled) && ! empty($conf->service->enabled)) echo $langs->trans('PredefinedServicesToPurchase'); - else echo $langs->trans('PredefinedProductsAndServicesToPurchase'); + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array')); } - echo ''; - echo ' '; - $filtertype=''; - if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; - - if (empty($senderissupplier)) + if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS)) { - $statustoshow = 1; - if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) - { - // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); - } - else - { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array')); - } - - if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS)) - { - ?> + ?> - array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key - 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done - 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo) - ); - $alsoproductwithnosupplierprice=0; - } - else - { - $ajaxoptions = array( - 'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key - ); - $alsoproductwithnosupplierprice=1; - } + array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key + 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done + 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo) + ); + $alsoproductwithnosupplierprice=0; + } + else + { + $ajaxoptions = array( + 'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key + ); + $alsoproductwithnosupplierprice=1; + } - $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice, 'maxwidth300'); + $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice, 'maxwidth300'); - if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_SUPPLIER_PRODUCTS)) - { - ?> + if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_SUPPLIER_PRODUCTS)) + { + ?> - '; - echo ''; + '; + echo '
'; +} + +if (is_object($hookmanager) && empty($senderissupplier)) +{ + $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line', 'int')); + $reshook=$hookmanager->executeHooks('formCreateProductOptions', $parameters, $object, $action); + if (!empty($hookmanager->resPrint)) { + print $hookmanager->resPrint; + } +} +if (is_object($hookmanager) && ! empty($senderissupplier)) +{ + $parameters=array('htmlname'=>'addproduct'); + $reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions', $parameters, $object, $action); + if (!empty($hookmanager->resPrint)) { + print $hookmanager->resPrint; + } +} + + +if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { + if (!empty($conf->variants->enabled)) { + echo '
'; } - if (is_object($hookmanager) && empty($senderissupplier)) - { - $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line', 'int')); - $reshook=$hookmanager->executeHooks('formCreateProductOptions', $parameters, $object, $action); - if (!empty($hookmanager->resPrint)) { - print $hookmanager->resPrint; - } - } - if (is_object($hookmanager) && ! empty($senderissupplier)) - { - $parameters=array('htmlname'=>'addproduct'); - $reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions', $parameters, $object, $action); - if (!empty($hookmanager->resPrint)) { - print $hookmanager->resPrint; - } - } + echo '
'; +} +// Editor wysiwyg +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +$nbrows=ROWS_2; +$enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); +if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; +$toolbarname='dolibarr_details'; +if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; +$doleditor=new DolEditor('dp_desc', GETPOST('dp_desc', 'none'), '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?100:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enabled, $nbrows, '98%'); +$doleditor->Create(); - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { - if (!empty($conf->variants->enabled)) { - echo '
'; - } +// Show autofill date for recurring invoices +if (! empty($conf->service->enabled) && $object->element == 'facturerec') +{ + echo '

'; + echo $langs->trans('AutoFillDateFrom').' '; + echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1); + echo ' - '; + echo $langs->trans('AutoFillDateTo').' '; + echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); + echo '
'; +} +echo ''; - echo '
'; - } - - // Editor wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $nbrows=ROWS_2; - $enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - $toolbarname='dolibarr_details'; - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; - $doleditor=new DolEditor('dp_desc', GETPOST('dp_desc', 'none'), '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?100:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enabled, $nbrows, '98%'); - $doleditor->Create(); - - // Show autofill date for recurring invoices - if (! empty($conf->service->enabled) && $object->element == 'facturerec') - { - echo '

'; - echo $langs->trans('AutoFillDateFrom').' '; - echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1); - echo ' - '; - echo $langs->trans('AutoFillDateTo').' '; - echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); - echo '
'; - } - echo ''; - - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines - { - $coldisplay++; - ?> - "> - - - element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines +{ $coldisplay++; - if ($seller->tva_assuj == "0") echo ''.vatrate(0, true); - else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx", 'alpha', 2):-1), $seller, $buyer, 0, 0, '', false, 1); - ?> + ?> + "> +'; +$coldisplay++; +if ($seller->tva_assuj == "0") echo ''.vatrate(0, true); +else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx", 'alpha', 2):-1), $seller, $buyer, 0, 0, '', false, 1); +?> "> - multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { - $coldisplay++; +multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + $coldisplay++; ?> "> - + "> - +$coldisplay++; +?> "> - global->PRODUCT_USE_UNITS) - { - $coldisplay++; - print ''; - print $form->selectUnits($line->fk_unit, "units"); - print ''; - } - $remise_percent = $buyer->remise_percent; - if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') - { - $remise_percent = $seller->remise_supplier_percent; - } +global->PRODUCT_USE_UNITS) +{ + $coldisplay++; + print ''; + print $form->selectUnits($line->fk_unit, "units"); + print ''; +} +$remise_percent = $buyer->remise_percent; +if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') +{ + $remise_percent = $seller->remise_supplier_percent; +} - $coldisplay++; - ?> +$coldisplay++; +?> ">% - situation_cycle_ref) { - $coldisplay++; - print '%'; - $coldisplay++; - print ''; - } +if ($this->situation_cycle_ref) { + $coldisplay++; + print '%'; + $coldisplay++; + print ''; +} - if (! empty($usemargins)) - { - if (!empty($user->rights->margins->creer)) { - $coldisplay++; - ?> +if (! empty($usemargins)) +{ + if (!empty($user->rights->margins->creer)) { + $coldisplay++; + ?> - product->enabled) || ! empty($conf->service->enabled)) { ?> + product->enabled) || ! empty($conf->service->enabled)) { ?> - + "> - global->DISPLAY_MARGIN_RATES)) - { - echo '%'; - $coldisplay++; - } - if (! empty($conf->global->DISPLAY_MARK_RATES)) - { - echo '%'; - $coldisplay++; - } + global->DISPLAY_MARGIN_RATES)) + { + echo '%'; + $coldisplay++; + } + if (! empty($conf->global->DISPLAY_MARK_RATES)) + { + echo '%'; + $coldisplay++; } } +} - $coldisplay+=$colspan; - ?> +$coldisplay+=$colspan; +?> @@ -512,37 +510,33 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");'; } } - print '' - ?> - - -'; + print ''; + print "\n"; } -?> - - '; if ($companystatic->fk_parent > 0) { - $companyparent->fetch($companystatic->fk_parent); - print $companyparent->getNomUrl(1); + $companyparent->fetch($companystatic->fk_parent); + print $companyparent->getNomUrl(1); } print ""; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 6cb1b4abbbe..df803b180ab 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -564,13 +564,13 @@ if (empty($reshook)) $db->begin(); - if (empty($newcu)) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; - } else { - $sql = 'UPDATE '.MAIN_DB_PREFIX."societe_account"; - $sql.= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."'"; - $sql.= " WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! - } + if (empty($newcu)) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; + } else { + $sql = 'UPDATE '.MAIN_DB_PREFIX."societe_account"; + $sql.= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."'"; + $sql.= " WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! + } $resql = $db->query($sql); $num = $db->num_rows($resql); @@ -609,37 +609,33 @@ if (empty($reshook)) $db->begin(); - if (empty($newsup)) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; - } else { - try { - $stripesup = \Stripe\Account::retrieve($db->escape(GETPOST('key_account_supplier', 'alpha'))); - $tokenstring['stripe_user_id'] = $stripesup->id; - $tokenstring['type'] = $stripesup->type; - $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token"; - $sql.= " SET tokenstring = '".dol_json_encode($tokenstring)."'"; - $sql.= " WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! - } - catch(Exception $e) - { - $error++; - setEventMessages($e->getMessage(), null, 'errors'); - } + if (empty($newsup)) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; + } else { + try { + $stripesup = \Stripe\Account::retrieve($db->escape(GETPOST('key_account_supplier', 'alpha'))); + $tokenstring['stripe_user_id'] = $stripesup->id; + $tokenstring['type'] = $stripesup->type; + $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token"; + $sql.= " SET tokenstring = '".dol_json_encode($tokenstring)."'"; + $sql.= " WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! + } catch(Exception $e) { + $error++; + setEventMessages($e->getMessage(), null, 'errors'); } + } $resql = $db->query($sql); $num = $db->num_rows($resql); if (empty($num) && !empty($newsup)) { - try { - $stripesup = \Stripe\Account::retrieve($db->escape(GETPOST('key_account_supplier', 'alpha'))); - $tokenstring['stripe_user_id'] = $stripesup->id; - $tokenstring['type'] = $stripesup->type; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, fk_soc, entity, tokenstring)"; - $sql .= " VALUES ('".$service."', ".$object->id.", ".$conf->entity.", '".dol_json_encode($tokenstring)."')"; - } - catch(Exception $e) - { + try { + $stripesup = \Stripe\Account::retrieve($db->escape(GETPOST('key_account_supplier', 'alpha'))); + $tokenstring['stripe_user_id'] = $stripesup->id; + $tokenstring['type'] = $stripesup->type; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, fk_soc, entity, tokenstring)"; + $sql .= " VALUES ('".$service."', ".$object->id.", ".$conf->entity.", '".dol_json_encode($tokenstring)."')"; + } catch(Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); } @@ -700,23 +696,25 @@ if (empty($reshook)) { try { if (preg_match('/pm_/', $source)) - { - $payment_method = \Stripe\PaymentMethod::retrieve($source, array("stripe_account" => $stripeacc)); - if ($payment_method) - { - $payment_method->detach(); + { + $payment_method = \Stripe\PaymentMethod::retrieve($source, array("stripe_account" => $stripeacc)); + if ($payment_method) + { + $payment_method->detach(); } } else { - $cu=$stripe->customerStripe($object, $stripeacc, $servicestatus); - $card=$cu->sources->retrieve("$source"); - if ($card) - { - // $card->detach(); Does not work with card_, only with src_ - if (method_exists($card, 'detach')) $card->detach(); - else $card->delete(); - } + $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); + $card = $cu->sources->retrieve("$source"); + if ($card) { + // $card->detach(); Does not work with card_, only with src_ + if (method_exists($card, 'detach')) { + $card->detach(); + } else { + $card->delete(); + } + } } $url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; @@ -1296,54 +1294,60 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } print ""; print ""; - print '
'; + print '
'; } // List of Stripe payment modes if (! empty($conf->stripe->enabled) && ! empty($conf->stripeconnect->enabled) && $object->fournisseur && ! empty($stripesupplieracc)) { - print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc?' (Stripe connection with StripeConnect account '.$stripesupplieracc.')':' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); - $balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc)); + print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc?' (Stripe connection with StripeConnect account '.$stripesupplieracc.')':' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); + $balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc)); print ''."\n"; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; - $currencybalance = array(); + $currencybalance = array(); if (is_array($balance->available) && count($balance->available)) { foreach ($balance->available as $cpt) { - $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); - if (! in_array($cpt->currency, $arrayzerounitcurrency)) $currencybalance[$cpt->currency]->available=$cpt->amount / 100; - else $currencybalance[$cpt->currency]->available=$cpt->amount; - $currencybalance[$cpt->currency]->currency=$cpt->currency; + $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); + if (! in_array($cpt->currency, $arrayzerounitcurrency)) { + $currencybalance[$cpt->currency]->available=$cpt->amount / 100; + } else { + $currencybalance[$cpt->currency]->available=$cpt->amount; + } + $currencybalance[$cpt->currency]->currency=$cpt->currency; } } - if (is_array($balance->pending) && count($balance->pending)) + if (is_array($balance->pending) && count($balance->pending)) { foreach ($balance->pending as $cpt) { - $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); - if (! in_array($cpt->currency, $arrayzerounitcurrency)) $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount / 100; - else $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount; + $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); + if (! in_array($cpt->currency, $arrayzerounitcurrency)) { + $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount / 100; + } else { + $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount; + } } - } + } if (is_array($currencybalance)) { foreach ($currencybalance as $cpt) { - print ''; + print ''; } } - print '
'.$langs->trans('Currency').''.$langs->trans('Available').''.$langs->trans('Pending').''.$langs->trans('Total').'
'.$langs->trans('Total').'
'.$langs->trans("Currency".strtoupper($cpt->currency)).''.price($cpt->available, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->available+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'
'.$langs->trans("Currency".strtoupper($cpt->currency)).''.price($cpt->available, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->available+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'
'; - print '
'; + print ''; + print '
'; } // List of bank accounts @@ -1394,12 +1398,13 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $string .= $rib->code_guichet.' '; } elseif ($val == 'BankAccountNumberKey') { $string .= $rib->cle_rib.' '; - /* Already output after - }elseif ($val == 'BIC') { - $string .= $rib->bic.' '; - }elseif ($val == 'IBAN') { - $string .= $rib->iban.' ';*/ } + // Already output after + // } elseif ($val == 'BIC') { + // $string .= $rib->bic.' '; + // } elseif ($val == 'IBAN') { + // $string .= $rib->iban.' ';*/ + //} } if (! empty($rib->label) && $rib->number) { if (! checkBanForAccount($rib)) { diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 05d8937f293..e101a40ffbf 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -177,12 +177,12 @@ print "\n"; print ''; print ''; print $langs->trans("StripeLiveEnabled").''; - if ($conf->use_javascript_ajax) { +if ($conf->use_javascript_ajax) { print ajax_constantonoff('STRIPE_LIVE'); - } else { +} else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STRIPE_LIVE", $arrval, $conf->global->STRIPE_LIVE); - } +} print ''; if (empty($conf->stripeconnect->enabled)) @@ -203,7 +203,7 @@ if (empty($conf->stripeconnect->enabled)) print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ''; - print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; + print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; } print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; @@ -239,7 +239,7 @@ if (empty($conf->stripeconnect->enabled)) print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } - //print $endpoint; + //print $endpoint; } else { @@ -275,8 +275,8 @@ if (empty($conf->stripeconnect->enabled)) print ''; print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - print ''; - print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; + print ''; + print '   '.$langs->trans("Example").': we_xxxxxxxxxxxxxxxxxxxxxxxx
'; } print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; @@ -312,7 +312,7 @@ if (empty($conf->stripeconnect->enabled)) print '
'; print img_picto($langs->trans("Disabled"), 'switch_off'); } - //print $endpoint; + //print $endpoint; } else { @@ -366,14 +366,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ? // Activate Payment Request API if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code { - print ''; + print ''; print $langs->trans("STRIPE_PAYMENT_REQUEST_API").''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STRIPE_PAYMENT_REQUEST_API'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API); - } + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_PAYMENT_REQUEST_API'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API); + } print ''; } @@ -382,12 +382,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code { print ''; print $langs->trans("STRIPE_SEPA_DIRECT_DEBIT").''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STRIPE_SEPA_DIRECT_DEBIT'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STRIPE_SEPA_DIRECT_DEBIT", $arrval, $conf->global->STRIPE_SEPA_DIRECT_DEBIT); - } + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_SEPA_DIRECT_DEBIT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_SEPA_DIRECT_DEBIT", $arrval, $conf->global->STRIPE_SEPA_DIRECT_DEBIT); + } print ''; } diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 99abc1fd510..a9e417aa581 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2019 Frédéric France * * 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 @@ -121,29 +122,28 @@ if (!$rowid) //print $list; foreach ($list->data as $charge) { - if ($charge->refunded=='1'){ + if ($charge->refunded=='1') { $status = img_picto($langs->trans("refunded"), 'statut6'); - } elseif ($charge->paid=='1'){ - $status = img_picto($langs->trans("".$charge->status.""), 'statut4'); - } else { + } elseif ($charge->paid=='1') { + $status = img_picto($langs->trans("".$charge->status.""), 'statut4'); + } else { $label="Message: ".$charge->failure_message."
"; $label.="Réseau: ".$charge->outcome->network_status."
"; $label.="Statut: ".$langs->trans("".$charge->outcome->seller_message.""); $status = $form->textwithpicto(img_picto($langs->trans("".$charge->status.""), 'statut8'), $label, 1); - } + } - if ($charge->payment_method_details->type=='card') - { + if ($charge->payment_method_details->type=='card') { $type = $langs->trans("card"); - } elseif ($charge->source->type=='card'){ + } elseif ($charge->source->type=='card'){ $type = $langs->trans("card"); - } elseif ($charge->payment_method_details->type=='three_d_secure'){ + } elseif ($charge->payment_method_details->type=='three_d_secure'){ $type = $langs->trans("card3DS"); - } + } - if (! empty($charge->payment_intent)) { - $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent); - } + if (! empty($charge->payment_intent)) { + $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent); + } // The metadata FULLTAG is defined by the online payment page $FULLTAG=$charge->metadata->FULLTAG; @@ -211,19 +211,25 @@ if (!$rowid) print "\n"; // Origine print ""; - if ($charge->metadata->dol_type=="order"){ + if ($charge->metadata->dol_type=="order") { $object = new Commande($db); $object->fetch($charge->metadata->dol_id); - if ($object->id > 0) { - print "
".img_picto('', 'object_order')." ".$object->ref.""; - } else print $FULLTAG; - } elseif ($charge->metadata->dol_type=="invoice"){ + if ($object->id > 0) { + print "".img_picto('', 'object_order')." ".$object->ref.""; + } else { + print $FULLTAG; + } + } elseif ($charge->metadata->dol_type=="invoice") { $object = new Facture($db); $object->fetch($charge->metadata->dol_id); - if ($object->id > 0) { - print "".img_picto('', 'object_invoice')." ".$object->ref.""; - } else print $FULLTAG; - } else print $FULLTAG; + if ($object->id > 0) { + print "".img_picto('', 'object_invoice')." ".$object->ref.""; + } else { + print $FULLTAG; + } + } else { + print $FULLTAG; + } print "\n"; // Date payment print ''.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."\n"; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 593447919a7..021a9fac1f9 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -62,6 +62,9 @@ class Stripe extends CommonObject public $code; public $declinecode; + /** + * @var string Message + */ public $message; /** @@ -338,8 +341,11 @@ class Stripe extends CommonObject } elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { $fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL; } - if (! in_array($currency_code, $arrayzerounitcurrency)) $stripefee = round($fee * 100); - else $stripefee = round($fee); + if (! in_array($currency_code, $arrayzerounitcurrency)) { + $stripefee = round($fee * 100); + } else { + $stripefee = round($fee); + } $paymentintent = null; diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 45af7923fca..2614c8498f3 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -186,12 +186,12 @@ if (empty($reshook)) } } - // Check parameters -// if (! GETPOST('paiementcode')) -// { -// setEventMessages($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), null, 'errors'); -// $error++; -// } + // Check parameters + /*if (! GETPOST('paiementcode')) + { + setEventMessages($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), null, 'errors'); + $error++; + }*/ if (! empty($conf->banque->enabled)) { @@ -209,11 +209,11 @@ if (empty($reshook)) $error++; } -// if (empty($datepaye)) -// { -// setEventMessages($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), null, 'errors'); -// $error++; -// } + /*if (empty($datepaye)) + { + setEventMessages($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), null, 'errors'); + $error++; + }*/ // Check if payments in both currency if ($totalpayment > 0 && $multicurrency_totalpayment > 0)