diff --git a/.editorconfig b/.editorconfig index a40a586406f..3c4bd7d679d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,8 +7,12 @@ root = true charset = utf-8 end_of_line = lf insert_final_newline = true + +# PHP PSR-2 Coding Standards +# http://www.php-fig.org/psr/psr-2/ [*.php] indent_style = space +indent_size = 4 trim_trailing_whitespace = true [*.js] indent_style = tab diff --git a/ChangeLog b/ChangeLog index ff5b8cd9805..793d96519c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,26 @@ Following changes may create regressions for some external modules, but were nec +***** ChangeLog for 9.0.1 compared to 9.0.0 ***** +FIX: #10381 +FIX: #10460 compatibility with MariaDB 10.4 +FIX: #10485 +FIX: add fk_unit on addline action +FIX: better test on fetch +FIX: Default language of company is not set +FIX: error report not returned +FIX: expedition: reset status on rollback + replace hardcoded status with const +FIX: line edit template: keep fk_parent_line +FIX: Missing province in export of invoice +FIX: must fetch member in current entity +FIX: Price in combo list of service does not use the correct price level +FIX: supplier invoice payment total doesnt care about deposit or credit +FIX: supplier invoice product stats total ht is line total not invoice total +FIX: Translation not loaded by scheduled jobs +FIX: wrong merged conflict +FIX: wrong tests on fetch +NEW: Add protection to avoid packaging if files non indexed exists into + ***** ChangeLog for 9.0.0 compared to 8.0.0 ***** For Users: NEW: Stable module: DAV (WebDAV only for the moment) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index bbdfa564183..16b4f64a0d2 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -387,6 +387,15 @@ if ($nboftargetok) { #----------------------- if ($CHOOSEDTARGET{'-CHKSUM'}) { + $ret=`git ls-files . --exclude-standard --others`; + if ($ret) + { + print "Some files exists in source directory and are not indexed neither excluded in .gitignore.\n"; + print $ret; + print "Canceled.\n"; + exit; + } + print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filelist_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n"; $ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`; print $ret."\n"; diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index 3eca58ddc5a..1c9a4e259ca 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -20,8 +20,8 @@ */ /** - * \file dev/initdata/generate-order.php - * \brief Script example to inject random orders (for load tests) + * \file dev/initdata/generate-order.php + * \brief Script example to inject random orders (for load tests) */ // Test si mode batch @@ -113,13 +113,13 @@ $societesid = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe where client in (1, 3)"; $resql=$db->query($sql); if ($resql) { - $num_thirdparties = $db->num_rows($resql); - $i = 0; - while ($i < $num_thirdparties) { - $i++; - $row = $db->fetch_row($resql); - $societesid[$i] = $row[0]; - } + $num_thirdparties = $db->num_rows($resql); + $i = 0; + while ($i < $num_thirdparties) { + $i++; + $row = $db->fetch_row($resql); + $societesid[$i] = $row[0]; + } } else { print "err"; } @@ -127,35 +127,32 @@ $commandesid = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) { - $i++; - $row = $db->fetch_row($resql); - $commandesid[$i] = $row[0]; - } + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $i++; + $row = $db->fetch_row($resql); + $commandesid[$i] = $row[0]; + } } else { print "err"; } $prodids = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE tosell=1"; $resql = $db->query($sql); -if ($resql) -{ - $num_prods = $db->num_rows($resql); - $i = 0; - while ($i < $num_prods) - { - $i++; +if ($resql) { + $num_prods = $db->num_rows($resql); + $i = 0; + while ($i < $num_prods) { + $i++; - $row = $db->fetch_row($resql); - $prodids[$i] = $row[0]; + $row = $db->fetch_row($resql); + $prodids[$i] = $row[0]; } } - print "Build ".GEN_NUMBER_COMMANDE." orders\n"; for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++) { @@ -173,18 +170,18 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++) $object->cond_reglement_id = mt_rand(0, 2); $object->more_reglement_id = mt_rand(0, 7); $object->availability_id = mt_rand(0, 1); - + $listofuserid=array(12,13,16); - + $fuser = new User($db); $fuser->fetch($listofuserid[mt_rand(0, 2)]); $fuser->getRights(); - + $db->begin(); $result=$object->create($fuser); - if ($result >= 0) - { + if ($result >= 0) + { $nbp = mt_rand(2, 5); $xnbp = 0; while ($xnbp < $nbp) @@ -200,23 +197,23 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++) $xnbp++; } - $result=$object->valid($fuser); - if ($result > 0) - { + $result=$object->valid($fuser); + if ($result > 0) + { $db->commit(); print " OK with ref ".$object->ref."\n"; - } - else - { + } + else + { print " KO\n"; - $db->rollback(); - dol_print_error($db, $object->error); - } - } - else - { + $db->rollback(); + dol_print_error($db, $object->error); + } + } + else + { print " KO\n"; - $db->rollback(); - dol_print_error($db, $object->error); - } + $db->rollback(); + dol_print_error($db, $object->error); + } } diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index dc040a6465b..a82086fe313 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -170,6 +170,8 @@ + + diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index d9fe92de70a..9f31fa663ed 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -541,8 +541,8 @@ if ($id) print $valuetoshow; } print ''; - } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; } print ''; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 35930d8255d..7cb7d7d27f2 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -495,8 +495,8 @@ if ($id) elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); else print $valuetoshow; print ''; - } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; } print ''; diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 906ace586d0..1e623c23860 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -444,8 +444,8 @@ if ($id) elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); else print $valuetoshow; print ''; - } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; } print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 9420e7846f6..bc4b815100b 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -280,7 +280,7 @@ if (! empty($search_credit)) { if (! empty($search_lettering_code)) { $filter['t.lettering_code'] = $search_lettering_code; $param .= '&search_lettering_code=' . urlencode($search_lettering_code); - } +} if ($action == 'delbookkeeping') { diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index a5d8126567d..e350a3011a0 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -326,11 +326,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. dol_syslog('htdocs/accountancy/expensereport/index.php'); $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $db->num_rows($resql); while ($row = $db->fetch_row($resql)) { print '' . $row[0] . ''; - for($i = 1; $i <= 12; $i ++) { + for($i = 1; $i <= 12; $i ++) { print '' . price($row[$i]) . ''; } print '' . price($row[13]) . ''; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 3dd96e90a4a..ab85507a7b4 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -328,15 +328,15 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. while ($row = $db->fetch_row($resql)) { print '' . $row[0] . ''; - for($i = 1; $i <= 12; $i ++) { + for($i = 1; $i <= 12; $i ++) { print '' . price($row[$i]) . ''; } print '' . price($row[13]) . ''; print ''; } - $db->free($resql); + $db->free($resql); } else { - print $db->lasterror(); // Show last sql error + print $db->lasterror(); // Show last sql error } print "\n"; print ''; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 0776efff98a..22429de9200 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2767,7 +2767,7 @@ class Adherent extends CommonObject $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang); $outputlangs->loadLangs(array("main", "members")); - dol_syslog("sendReminderForExpiredSubscription Language set to ".$outputlangs->defaultlang); + dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang); $arraydefaultmessage=null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION; diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 4b0d02b5567..0d43b9d3f09 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -105,14 +105,14 @@ class Subscription extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)"; - if ($this->fk_type == null) { -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -$member=new Adherent($this->db); -$result=$member->fetch($this->fk_adherent); -$type=$member->typeid; -} else { -$type=$this->fk_type; -} + if ($this->fk_type == null) { + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; + $member=new Adherent($this->db); + $result=$member->fetch($this->fk_adherent); + $type=$member->typeid; + } else { + $type=$this->fk_type; + } $sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($this->dateh)."',"; $sql.= " '".$this->db->idate($this->datef)."',"; diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 593855b48d8..f5816f46aca 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -157,15 +157,16 @@ if ($mode) 'lastdate'=>$db->jdate($obj->lastdate) ); } - if ($mode == 'memberbyregion') //+ + if ($mode == 'memberbyregion') //+ { - $data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), - 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), - 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate) + $data[]=array( + 'label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), + 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), + 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), + 'nb'=>$obj->nb, + 'lastdate'=>$db->jdate($obj->lastdate) ); - } + } if ($mode == 'memberbystate') { $data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 605a35aef3d..d72d6ce8978 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -673,7 +673,7 @@ if ($rowid > 0) $sql.= " c.datef,"; $sql.= " c.fk_bank,"; $sql.= " b.rowid as bid,"; - $sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number"; + $sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number, ba.currency_code"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; @@ -726,8 +726,9 @@ if ($rowid > 0) $accountstatic->id=$objp->baid; $accountstatic->number=$objp->number; $accountstatic->account_number=$objp->account_number; + $accountstatic->currency_code=$objp->currency_code; - if (! empty($conf->accounting->enabled)) + if (! empty($conf->accounting->enabled) && $objp->fk_accountancy_journal > 0) { $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($objp->fk_accountancy_journal); diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 67f27c71b63..31cf3020765 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -308,17 +308,17 @@ if ($rowid && $action != 'edit') print '
'; print ''; - + // Type print ''; print ''; print ''; // Member diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 20bda9f50dc..23150ab7b35 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -460,7 +460,7 @@ while ($i < min($num, $limit)) $adherent->login=$obj->login; $adherent->photo=$obj->photo; - $adht = new AdherentType($db); + $adht = new AdherentType($db); $adht->fetch($obj->fk_type); print ''; @@ -471,13 +471,13 @@ while ($i < min($num, $limit)) print ''; if (! $i) $totalarray['nbfield']++; } - // Type - if (! empty($arrayfields['d.fk_type']['checked'])) + // Type + if (! empty($arrayfields['d.fk_type']['checked'])) { - print ''; - if (! $i) $totalarray['nbfield']++; + print ''; + if (! $i) $totalarray['nbfield']++; } // Lastname diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index caa0ba91a97..2a4ee7c7bd6 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1117,19 +1117,19 @@ if ($id) if ($id == 2) // Special cas for state page { - if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; } - if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; } + if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; } + if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; } } if ($valuetoshow != '') { print ''; - if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; - elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); - else print $valuetoshow; + if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; + elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); + else print $valuetoshow; print ''; - } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; } if ($id == 4) print ''; diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 50688e5a491..517ec9b9dc5 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -127,7 +127,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con if ($action == 'testunsubscribe') { $result=$mailmanspip->del_to_mailman($object); - if ($result < 0) + if ($result < 0) { $error++; setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors'); @@ -160,7 +160,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN)) print ''; dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); - + //$link=img_picto($langs->trans("Active"),'tick').' '; $link=''; //$link.=$langs->trans("Disable"); @@ -200,10 +200,10 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN)) '; form_constantes($constantes, 2); - + print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL%
'; - + dol_fiche_end(); print '
'; @@ -213,7 +213,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN)) else { dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); - + $link='
'; //$link.=img_$langs->trans("Activate") $link.=img_picto($langs->trans("Disabled"), 'switch_off'); diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 71a335c371c..9e9d5cad8f1 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -219,12 +219,12 @@ if ($action == 'add') $menu->fk_menu=GETPOST('menuId', 'int'); } else - { - if (GETPOST('type', 'alpha') == 'top') $menu->fk_menu=0; - else $menu->fk_menu=-1; - $menu->fk_mainmenu=$mainmenu; - $menu->fk_leftmenu=$leftmenu; - } + { + if (GETPOST('type', 'alpha') == 'top') $menu->fk_menu=0; + else $menu->fk_menu=-1; + $menu->fk_mainmenu=$mainmenu; + $menu->fk_leftmenu=$leftmenu; + } $result=$menu->create($user); if ($result > 0) diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 9fbb5ea79a2..5bbd6746573 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -68,8 +68,7 @@ if (!function_exists('gzdecode')) { * Action */ -if ($action == 'addprinter' && $user->admin) -{ +if ($action == 'addprinter' && $user->admin) { $error=0; $db->begin(); if (empty($printername)) { @@ -81,8 +80,7 @@ if ($action == 'addprinter' && $user->admin) setEventMessages($langs->trans("PrinterParameterEmpty"), null, 'warnings'); } - if (! $error) - { + if (! $error) { $result= $printer->AddPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter); if ($result > 0) $error++; @@ -100,8 +98,7 @@ if ($action == 'addprinter' && $user->admin) $action = ''; } -if ($action == 'deleteprinter' && $user->admin) -{ +if ($action == 'deleteprinter' && $user->admin) { $error=0; $db->begin(); if (empty($printerid)) { @@ -109,8 +106,7 @@ if ($action == 'deleteprinter' && $user->admin) setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors'); } - if (! $error) - { + if (! $error) { $result= $printer->DeletePrinter($printerid); if ($result > 0) $error++; @@ -128,8 +124,7 @@ if ($action == 'deleteprinter' && $user->admin) $action = ''; } -if ($action == 'updateprinter' && $user->admin) -{ +if ($action == 'updateprinter' && $user->admin) { $error=0; $db->begin(); if (empty($printerid)) { @@ -137,18 +132,14 @@ if ($action == 'updateprinter' && $user->admin) setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors'); } - if (! $error) - { + if (! $error) { $result= $printer->UpdatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid); if ($result > 0) $error++; - if (! $error) - { + if (! $error) { $db->commit(); setEventMessages($langs->trans("PrinterUpdated", $printername), null); - } - else - { + } else { $db->rollback(); dol_print_error($db); } @@ -156,24 +147,19 @@ if ($action == 'updateprinter' && $user->admin) $action = ''; } -if ($action == 'testprinter' && $user->admin) -{ +if ($action == 'testprinter' && $user->admin) { $error=0; if (empty($printerid)) { $error++; setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors'); } - if (! $error) - { + if (! $error) { // test $ret = $printer->SendTestToPrinter($printerid); - if ($ret == 0) - { + if ($ret == 0) { setEventMessages($langs->trans("TestSentToPrinter", $printername), null); - } - else - { + } else { setEventMessages($printer->error, $printer->errors, 'errors'); } } @@ -181,8 +167,7 @@ if ($action == 'testprinter' && $user->admin) } -if ($action == 'updatetemplate' && $user->admin) -{ +if ($action == 'updatetemplate' && $user->admin) { $error=0; $db->begin(); if (empty($templateid)) { @@ -190,18 +175,14 @@ if ($action == 'updatetemplate' && $user->admin) setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors'); } - if (! $error) - { + if (! $error) { $result= $printer->UpdateTemplate($templatename, $template, $templateid); if ($result > 0) $error++; - if (! $error) - { + if (! $error) { $db->commit(); setEventMessages($langs->trans("TemplateUpdated", $templatename), null); - } - else - { + } else { $db->rollback(); dol_print_error($db); } @@ -223,8 +204,7 @@ print load_fiche_titre($langs->trans("ReceiptPrinterSetup"), $linkback, 'title_s $head = receiptprinteradmin_prepare_head($mode); -if ($mode == 'config' && $user->admin) -{ +if ($mode == 'config' && $user->admin) { print ''; print ''; if ($action!='editprinter') { @@ -253,11 +233,9 @@ if ($mode == 'config' && $user->admin) if ($ret > 0) { setEventMessages($printer->error, $printer->errors, 'errors'); } else { - for ($line=0; $line < $nbofprinters; $line++) - { + for ($line=0; $line < $nbofprinters; $line++) { print ''; - if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid) - { + if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid) { print ''; print ''; $ret = $printer->selectTypePrinter($printer->listprinters[$line]['fk_type']); @@ -269,7 +247,7 @@ if ($mode == 'config' && $user->admin) print ''; print ''; print ''; - } else { + } else { print ''; print ''; print ''; @@ -291,10 +269,8 @@ if ($mode == 'config' && $user->admin) } } - if ($action!='editprinter') - { - if ($nbofprinters > 0) - { + if ($action!='editprinter') { + if ($nbofprinters > 0) { print ''; print ''; print ''; @@ -357,8 +333,7 @@ if ($mode == 'config' && $user->admin) dol_fiche_end(); } -if ($mode == 'template' && $user->admin) -{ +if ($mode == 'template' && $user->admin) { print ''; print ''; if ($action!='edittemplate') { @@ -429,8 +404,7 @@ if ($mode == 'template' && $user->admin) print ''; print "\n"; $max = count($printer->tags); - for ($tag=0; $tag < $max; $tag++) - { + for ($tag=0; $tag < $max; $tag++) { print ''; print ''; print ''; diff --git a/htdocs/admin/socialnetworks.php b/htdocs/admin/socialnetworks.php index 5d5ec9630e8..f723d13d540 100644 --- a/htdocs/admin/socialnetworks.php +++ b/htdocs/admin/socialnetworks.php @@ -98,17 +98,16 @@ print '
'; $arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook'); -foreach($arrayofsocialnetworks as $snkey => $snlabel) -{ - $consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey); - if ($conf->use_javascript_ajax) { - $link = ajax_constantonoff($consttocheck); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - $link = $form->selectarray($consttocheck, $arrval, $conf->global->$consttocheck); -} - - print $langs->trans('EnableFeatureFor', $snlabel).' '.$link.'

'; +foreach($arrayofsocialnetworks as $snkey => $snlabel) { + $consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey); + if ($conf->use_javascript_ajax) { + $link = ajax_constantonoff($consttocheck); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + $link = $form->selectarray($consttocheck, $arrval, $conf->global->$consttocheck); + } + + print $langs->trans('EnableFeatureFor', $snlabel).' '.$link.'

'; } diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 06f39550c8e..a833b5160b9 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -35,14 +35,15 @@ $what=GETPOST('what', 'alpha'); $export_type=GETPOST('export_type', 'alpha'); $file=GETPOST('filename_template', 'alpha'); +// Load variable for pagination +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST("page", 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$offset = $limit * $page; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="date"; -if ($page < 0) { $page = 0; } -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; -$offset = $limit * $page; if (! $user->admin) accessforbidden(); diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index a831a7d4056..2b7e4fbf1f8 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -478,8 +478,8 @@ if ($id) } else print $valuetoshow; print ''; - } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; } print '
'; } - print ''; + print ''; print "\n"; $i++; } @@ -942,7 +942,7 @@ if ($object->id > 0) print '\n"; print '\n"; print ''; - print '\n"; print ''; @@ -1004,7 +1004,7 @@ if ($object->id > 0) print ''."\n"; //print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''; $i++; @@ -1110,7 +1110,7 @@ if ($object->id > 0) print ''; } - print ''; @@ -1205,7 +1205,7 @@ if ($object->id > 0) print ''; } - print ''; + print ''; print "\n"; $i++; } diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index e9f0a135819..68730bccef1 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -142,7 +142,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print "\n"; $i = 0; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index f64e1328e5c..e6fc5e95010 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -186,7 +186,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'customer', 16); print ''; - print ''; + print ''; $i++; $total += $obj->total_ht; } @@ -266,7 +266,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'supplier', 16); print ''; - print ''; + print ''; $i++; $total += $obj->total_ht; } @@ -345,10 +345,10 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print $companystatic->getNomUrl(1, 'customer', 16); print ''; if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { - print ''; + print ''; } else { - print ''; + print ''; } $i++; $total += $obj->total_ttc; @@ -432,10 +432,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande print $companystatic->getNomUrl(1, 'supplier', 16); print ''; if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { - print ''; + print ''; } else { - print ''; + print ''; } $i++; $total += $obj->total_ttc; diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index e29cb63ab3f..00aae3a8b08 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -876,31 +876,31 @@ class AdvanceTargetingMailing extends CommonObject foreach($extralabels as $key=>$val) { if (($extrafields->attribute_type[$key] == 'varchar') || - ($extrafields->attribute_type[$key] == 'text')) { - if (!empty($arrayquery['options_'.$key])) { - $sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')"; - } - } elseif (($extrafields->attribute_type[$key] == 'int') || - ($extrafields->attribute_type[$key] == 'double')) { - if (!empty($arrayquery['options_'.$key.'_max'])) { - $sqlwhere[]= " (tse.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND tse.".$key." <= ".$arrayquery['options_'.$key.'_min'].")"; - } - } elseif (($extrafields->attribute_type[$key] == 'date') || - ($extrafields->attribute_type[$key] == 'datetime')) { - if (!empty($arrayquery['options_'.$key.'_end_dt'])){ - $sqlwhere[]= " (tse.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND tse.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')"; - } - }elseif ($extrafields->attribute_type[$key] == 'boolean') { - if ($arrayquery['options_'.$key]!=''){ - $sqlwhere[]= " (tse.".$key." = ".$arrayquery['options_'.$key].")"; - } - }else{ - if (is_array($arrayquery['options_'.$key])) { - $sqlwhere[]= " (tse.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))"; - } elseif (!empty($arrayquery['options_'.$key])) { - $sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')"; - } - } + ($extrafields->attribute_type[$key] == 'text')) { + if (!empty($arrayquery['options_'.$key])) { + $sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')"; + } + } elseif (($extrafields->attribute_type[$key] == 'int') || + ($extrafields->attribute_type[$key] == 'double')) { + if (!empty($arrayquery['options_'.$key.'_max'])) { + $sqlwhere[]= " (tse.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND tse.".$key." <= ".$arrayquery['options_'.$key.'_min'].")"; + } + } elseif (($extrafields->attribute_type[$key] == 'date') || + ($extrafields->attribute_type[$key] == 'datetime')) { + if (!empty($arrayquery['options_'.$key.'_end_dt'])){ + $sqlwhere[]= " (tse.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND tse.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')"; + } + } elseif ($extrafields->attribute_type[$key] == 'boolean') { + if ($arrayquery['options_'.$key]!=''){ + $sqlwhere[]= " (tse.".$key." = ".$arrayquery['options_'.$key].")"; + } + } else { + if (is_array($arrayquery['options_'.$key])) { + $sqlwhere[]= " (tse.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))"; + } elseif (!empty($arrayquery['options_'.$key])) { + $sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')"; + } + } } } } diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 17d5da8acd8..c5d8bc47232 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -109,20 +109,19 @@ if (is_resource($handle)) print ''; $result=$db->query($sql); - if ($result) - { - $num = $db->num_rows($result); + if ($result) { + $num = $db->num_rows($result); - $i = 0; + $i = 0; - while ($i < $num ) + while ($i < $num ) { - $obj = $db->fetch_object($result); - print ''; + } + print "
'.$langs->trans("Type").''; - if ( ! empty($object->fk_type) ) { - $adht->fetch($object->fk_type); - print $adht->getNomUrl(1); - } else { - print $langs->trans("NoType"); - } + if (! empty($object->fk_type) ) { + $adht->fetch($object->fk_type); + print $adht->getNomUrl(1); + } else { + print $langs->trans("NoType"); + } print '
'.$subscription->getNomUrl(1).''; - if ( ! empty($obj->fk_type) ) print $adht->getNomUrl(1); - print ''; + if ( ! empty($obj->fk_type) ) print $adht->getNomUrl(1); + print '
'.$printer->listprinters[$line]['name'].''.$langs->trans($printer->listprinters[$line]['fk_type_name']).''.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'
'.$langs->trans("Name").''.$langs->trans("Type").''.$langs->trans("Description").'
<'.$printer->tags[$tag].'>'.$langs->trans(strtoupper($printer->tags[$tag])).'
'; diff --git a/htdocs/api/admin/explorer.php b/htdocs/api/admin/explorer.php index 1174003294a..001e7d07cee 100644 --- a/htdocs/api/admin/explorer.php +++ b/htdocs/api/admin/explorer.php @@ -89,15 +89,14 @@ foreach ($modulesdir as $dir) $obj = 'facture'; } if ($module == 'ficheinter') { - $obj = 'fichinter'; - $part = 'fichinter'; - $module='fichinter'; - } + $obj = 'fichinter'; + $part = 'fichinter'; + $module='fichinter'; + } - if (empty($conf->$module->enabled)) $enabled=false; + if (empty($conf->$module->enabled)) $enabled=false; - if ($enabled) - { + if ($enabled) { /* * If exists, load the API class for enable module * diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 64ff412b86c..ce0cd81622f 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -921,8 +921,8 @@ class BlockedLog * @param int $beforeid ID of a record * @return string Hash of previous record (if beforeid is defined) or hash of last record (if beforeid is 0) */ - public function getPreviousHash($withlock = 0, $beforeid = 0) - { + public function getPreviousHash($withlock = 0, $beforeid = 0) + { global $conf; $previoussignature=''; diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index e3d5d66f459..f5b13437ba9 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -55,8 +55,8 @@ class Categories extends DolibarrApi */ function __construct() { - global $db, $conf; - $this->db = $db; + global $db, $conf; + $this->db = $db; $this->category = new Categorie($this->db); } @@ -67,25 +67,25 @@ class Categories extends DolibarrApi * * @param int $id ID of category * @return array|mixed data without useless information - * + * * @throws RestException */ function get($id) { - if(! DolibarrApiAccess::$user->rights->categorie->lire) { - throw new RestException(401); - } + if (! DolibarrApiAccess::$user->rights->categorie->lire) { + throw new RestException(401); + } $result = $this->category->fetch($id); - if( ! $result ) { + if ( ! $result ) { throw new RestException(404, 'category not found'); } - if( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - return $this->_cleanObjectDatas($this->category); + return $this->_cleanObjectDatas($this->category); } /** @@ -101,7 +101,7 @@ class Categories extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of category objects * - * @throws RestException + * @throws RestException */ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') { @@ -109,9 +109,9 @@ class Categories extends DolibarrApi $obj_ret = array(); - if(! DolibarrApiAccess::$user->rights->categorie->lire) { - throw new RestException(401); - } + if(! DolibarrApiAccess::$user->rights->categorie->lire) { + throw new RestException(401); + } $sql = "SELECT t.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as t"; @@ -127,7 +127,7 @@ class Categories extends DolibarrApi { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -145,7 +145,7 @@ class Categories extends DolibarrApi $result = $db->query($sql); if ($result) { - $i=0; + $i=0; $num = $db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); while ($i < $min) @@ -164,7 +164,7 @@ class Categories extends DolibarrApi if( ! count($obj_ret)) { throw new RestException(404, 'No category found'); } - return $obj_ret; + return $obj_ret; } /** @@ -176,8 +176,8 @@ class Categories extends DolibarrApi function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->categorie->creer) { - throw new RestException(401); - } + throw new RestException(401); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -201,17 +201,17 @@ class Categories extends DolibarrApi function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->categorie->creer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->category->fetch($id); if( ! $result ) { throw new RestException(404, 'category not found'); } - if( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } foreach($request_data as $field => $value) { if ($field == 'id') continue; @@ -224,7 +224,7 @@ class Categories extends DolibarrApi } else { - throw new RestException(500, $this->category->error); + throw new RestException(500, $this->category->error); } } @@ -237,16 +237,16 @@ class Categories extends DolibarrApi function delete($id) { if(! DolibarrApiAccess::$user->rights->categorie->supprimer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->category->fetch($id); if( ! $result ) { throw new RestException(404, 'category not found'); } - if( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } if (! $this->category->delete(DolibarrApiAccess::$user)) { throw new RestException(401, 'error when delete category'); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2eafaa2c2ea..4ac6579592e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1291,7 +1291,7 @@ class ActionComm extends CommonObject if (! empty($this->location)) $tooltip .= '
' . $langs->trans('Location') . ': ' . $this->location; if (! empty($this->note)) - $tooltip .= '
' . $langs->trans('Note') . ': ' . (dol_textishtml($this->note) ? str_replace(array("\r","\n"), "", $this->note) : $this->note); + $tooltip .= '
' . $langs->trans('Note') . ': ' . (dol_textishtml($this->note) ? str_replace(array("\r","\n"), "", $this->note) : str_replace(array("\r","\n"), '
', $this->note)); $linkclose=''; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) $linkclose = ' style="background-color:#'.$this->type_color.'"'; diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 9c54f945456..6b14bb6e884 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -58,7 +58,7 @@ class AgendaEvents extends DolibarrApi * * @param int $id ID of Agenda Events * @return array|mixed Data without useless information - * + * * @throws RestException */ function get($id) @@ -83,7 +83,7 @@ class AgendaEvents extends DolibarrApi $result = $this->actioncomm->fetch_optionals(); $this->actioncomm->fetchObjectLinked(); - return $this->_cleanObjectDatas($this->actioncomm); + return $this->_cleanObjectDatas($this->actioncomm); } /** @@ -116,7 +116,7 @@ class AgendaEvents extends DolibarrApi // If the internal user must only see his customers, force searching by him $search_sale = 0; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; - if (empty($conf->societe->enabled)) $search_sale = 0; // If module thirdparty not enabled, sale representative is something that does not exists + if (empty($conf->societe->enabled)) $search_sale = 0; // If module thirdparty not enabled, sale representative is something that does not exists $sql = "SELECT t.id as rowid"; if (! empty($conf->societe->enabled)) @@ -160,7 +160,7 @@ class AgendaEvents extends DolibarrApi if ($result) { - $i=0; + $i=0; $num = $db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); while ($i < $min) @@ -179,7 +179,7 @@ class AgendaEvents extends DolibarrApi if ( ! count($obj_ret)) { throw new RestException(404, 'No Agenda Event found'); } - return $obj_ret; + return $obj_ret; } /** @@ -190,12 +190,12 @@ class AgendaEvents extends DolibarrApi */ function post($request_data = null) { - if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { - throw new RestException(401, "Insuffisant rights to create your Agenda Event"); - } - if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) { - throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); - } + if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { + throw new RestException(401, "Insuffisant rights to create your Agenda Event"); + } + if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) { + throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -229,21 +229,21 @@ class AgendaEvents extends DolibarrApi /* function put($id, $request_data = null) { - if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { - throw new RestException(401, "Insuffisant rights to create your Agenda Event"); - } - if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) { - throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); - } + if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { + throw new RestException(401, "Insuffisant rights to create your Agenda Event"); + } + if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) { + throw new RestException(401, "Insuffisant rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } $result = $this->actioncomm->fetch($id); if ( ! $result ) { throw new RestException(404, 'actioncomm not found'); } - if ( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } foreach($request_data as $field => $value) { if ($field == 'id') continue; $this->actioncomm->$field = $value; @@ -266,13 +266,13 @@ class AgendaEvents extends DolibarrApi function delete($id) { if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) { - throw new RestException(401, "Insuffisant rights to delete your Agenda Event"); - } + throw new RestException(401, "Insuffisant rights to delete your Agenda Event"); + } $result = $this->actioncomm->fetch($id); if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) { - throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); } if( ! $result ) { diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index fd65422cdcc..79f53316e2e 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -876,7 +876,7 @@ if ($object->id > 0) print '
!!!' . $sendingstatic->LibStatut($objp->statut, 5) . '' . $sendingstatic->LibStatut($objp->statut, 5) . '
'.dol_print_date($db->jdate($objp->dc), 'day')."'.dol_print_date($db->jdate($objp->dcon), 'day')." '; + print ''; print $contrat->getLibStatut(4); print "
'.img_object($langs->trans("ShowPropal"), "propal").' '.$objp->ref.''.dol_print_date($db->jdate($objp->startdate)).''.convertSecondToTime($objp->duration).''.$fichinter_static->getLibStatut(5).''.$fichinter_static->getLibStatut(5).'
'; + print ''; print $langs->trans('FrequencyPer_'.$invoicetemplate->unit_frequency, $invoicetemplate->frequency).' - '; print ($invoicetemplate->LibStatut($invoicetemplate->frequency, $invoicetemplate->suspended, 5, 0)); print ''.($facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am)).''.($facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am)).'
 
'.price($obj->total_ht).'
'.price($obj->total_ht).'
'.price($obj->total_ht).'
'.price($obj->total_ht).'
'.price($obj->total_ht).'
'.price($obj->total_ht).'
'.price($obj->total_ttc).'
'.price($obj->total_ttc).'
'.price($obj->total_ht).'
'.price($obj->total_ht).'
'.price($obj->total_ttc).'
'.price($obj->total_ttc).'
'.img_object('', $mailmodule->picto).' '.$obj->label.''.$obj->nb.''; - $i++; + $obj = $db->fetch_object($result); + print ''.img_object('', $mailmodule->picto).' '.$obj->label.''.$obj->nb.''; + $i++; } - $db->free($result); + $db->free($result); } else { @@ -154,45 +153,44 @@ $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql.= " ORDER BY m.date_creat DESC"; $sql.= " LIMIT ".$limit; $result=$db->query($sql); -if ($result) -{ - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; +if ($result) { + print '
'.$langs->trans("LastMailings", $limit).''.$langs->trans("DateCreation").''.$langs->trans("NbOfEMails").''.$langs->trans("AllEMailings").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; - $num = $db->num_rows($result); - if ($num > 0) - { - $i = 0; - - while ($i < $num ) - { - $obj = $db->fetch_object($result); - - print ''; - print ''; - print ''; - print ''; - print ''; - $mailstatic=new Mailing($db); - print ''; - print ''; - $i++; - } - } - else + $num = $db->num_rows($result); + if ($num > 0) { - print ''; + $i = 0; + + while ($i < $num ) + { + $obj = $db->fetch_object($result); + + print ''; + print ''; + print ''; + print ''; + print ''; + $mailstatic=new Mailing($db); + print ''; + print ''; + $i++; + } } - print "
'.$langs->trans("LastMailings", $limit).''.$langs->trans("DateCreation").''.$langs->trans("NbOfEMails").''.$langs->trans("AllEMailings").'
'.img_object($langs->trans("ShowEMail"), "email").' '.$obj->rowid.''.dol_trunc($obj->titre, 38).''.dol_print_date($db->jdate($obj->date_creat), 'day').''.($obj->nbemail?$obj->nbemail:"0").''.$mailstatic->LibStatut($obj->statut, 5).'
'.$langs->trans("None").'
'.img_object($langs->trans("ShowEMail"), "email").' '.$obj->rowid.''.dol_trunc($obj->titre, 38).''.dol_print_date($db->jdate($obj->date_creat), 'day').''.($obj->nbemail?$obj->nbemail:"0").''.$mailstatic->LibStatut($obj->statut, 5).'

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

"; + $db->free($result); } else { - dol_print_error($db); + dol_print_error($db); } @@ -207,7 +205,7 @@ if ($langs->file_exists("html/spam.html", 0)) { print ''; print '
'; - } +} // End of page llxFooter(); diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 9fe818d72ad..4e49b7bbbbd 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -193,7 +193,7 @@ if ($result) if (! $filteremail) print ' '; print ' '; print ' '; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -206,8 +206,8 @@ if ($result) if (! $filteremail) print_liste_field_titre("NbOfEMails", $_SERVER["PHP_SELF"], "m.nbemail", $param, "", 'align="center"', $sortfield, $sortorder); if (! $filteremail) print_liste_field_titre("DateLastSend", $_SERVER["PHP_SELF"], "m.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder); else print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], ($filteremail?"mc.statut":"m.statut"), $param, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], ($filteremail?"mc.statut":"m.statut"), $param, "", 'class="right"', $sortfield, $sortorder); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'class="right"', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -256,7 +256,7 @@ if ($result) print ''; // Status - print ''; + print ''; if ($filteremail) { print $email::libStatutDest($obj->sendstatut, 2); diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 77ee4ef1b9b..ac0fc2ccd8c 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -184,11 +184,11 @@ class Proposals extends DolibarrApi */ function post($request_data = null) { - if(! DolibarrApiAccess::$user->rights->propal->creer) { - throw new RestException(401, "Insuffisant rights"); - } - // Check mandatory fields - $result = $this->_validate($request_data); + if(! DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401, "Insuffisant rights"); + } + // Check mandatory fields + $result = $this->_validate($request_data); foreach($request_data as $field => $value) { $this->propal->$field = $value; @@ -218,24 +218,24 @@ class Proposals extends DolibarrApi */ function getLines($id) { - if(! DolibarrApiAccess::$user->rights->propal->lire) { - throw new RestException(401); - } + if(! DolibarrApiAccess::$user->rights->propal->lire) { + throw new RestException(401); + } - $result = $this->propal->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Commercial Proposal not found'); - } + $result = $this->propal->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Commercial Proposal not found'); + } - if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } - $this->propal->getLinesArray(); - $result = array(); - foreach ($this->propal->lines as $line) { - array_push($result, $this->_cleanObjectDatas($line)); - } - return $result; + if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $this->propal->getLinesArray(); + $result = array(); + foreach ($this->propal->lines as $line) { + array_push($result, $this->_cleanObjectDatas($line)); + } + return $result; } /** @@ -266,7 +266,7 @@ class Proposals extends DolibarrApi $request_data = (object) $request_data; - $updateRes = $this->propal->addline( + $updateRes = $this->propal->addline( $request_data->desc, $request_data->subprice, $request_data->qty, @@ -293,15 +293,14 @@ class Proposals extends DolibarrApi $request_data->origin_id, $request_data->multicurrency_subprice, $request_data->fk_remise_except - ); + ); - if ($updateRes > 0) { - return $updateRes; - } - else { - throw new RestException(400, $this->propal->error); - } - } + if ($updateRes > 0) { + return $updateRes; + } else { + throw new RestException(400, $this->propal->error); + } + } /** * Update a line of given commercial proposal @@ -360,14 +359,14 @@ class Proposals extends DolibarrApi isset($request_data->array_options)?$request_data->array_options:$propalline->array_options, isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit, isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice - ); + ); - if ($updateRes > 0) { - $result = $this->get($id); - unset($result->line); - return $this->_cleanObjectDatas($result); - } - return false; + if ($updateRes > 0) { + $result = $this->get($id); + unset($result->line); + return $this->_cleanObjectDatas($result); + } + return false; } /** @@ -386,7 +385,7 @@ class Proposals extends DolibarrApi function deleteLine($id, $lineid) { if(! DolibarrApiAccess::$user->rights->propal->creer) { - throw new RestException(401); + throw new RestException(401); } $result = $this->propal->fetch($id); @@ -417,12 +416,12 @@ class Proposals extends DolibarrApi * @param array $request_data Datas * * @return int - */ + */ function put($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->propal->creer) { - throw new RestException(401); - } + if(! DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401); + } $result = $this->propal->fetch($id); if( ! $result ) { @@ -654,35 +653,35 @@ class Proposals extends DolibarrApi */ function setinvoiced($id) { - if(! DolibarrApiAccess::$user->rights->propal->creer) { - throw new RestException(401); - } - $result = $this->propal->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Commercial Proposal not found'); - } + if (! DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401); + } + $result = $this->propal->fetch($id); + if ( ! $result ) { + throw new RestException(404, 'Commercial Proposal not found'); + } - if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - $result = $this->propal->classifyBilled(DolibarrApiAccess::$user ); - if ($result < 0) { - throw new RestException(500, 'Error : '.$this->propal->error); - } + $result = $this->propal->classifyBilled(DolibarrApiAccess::$user ); + if ($result < 0) { + throw new RestException(500, 'Error : '.$this->propal->error); + } - $result = $this->propal->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Proposal not found'); - } + $result = $this->propal->fetch($id); + if ( ! $result ) { + throw new RestException(404, 'Proposal not found'); + } - if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - $this->propal->fetchObjectLinked(); + $this->propal->fetchObjectLinked(); - return $this->_cleanObjectDatas($this->propal); + return $this->_cleanObjectDatas($this->propal); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0c7bb1aea93..46a5352ed53 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1063,13 +1063,13 @@ class Propal extends CommonObject for ($i=0;$i<$num;$i++) { if (! is_object($this->lines[$i])) // If this->lines is not array of objects, coming from REST API - { // Convert into object this->lines[$i]. - $line = (object) $this->lines[$i]; - } - else - { - $line = $this->lines[$i]; - } + { // Convert into object this->lines[$i]. + $line = (object) $this->lines[$i]; + } + else + { + $line = $this->lines[$i]; + } // Reset fk_parent_line for line that are not child lines or special product if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { $fk_parent_line = 0; diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index fcea4ee05a6..2bc710394bb 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -430,7 +430,7 @@ if (! empty($conf->propal->enabled)) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -503,7 +503,7 @@ if (! empty($conf->propal->enabled)) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -514,7 +514,7 @@ if (! empty($conf->propal->enabled)) print '
'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; - print ''.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).''; + print ''.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).''; print ''; $i++; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 64c126d7e8f..67c347a97d5 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -619,21 +619,21 @@ if ($resql) if (! empty($arrayfields['p.total_ht']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['p.total_vat']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['p.total_ttc']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } @@ -670,7 +670,7 @@ if ($resql) // Status if (! empty($arrayfields['p.fk_statut']['checked'])) { - print ''; + print ''; $formpropal->selectProposalStatus($viewstatut, 1, 0, 1, 'customer', 'search_statut'); print ''; } @@ -698,9 +698,9 @@ if ($resql) if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); // Extra fields @@ -711,7 +711,7 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print ''."\n"; @@ -753,7 +753,7 @@ if ($resql) print ''; } // Other picto tool - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index fc06819786a..bbdfc57af50 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -24,10 +24,9 @@ */ // Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) -{ - print "Error, template page can't be called as URL"; - exit; +if (empty($conf) || ! is_object($conf)) { + print "Error, template page can't be called as URL"; + exit; } ?> @@ -54,23 +53,24 @@ foreach($linkedObjectBlock as $key => $objectlink) ?> trans("Proposal"); ?> - global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) - { - $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id; - print ' '; - } - ?> + global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) + { + $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id; + print ' '; + } + ?> getNomUrl(1); ?> ref_client; ?> date, 'day'); ?> - rights->propale->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> 1) - diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 7c8c0fa0934..e110dc05b1d 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -220,7 +220,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) } if ($total>0) { - print ''.$langs->trans("Total")."".price($total).""; + print ''.$langs->trans("Total")."".price($total).""; } print "
"; } diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 6e9604332f7..8b7fef878ed 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -130,7 +130,7 @@ if ($resql) print_liste_field_titre("Town", $_SERVER["PHP_SELF"], "s.town", "", "", 'valign="center"', $sortfield, $sortorder); print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", "", 'align="left"', $sortfield, $sortorder); print_liste_field_titre("AccountancyCode", $_SERVER["PHP_SELF"], "s.code_compta", "", "", 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "datec", $addu, "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "datec", $addu, "", 'class="right"', $sortfield, $sortorder); print "\n"; // Lignes des champs de filtre @@ -149,7 +149,7 @@ if ($resql) print ''; print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 99e082d46ec..ff8940854e7 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -652,21 +652,21 @@ if ($resql) if (! empty($arrayfields['c.total_ht']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['c.total_vat']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['c.total_ttc']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } @@ -691,7 +691,7 @@ if ($resql) // Status if (! empty($arrayfields['c.fk_statut']['checked'])) { - print ''; + print ''; $liststatus=array( Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraftShort"), Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), @@ -731,9 +731,9 @@ if ($resql) if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'], $_SERVER["PHP_SELF"], 'c.date_commande', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'], $_SERVER["PHP_SELF"], 'c.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -742,7 +742,7 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, 'align="center"', $sortfield, $sortorder, ''); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print ''."\n"; @@ -914,7 +914,7 @@ if ($resql) } print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 4e986304828..9c6d83e3dfe 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -610,7 +610,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print_liste_field_titre('RefCustomerOrder', $_SERVER["PHP_SELF"], 'c.ref_client', '', '&socid='.$socid, '', $sortfield, $sortorder); print_liste_field_titre('OrderDate', $_SERVER["PHP_SELF"], 'c.date_commande', '', '&socid='.$socid, 'align="center"', $sortfield, $sortorder); print_liste_field_titre('DeliveryDate', $_SERVER["PHP_SELF"], 'c.date_livraison', '', '&socid='.$socid, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('Status', '', '', '', '', 'align="right"'); + print_liste_field_titre('Status', '', '', '', '', 'class="right"'); print_liste_field_titre('GenerateBill', '', '', '', '', 'align="center"'); print ''; @@ -638,7 +638,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; //SEARCH BUTTON - print ''; + print ''; print ''; print ''; @@ -678,7 +678,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) } print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($objp->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; @@ -699,7 +699,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; // Statut - print ''.$generic_commande->LibStatut($objp->fk_statut, $objp->billed, 5).''; + print ''.$generic_commande->LibStatut($objp->fk_statut, $objp->billed, 5).''; // Checkbox print ''; @@ -718,7 +718,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) * Boutons actions */ print '
global->INVOICE_CLOSE_ORDERS_OFF_BY_DEFAULT_FORMASSINVOICE)?' checked="checked"':'').' name="autocloseorders"> '.$langs->trans("CloseProcessedOrdersAutomatically"); - print '
'; + print '
'; print ''; print ''; print '
'; diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 5b2dbc890ca..cce17b32695 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -54,13 +54,13 @@ foreach($linkedObjectBlock as $key => $objectlink) getNomUrl(1); ?> ref_client; ?> date, 'day'); ?> - rights->commande->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?> - getLibStatut(3); ?> - + getLibStatut(3); ?> + element != 'shipping') { diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 197bbbc0c35..98085b34778 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -209,7 +209,7 @@ for ($mois = 1 ; $mois < 13 ; $mois++) { $case = sprintf("%04s-%02s", $annee, $mois); - print ' '; + print ' '; if ($decaiss[$case]>0) { print price($decaiss[$case]); @@ -217,7 +217,7 @@ for ($mois = 1 ; $mois < 13 ; $mois++) } print ""; - print ' '; + print ' '; if ($encaiss[$case]>0) { print price($encaiss[$case]); @@ -266,7 +266,7 @@ else { print ''; print '"; -print ''; +print ''; print "\n"; print "
'.$langs->trans("CurrentBalance")."'.price($balance).''.price($balance).'
"; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 2b599b1e60d..edd0f35c442 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -666,10 +666,10 @@ if ($resql) print ''.$langs->trans("Numero").''; //if (! $search_account > 0) //{ - print ''.$langs->trans("BankAccount").''; + print ''.$langs->trans("BankAccount").''; //} - print ''.$langs->trans("Debit").''; - print ''.$langs->trans("Credit").''; + print ''.$langs->trans("Debit").''; + print ''.$langs->trans("Credit").''; /*if (! empty($conf->accounting->enabled)) { print ''; @@ -700,7 +700,7 @@ if ($resql) print ''; //if (! $search_account > 0) //{ - print ''; + print ''; $form->select_comptes(GETPOST('add_account', 'int')?GETPOST('add_account', 'int'):$search_account, 'add_account', 0, '', 1, ($id > 0 || ! empty($ref)?' disabled="disabled"':'')); print ''; //} @@ -955,11 +955,11 @@ if ($resql) if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], 'bu.label', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'], $_SERVER['PHP_SELF'], 'b.num_releve', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, 'align="center"', $sortfield, $sortorder); // Extra fields @@ -968,7 +968,7 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'class="right"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -1355,7 +1355,7 @@ if ($resql) // Debit if (! empty($arrayfields['b.debit']['checked'])) { - print ''; + print ''; if ($objp->amount < 0) { print price($objp->amount * -1); @@ -1396,7 +1396,7 @@ if ($resql) } else { - print '-'; + print '-'; } if (! $i) $totalarray['nbfield']++; } @@ -1411,12 +1411,12 @@ if ($resql) } else { - print ' '.price($balance).''; + print ' '.price($balance).''; } } else { - print '-'; + print '-'; } if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 0333bfa52ed..6aac94532df 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -394,7 +394,7 @@ print $hookmanager->resPrint; if (! empty($arrayfields['b.datec']['checked'])) print_liste_field_titre($arrayfields['b.datec']['label'], $_SERVER["PHP_SELF"], "b.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['b.tms']['checked'])) print_liste_field_titre($arrayfields['b.tms']['label'], $_SERVER["PHP_SELF"], "b.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'], $_SERVER["PHP_SELF"], 'b.clos', '', $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'align="right"', $sortfield, $sortorder); +if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -550,7 +550,7 @@ foreach ($accounts as $key=>$type) // Balance if (! empty($arrayfields['balance']['checked'])) { - print ''; + print ''; print ''.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).''; print ''; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 140df3be2fd..6c6a8447c5a 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -766,15 +766,15 @@ else if ($objp->amount < 0) { $totald = $totald + abs($objp->amount); - print ''.price($objp->amount * -1)." \n"; + print ''.price($objp->amount * -1)." \n"; } else { $totalc = $totalc + abs($objp->amount); - print ' '.price($objp->amount)."\n"; + print ' '.price($objp->amount)."\n"; } - print ''.price(price2num($total, 'MT'))."\n"; + print ''.price(price2num($total, 'MT'))."\n"; if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { @@ -793,7 +793,7 @@ else } // Line Total - print "\n".''.$langs->trans("Total")." :".price($totald)."".price($totalc)."  "; + print "\n".''.$langs->trans("Total")." :".price($totald)."".price($totalc)."  "; // Line Balance print "\n"; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 36be0a3171c..5a4374f47dd 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -3,7 +3,7 @@ * Copyright (C) 2008-2009 Laurent Destailleur (Eldy) * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2015 Marcos García + * Copyright (C) 2016 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 @@ -183,13 +183,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) foreach($sqls as $sql){ $resql = $db->query($sql); - if($resql){ - while($sqlobj = $db->fetch_object($resql)){ + if ($resql) { + while ($sqlobj = $db->fetch_object($resql)) { $tab_sqlobj[] = $sqlobj; $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); } $db->free($resql); - }else{ + } else { $error++; } } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 4437a9cfd2d..2d81facbad2 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -218,12 +218,12 @@ if ($result) } // Debit - print ''; + print ''; // Credit - print ''; + print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -238,8 +238,8 @@ if ($result) print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'align="left"', $sortfield, $sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -328,8 +328,8 @@ if ($result) print ''; print ''.$langs->trans("Total").''; - print ''.price($totalarray['totaldeb']).""; - print ''.price($totalarray['totalcred']).""; + print ''.price($totalarray['totaldeb']).""; + print ''.price($totalarray['totalcred']).""; print ''; print ''; diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 2db889e505d..89b66531eec 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -401,7 +401,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 348c9bab450..736090bd07b 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -139,10 +139,10 @@ if ($resql) // Fields title print ''; print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, 'class="left"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); print "\n"; $posconciliatecol = 0; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index e2381605306..8ff14a88f79 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -123,12 +123,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'width="140px"', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "c.libelle", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "cs.fk_type", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pc.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pc.datep", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'class="right"', $sortfield, $sortorder); print "\n"; $sql = "SELECT c.id, c.libelle as lib,"; @@ -226,12 +226,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $i++; } print ''.$langs->trans("Total").''; - print ''; // A total here has no sense + print ''; // A total here has no sense print ' '; print ' '; print ' '; if (! empty($conf->banque->enabled)) print ''; - print ''.price($totalpaye).""; + print ''.price($totalpaye).""; print ""; } else @@ -283,7 +283,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder); print "\n"; $var=1; while ($i < $num) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 7b9d2fa2540..23eff46da51 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -112,16 +112,16 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ if ($resd) { - $numd = $db->num_rows($resd); + $numd = $db->num_rows($resd); - $tmpinvoice=new Facture($db); - $tmpinvoicesupplier=new FactureFournisseur($db); - $tmpdonation=new Don($db); + $tmpinvoice=new Facture($db); + $tmpinvoicesupplier=new FactureFournisseur($db); + $tmpdonation=new Don($db); - $upload_dir =''; - $i=0; - while($i<$numd) - { + $upload_dir =''; + $i=0; + while($i<$numd) + { $objd = $db->fetch_object($resd); switch($objd->item) @@ -197,14 +197,14 @@ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ } } $i++; - } - } - else - { - dol_print_error($db); - } + } + } + else + { + dol_print_error($db); + } - $db->free($resd); + $db->free($resd); } /* @@ -315,57 +315,57 @@ if (!empty($date_start) && !empty($date_stop)) if ($result) { $TData = dol_sort_array($filesarray, 'date', 'ASC'); - if(empty($TData)) { - print ''.$langs->trans("NoItem").''; - } else { - // Sort array by date ASC to calucalte balance + if(empty($TData)) { + print ''.$langs->trans("NoItem").''; + } else { + // Sort array by date ASC to calucalte balance - $totalDebit = 0; - $totalCredit = 0; - // Balance calculation - $balance = 0; - foreach($TData as &$data1) { - if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ - $data1['amount']=-$data1['amount']; - } - if ($data1['amount']>0){ - }else{ - } - $balance += $data1['amount']; - $data1['balance'] = $balance; - } - // Display array - foreach($TData as $data) { - $html_class = ''; - //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; - //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; - print ''; - print ""; - print dol_print_date($data['date'], 'day'); - print "\n"; - print ''.$data['item'].''; - print ''.$data['ref'].''; - - // File link - print '".$data['name']."\n"; - - print ''.$data['paid'].''; - print ''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."\n"; - $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; - print ''.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."\n"; - $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); - // Balance - print ''.price($data['balance'])."\n"; - print "\n"; - } - print ''; - print ' '; - print ''.price($totalDebit).''; - print ''.price($totalCredit).''; - print ''.price(price2num($totalDebit - $totalCredit, 'MT')).''; - print "\n"; - } + $totalDebit = 0; + $totalCredit = 0; + // Balance calculation + $balance = 0; + foreach($TData as &$data1) { + if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ + $data1['amount']=-$data1['amount']; + } + if ($data1['amount']>0){ + }else{ + } + $balance += $data1['amount']; + $data1['balance'] = $balance; } + // Display array + foreach($TData as $data) { + $html_class = ''; + //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; + //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; + print ''; + print ""; + print dol_print_date($data['date'], 'day'); + print "\n"; + print ''.$data['item'].''; + print ''.$data['ref'].''; + + // File link + print '".$data['name']."\n"; + + print ''.$data['paid'].''; + print ''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."\n"; + $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; + print ''.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."\n"; + $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); + // Balance + print ''.price($data['balance'])."\n"; + print "\n"; + } + print ''; + print ' '; + print ''.price($totalDebit).''; + print ''.price($totalCredit).''; + print ''.price(price2num($totalDebit - $totalCredit, 'MT')).''; + print "\n"; + } + } print ""; print '
'; } diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 60eb007e26a..9602216b955 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -483,7 +483,7 @@ elseif ($id) print ''; if ($action != 'classify' && $user->rights->deplacement->creer) { - print 'id.'">'; + print 'id.'">'; print img_edit($langs->trans('SetProject'), 1); print ''; } diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 4fba1b25aee..9ad85788ca0 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -127,7 +127,7 @@ if ($resql) print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.dated", "", "&socid=$socid", 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Person", $_SERVER["PHP_SELF"], "u.lastname", "", "&socid=$socid", '', $sortfield, $sortorder); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", "&socid=$socid", '', $sortfield, $sortorder); - print_liste_field_titre("FeesKilometersOrAmout", $_SERVER["PHP_SELF"], "d.km", "", "&socid=$socid", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("FeesKilometersOrAmout", $_SERVER["PHP_SELF"], "d.km", "", "&socid=$socid", 'class="right"', $sortfield, $sortorder); print_liste_field_titre(''); print "\n"; @@ -150,10 +150,10 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; // print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 45c557f68c9..47ad635977e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3735,7 +3735,7 @@ elseif ($id > 0 || ! empty($ref)) print $langs->trans('DateInvoice'); print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) - print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . ''; print ''; print ''; @@ -3759,7 +3759,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; - print ''; + print ''; print '
'; print $langs->trans('DatePointOfTax'); print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; print ''; if ($action == 'editdate_pointoftax') { @@ -3776,7 +3776,7 @@ elseif ($id > 0 || ! empty($ref)) print $langs->trans('PaymentConditionsShort'); print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $usercancreate) - print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . ''; print ''; print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE) @@ -3797,7 +3797,7 @@ elseif ($id > 0 || ! empty($ref)) print $langs->trans('DateMaxPayment'); print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $usercancreate) - print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . ''; print ''; print ''; if ($object->type != Facture::TYPE_CREDIT_NOTE) @@ -3821,7 +3821,7 @@ elseif ($id > 0 || ! empty($ref)) print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && $usercancreate) - print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . ''; print ''; print ''; if ($action == 'editmode') @@ -3844,7 +3844,7 @@ elseif ($id > 0 || ! empty($ref)) print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($usercancreate && $action != 'editmulticurrencycode' && ! empty($object->brouillon)) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; print ''; $htmlname = (($usercancreate && $action == 'editmulticurrencycode')?'multicurrency_code':'none'); @@ -3857,7 +3857,7 @@ elseif ($id > 0 || ! empty($ref)) print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($usercancreate && $action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; print ''; if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { @@ -3882,7 +3882,7 @@ elseif ($id > 0 || ! empty($ref)) print $langs->trans('BankAccount'); print ''; if (($action != 'editbankaccount') && $usercancreate) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; print ''; print ''; if ($action == 'editbankaccount') @@ -3902,7 +3902,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($usercancreate) print ''.img_edit().''; else print ' '; print '
'; @@ -3979,7 +3979,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $usercancreate) { - print 'id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . ''; } print ''; print ''; @@ -4062,9 +4062,9 @@ elseif ($id > 0 || ! empty($ref)) print '' . $langs->trans('ListOfSituationInvoices') . ''; print ''; print '' . $langs->trans('Situation') . ''; - if (! empty($conf->banque->enabled)) print ''; - print '' . $langs->trans('AmountHT') . ''; - print '' . $langs->trans('AmountTTC') . ''; + if (! empty($conf->banque->enabled)) print ''; + print '' . $langs->trans('AmountHT') . ''; + print '' . $langs->trans('AmountTTC') . ''; print ' '; print ''; @@ -4085,10 +4085,10 @@ elseif ($id > 0 || ! empty($ref)) print '' . $prev_invoice->getNomUrl(1) . ''; print ''; print ''.(($prev_invoice->type == Facture::TYPE_CREDIT_NOTE)?$langs->trans('situationInvoiceShortcode_AS'):$langs->trans('situationInvoiceShortcode_S')) . $prev_invoice->situation_counter.''; - if (! empty($conf->banque->enabled)) print ''; - print '' . price($prev_invoice->total_ht) . ''; - print '' . price($prev_invoice->total_ttc) . ''; - print '' . $prev_invoice->getLibStatut(3, $totalpaye) . ''; + if (! empty($conf->banque->enabled)) print ''; + print '' . price($prev_invoice->total_ht) . ''; + print '' . price($prev_invoice->total_ttc) . ''; + print '' . $prev_invoice->getLibStatut(3, $totalpaye) . ''; print ''; } } @@ -4103,15 +4103,15 @@ elseif ($id > 0 || ! empty($ref)) print '' . $object->getNomUrl(1) . ''; print ''; print ''.(($object->type == Facture::TYPE_CREDIT_NOTE)?$langs->trans('situationInvoiceShortcode_AS'):$langs->trans('situationInvoiceShortcode_S')) . $object->situation_counter.''; - if (! empty($conf->banque->enabled)) print ''; - print '' . price($object->total_ht) . ''; - print '' . price($object->total_ttc) . ''; - print '' . $object->getLibStatut(3, $object->getSommePaiement()) . ''; + if (! empty($conf->banque->enabled)) print ''; + print '' . price($object->total_ht) . ''; + print '' . price($object->total_ttc) . ''; + print '' . $object->getLibStatut(3, $object->getSommePaiement()) . ''; print ''; print ''; - print '' . $langs->trans('CurrentSituationTotal') . ''; + print '' . $langs->trans('CurrentSituationTotal') . ''; print ''; $i =0; foreach ($current_situation_counter as $sit) @@ -4124,8 +4124,8 @@ elseif ($id > 0 || ! empty($ref)) } print ''; if (! empty($conf->banque->enabled)) print ''; - print '' . price($total_global_ht) . ''; - print '' . price($total_global_ttc) . ''; + print '' . price($total_global_ht) . ''; + print '' . price($total_global_ttc) . ''; print ' '; print ''; @@ -4136,9 +4136,9 @@ elseif ($id > 0 || ! empty($ref)) print '' . $langs->trans('ListOfNextSituationInvoices') . ''; print ''; print ''; - if (! empty($conf->banque->enabled)) print ''; - print '' . $langs->trans('AmountHT') . ''; - print '' . $langs->trans('AmountTTC') . ''; + if (! empty($conf->banque->enabled)) print ''; + print '' . $langs->trans('AmountHT') . ''; + print '' . $langs->trans('AmountTTC') . ''; print ' '; print '';*/ @@ -4153,10 +4153,10 @@ elseif ($id > 0 || ! empty($ref)) print '' . $next_invoice->getNomUrl(1) . ''; print ''; print ''.(($next_invoice->type == Facture::TYPE_CREDIT_NOTE)?$langs->trans('situationInvoiceShortcode_AS'):$langs->trans('situationInvoiceShortcode_S')) . $next_invoice->situation_counter.''; - if (! empty($conf->banque->enabled)) print ''; - print '' . price($next_invoice->total_ht) . ''; - print '' . price($next_invoice->total_ttc) . ''; - print '' . $next_invoice->getLibStatut(3, $totalpaye) . ''; + if (! empty($conf->banque->enabled)) print ''; + print '' . price($next_invoice->total_ht) . ''; + print '' . price($next_invoice->total_ttc) . ''; + print '' . $next_invoice->getLibStatut(3, $totalpaye) . ''; print ''; } @@ -4164,10 +4164,10 @@ elseif ($id > 0 || ! empty($ref)) $total_global_ttc += $total_next_ttc; print ''; - print ''; - if (! empty($conf->banque->enabled)) print ''; - print '' . price($total_global_ht) . ''; - print '' . price($total_global_ttc) . ''; + print ''; + if (! empty($conf->banque->enabled)) print ''; + print '' . price($total_global_ht) . ''; + print '' . price($total_global_ttc) . ''; print ' '; print ''; } @@ -4186,9 +4186,9 @@ elseif ($id > 0 || ! empty($ref)) print '' . $langs->trans('Date') . ''; print '' . $langs->trans('Type') . ''; if (! empty($conf->banque->enabled)) { - print '' . $langs->trans('BankAccount') . ''; + print '' . $langs->trans('BankAccount') . ''; } - print '' . $langs->trans('Amount') . ''; + print '' . $langs->trans('Amount') . ''; print ' '; print ''; @@ -4243,12 +4243,12 @@ elseif ($id > 0 || ! empty($ref)) $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); } - print ''; + print ''; if ($bankaccountstatic->id) print $bankaccountstatic->getNomUrl(1, 'transactions'); print ''; } - print '' . price($sign * $objp->amount) . ''; + print '' . price($sign * $objp->amount) . ''; print ''; if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { @@ -4272,12 +4272,12 @@ elseif ($id > 0 || ! empty($ref)) if ($object->type != Facture::TYPE_CREDIT_NOTE) { // Total already paid - print ''; + print ''; if ($object->type != Facture::TYPE_DEPOSIT) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); else print $langs->trans('AlreadyPaid'); - print ' : 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' '; + print ' : 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' '; $resteapayeraffiche = $resteapayer; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; @@ -4297,15 +4297,15 @@ elseif ($id > 0 || ! empty($ref)) while ($i < $num) { $obj = $db->fetch_object($resql); $invoice->fetch($obj->fk_facture_source); - print ''; + print ''; if ($invoice->type == Facture::TYPE_CREDIT_NOTE) print $langs->trans("CreditNote") . ' '; if ($invoice->type == Facture::TYPE_DEPOSIT) print $langs->trans("Deposit") . ' '; print $invoice->getNomUrl(0); print ' :'; - print '' . price($obj->amount_ttc) . ''; - print ''; + print '' . price($obj->amount_ttc) . ''; + print ''; print 'rowid . '">' . img_delete() . ''; print ''; $i ++; @@ -4320,51 +4320,51 @@ elseif ($id > 0 || ! empty($ref)) // Paye partiellement 'escompte' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'discount_vat') { - print ''; + print ''; print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); - print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; + print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; $resteapayeraffiche = 0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'badcustomer' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'badcustomer') { - print ''; + print ''; print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); - print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; + print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; // $resteapayeraffiche=0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'product_returned' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'product_returned') { - print ''; + print ''; print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); - print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; + print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; $resteapayeraffiche = 0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'abandon' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'abandon') { - print ''; + print ''; $text = $langs->trans("HelpAbandonOther"); if ($object->close_note) $text .= '

' . $langs->trans("Reason") . ':' . $object->close_note; print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); - print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; + print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; $resteapayeraffiche = 0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Billed - print '' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' '; + print '' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' '; // Remainder to pay - print ''; + print ''; if ($resteapayeraffiche >= 0) print $langs->trans('RemainderToPay'); else print $langs->trans('ExcessReceived'); print ' :'; - print '' . price($resteapayeraffiche) . ''; + print '' . price($resteapayeraffiche) . ''; print ' '; } else // Credit note @@ -4372,26 +4372,26 @@ elseif ($id > 0 || ! empty($ref)) $cssforamountpaymentcomplete='amountpaymentneutral'; // Total already paid back - print ''; + print ''; print $langs->trans('AlreadyPaidBack'); - print ' :' . price($sign * $totalpaye) . ' '; + print ' :' . price($sign * $totalpaye) . ' '; // Billed - print '' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' '; + print '' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' '; // Remainder to pay back - print ''; + print ''; if ($resteapayeraffiche <= 0) print $langs->trans('RemainderToPayBack'); else print $langs->trans('ExcessPaid'); print ' :'; - print '' . price($sign * $resteapayeraffiche) . ''; + print '' . price($sign * $resteapayeraffiche) . ''; print ' '; // Sold credit note - // print ''.$langs->trans('TotalTTC').' :'; - // print ''.price($sign * + // print ''.$langs->trans('TotalTTC').' :'; + // print ''.price($sign * // $object->total_ttc).' '; } @@ -4444,20 +4444,20 @@ elseif ($id > 0 || ! empty($ref)) print ' '; } print '' . $langs->trans('ModifyAllLines') . ''; - print ' '; - print ' '; - if ($inputalsopricewithtax) print ' '; - print ' '; - print ' '; - print '' . $langs->trans('Progress') . ''; + print ' '; + print ' '; + if ($inputalsopricewithtax) print ' '; + print ' '; + print ' '; + print '' . $langs->trans('Progress') . ''; if (! empty($conf->margin->enabled) && empty($user->societe_id)) { - print ' '; + print ' '; if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $usercanreadallmargin) { - print ' '; + print ' '; } } - print ' '; + print ' '; print ' '; print ' '; print ' '; @@ -4473,8 +4473,8 @@ elseif ($id > 0 || ! empty($ref)) print ' '; print ' '; print ' '; - print '%'; - print ''; + print '%'; + print ''; print ''; print ''; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index be867a66c99..6fe0391d688 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -837,12 +837,12 @@ if (empty($reshook)) $type = GETPOST('type'); $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); - // Check parameters - if (GETPOST('type') < 0) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - $error ++; - } + // Check parameters + if (GETPOST('type') < 0) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); + $error ++; } + } if ($qty < 0) { $langs->load("errors"); setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); @@ -1481,13 +1481,13 @@ else } else { - if ($object->frequency > 0) - { - print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); - } - else - { - print $langs->trans("NotARecurringInvoiceTemplate"); + if ($object->frequency > 0) + { + print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); + } + else + { + print $langs->trans("NotARecurringInvoiceTemplate"); } } print ''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 575471fda0e..87301a4c9b6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -582,12 +582,12 @@ if ($resql) } if ($user->rights->facture->supprimer) { if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) { - $arrayofmassactions['predeletedraft'] = $langs->trans("Deletedraft"); + $arrayofmassactions['predeletedraft'] = $langs->trans("Deletedraft"); } - elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation - $arrayofmassactions['predelete'] = $langs->trans("Delete"); - } - } + elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation + $arrayofmassactions['predelete'] = $langs->trans("Delete"); + } + } if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 31dcac4f340..5d8fee98676 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -284,12 +284,12 @@ print '
'; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; $oldyear=0; @@ -302,23 +302,23 @@ foreach ($data as $val) print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; } print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; $oldyear=$year; } diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index bc23384fe92..d184fb58966 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -51,7 +51,7 @@ foreach($linkedObjectBlock as $key => $objectlink) - - - + + 1) - - - + + + $objectlink) - - - + + 1) - - - + + + '; print '\n"; print "\n"; -if ($resql) -{ - if ($row = $db->fetch_row($resql) ) - { - $num = $row[0]; +if ($resql) { + if ($row = $db->fetch_row($resql) ) { + $num = $row[0]; } - print ''; - print ''; - print ''; - print "
'.$langs->trans("Year").''.$langs->trans("NumberOfBills").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%'.$langs->trans("NumberOfBills").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%
0?'&userid='.$userid:'').'">'.$oldyear.'000000
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'], 'MT'), 1).''.round($val['total_diff']).''.price(price2num($val['avg'], 'MT'), 1).''.round($val['avg_diff']).''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'], 'MT'), 1).''.round($val['total_diff']).''.price(price2num($val['avg'], 'MT'), 1).''.round($val['avg_diff']).'
getNomUrl(1); ?> ref_client; ?> date, 'day'); ?>rights->facture->lire) { $sign = 1; if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1; @@ -65,8 +65,8 @@ foreach($linkedObjectBlock as $key => $objectlink) echo ''.price($objectlink->total_ht).''; } } ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
getNomUrl(1); ?> date_when, 'day'); ?>rights->facture->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'.$langs->trans("BankChecks")."
'.$langs->trans("BankChecksToReceipt").''; - print ''.$num.''; - print '
\n"; + print ''; + print ''.$langs->trans("BankChecksToReceipt").''; + print ''; + print ''.$num.''; + print ''; + print "\n"; } else { - dol_print_error($db); + dol_print_error($db); } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 28486e41670..3407da6adb3 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -553,8 +553,8 @@ class Paiement extends CommonObject { $this->db->rollback(); return -1; - } - // End call triggers + } + // End call triggers } // Delete payment (into paiement_facture and paiement) diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 66f34d8e616..3d2e2ef94f0 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -88,8 +88,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $nbtotalofrecords = $db->num_rows($result); if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 { - $page = 0; - $offset = 0; + $page = 0; + $offset = 0; } } @@ -98,89 +98,89 @@ $sql.= $db->plimit($limit + 1, $offset); $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result); - $i = 0; + $num = $db->num_rows($result); + $i = 0; - $urladd= "&statut=".$statut; + $urladd= "&statut=".$statut; - $selectedfields=''; + $selectedfields=''; - $newcardbutton=''; - if ($user->rights->prelevement->bons->creer) - { - $newcardbutton = ''.$langs->trans('NewStandingOrder').''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } - - // Lines of title fields - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit); - - $moreforfilter=''; - - print '
'; - print ''."\n"; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', '', 'class="liste_titre"', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", "", 'class="liste_titre" align="center"', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "p.amount", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; - print "\n"; - - while ($i < min($num, $limit)) - { - $obj = $db->fetch_object($result); - - print '\n"; - - print '\n"; - - print '\n"; - - print ''; - - print ''."\n"; - - print "\n"; - $i++; + $newcardbutton=''; + if ($user->rights->prelevement->bons->creer) + { + $newcardbutton = ''.$langs->trans('NewStandingOrder').''; + $newcardbutton.= ''; + $newcardbutton.= ''; } - print "
  '; - $searchpicto=$form->showFilterButtons(); - print $searchpicto; - print '
'; - - print ''.$obj->ref."'.dol_print_date($db->jdate($obj->datec), 'day')."'.price($obj->amount)."'; - print $bon->LibStatut($obj->statut, 3); - print '
"; - print '
'; - print ''; + // Lines of title fields + print '
'; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $db->free($result); + print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit); + + $moreforfilter=''; + + print '
'; + print ''."\n"; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', '', 'class="liste_titre"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", "", 'class="liste_titre" align="center"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "p.amount", "", "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; + print "\n"; + + while ($i < min($num, $limit)) + { + $obj = $db->fetch_object($result); + + print '\n"; + + print '\n"; + + print '\n"; + + print ''; + + print ''."\n"; + + print "\n"; + $i++; + } + print "
  '; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
'; + + print ''.$obj->ref."'.dol_print_date($db->jdate($obj->datec), 'day')."'.price($obj->amount)."'; + print $bon->LibStatut($obj->statut, 3); + print '
"; + print '
'; + + print '
'; + + $db->free($result); } else { - dol_print_error($db); + dol_print_error($db); } // End of page diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 0d72badd09c..c3a4fa8556d 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -162,9 +162,9 @@ if ($nb) { } else { print '' . $langs->trans("CreateAll") . "\n"; } - } - else - { + } + else + { if ($mysoc->isInEEC()) { print ''.$langs->trans("CreateForSepaFRST")."\n"; @@ -178,7 +178,7 @@ if ($nb) { } else { - print 'transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."\n"; + print 'transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."\n"; } print "
\n"; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 0615c2b6a52..7bf98b80452 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -59,9 +59,9 @@ $date_endmonth = GETPOST("date_endmonth"); $date_endday = GETPOST("date_endday"); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); - $month_current = strftime("%m", dol_now()); - $year_start = $year_current; + $year_current = strftime("%Y", dol_now()); + $month_current = strftime("%m", dol_now()); + $year_start = $year_current; } else { $year_current = $year; $month_current = strftime("%m", dol_now()); @@ -211,7 +211,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql.= " WHERE f.fk_statut in (1,2)"; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql.= " AND f.type IN (0,1,2,5)"; - } else { + } else { $sql.= " AND f.type IN (0,1,2,3,5)"; } if ($date_start && $date_end) { @@ -243,12 +243,12 @@ if ($result) { $i=0; while ($i < $num) { $obj = $db->fetch_object($result); - $amount_ht[$obj->rowid] = $obj->amount; - $amount[$obj->rowid] = $obj->amount_ttc; - $name[$obj->rowid] = $obj->name.' '.$obj->firstname; - $catotal_ht+=$obj->amount; - $catotal+=$obj->amount_ttc; - $i++; + $amount_ht[$obj->rowid] = $obj->amount; + $amount[$obj->rowid] = $obj->amount_ttc; + $name[$obj->rowid] = $obj->name.' '.$obj->firstname; + $catotal_ht+=$obj->amount; + $catotal+=$obj->amount_ttc; + $i++; } } else { dol_print_error($db); @@ -302,7 +302,7 @@ print_liste_field_titre( "", $sortfield, $sortorder - ); +); if ($modecompta == 'CREANCES-DETTES') { print_liste_field_titre( $langs->trans('AmountHT'), @@ -313,8 +313,8 @@ if ($modecompta == 'CREANCES-DETTES') { 'align="right"', $sortfield, $sortorder - ); - } else { + ); +} else { print_liste_field_titre(''); } print_liste_field_titre( @@ -326,7 +326,7 @@ print_liste_field_titre( 'align="right"', $sortfield, $sortorder - ); +); print_liste_field_titre( $langs->trans("Percentage"), $_SERVER["PHP_SELF"], "amount_ttc", @@ -335,7 +335,7 @@ print_liste_field_titre( 'align="right"', $sortfield, $sortorder - ); +); print_liste_field_titre( $langs->trans("OtherStatistics"), $_SERVER["PHP_SELF"], @@ -343,7 +343,7 @@ print_liste_field_titre( "", "", 'align="center" width="20%"' - ); +); print "\n"; if (count($amount)) { @@ -390,22 +390,22 @@ if (count($amount)) { } print "".$linkname."\n"; - // Amount w/o VAT + // Amount w/o VAT print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { - print ''; - } else { - print ''; - } + print ''; + } else { + print ''; + } } else { if ($key > 0) { - print ''; - } else { - print ''; - } - print price($amount_ht[$key]); + print ''; + } else { + print ''; + } + print price($amount_ht[$key]); } print ''; @@ -413,16 +413,16 @@ if (count($amount)) { print ''; if ($modecompta != 'CREANCES-DETTES') { if ($key > 0) { - print ''; - } else { - print ''; - } + print ''; + } else { + print ''; + } } else { if ($key > 0) { - print ''; - } else { - print ''; - } + print ''; + } else { + print ''; + } } print price($amount[$key]); print ''; @@ -433,14 +433,14 @@ if (count($amount)) { // Other stats print ''; if (! empty($conf->propal->enabled) && $key>0) { - print ' '.img_picto($langs->trans("ProposalStats"), "stats").' '; - } + print ' '.img_picto($langs->trans("ProposalStats"), "stats").' '; + } if (! empty($conf->commande->enabled) && $key>0) { - print ' '.img_picto($langs->trans("OrderStats"), "stats").' '; - } + print ' '.img_picto($langs->trans("OrderStats"), "stats").' '; + } if (! empty($conf->facture->enabled) && $key>0) { - print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' '; - } + print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' '; + } print ''; print "\n"; $i++; @@ -450,9 +450,9 @@ if (count($amount)) { print ''; print ''.$langs->trans("Total").''; if ($modecompta != 'CREANCES-DETTES') { - print ''; + print ''; } else { - print ''.price($catotal_ht).''; + print ''.price($catotal_ht).''; } print ''.price($catotal).''; print ' '; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index bd009c3b055..864dd6ef314 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -451,9 +451,9 @@ if ($modecompta == 'CREANCES-DETTES') { 'align="right"', $sortfield, $sortorder - ); - } else { - print_liste_field_titre(''); + ); +} else { + print_liste_field_titre(''); } print_liste_field_titre( $langs->trans("AmountTTC"), @@ -464,7 +464,7 @@ print_liste_field_titre( 'align="right"', $sortfield, $sortorder - ); +); print_liste_field_titre( $langs->trans("Percentage"), $_SERVER["PHP_SELF"], @@ -474,7 +474,7 @@ print_liste_field_titre( 'align="right"', $sortfield, $sortorder - ); +); print_liste_field_titre( $langs->trans("OtherStatistics"), $_SERVER["PHP_SELF"], @@ -482,7 +482,7 @@ print_liste_field_titre( "", "", 'align="center" width="20%"' - ); +); print "\n"; @@ -569,34 +569,34 @@ if (count($amount)) { // Amount w/o VAT print ''; if ($modecompta != 'CREANCES-DETTES') { - if ($key > 0) { - print ''; + if ($key > 0) { + print ''; } else { - print ''; - } + print ''; + } } else { if ($key > 0) { - print ''; + print ''; } else { - print ''; + print ''; } - print price($amount_ht[$key]); + print price($amount_ht[$key]); } print ''; // Amount with VAT print ''; if ($modecompta != 'CREANCES-DETTES') { - if ($key > 0) { - print ''; + if ($key > 0) { + print ''; } else { - print ''; + print ''; } } else { - if ($key > 0) { - print ''; + if ($key > 0) { + print ''; } else { - print ''; + print ''; } } print price($amount[$key]); @@ -609,18 +609,18 @@ if (count($amount)) { // Other stats print ''; if (! empty($conf->propal->enabled) && $key>0) { - print ' '.img_picto($langs->trans("ProposalStats"), "stats").' '; - } + print ' '.img_picto($langs->trans("ProposalStats"), "stats").' '; + } if (! empty($conf->commande->enabled) && $key>0) { - print ' '.img_picto($langs->trans("OrderStats"), "stats").' '; - } + print ' '.img_picto($langs->trans("OrderStats"), "stats").' '; + } if (! empty($conf->facture->enabled) && $key>0) { - print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' '; - } + print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' '; + } print ''; - print "\n"; - $i++; - } + print "\n"; + $i++; + } // Total print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 633c1dbf77b..67b3900ec06 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1010,7 +1010,8 @@ class Contact extends CommonObject } // Removed extrafields - if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) { // For avoid conflicts if trigger used + if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) { + // For avoid conflicts if trigger used $result=$this->deleteExtraFields($this); if ($result < 0) $error++; } diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 0e975b18e9e..b93c9db55d5 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -186,9 +186,9 @@ class Contracts extends DolibarrApi */ function post($request_data = null) { - if(! DolibarrApiAccess::$user->rights->contrat->creer) { - throw new RestException(401, "Insuffisant rights"); - } + if(! DolibarrApiAccess::$user->rights->contrat->creer) { + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -220,9 +220,9 @@ class Contracts extends DolibarrApi */ function getLines($id) { - if(! DolibarrApiAccess::$user->rights->contrat->lire) { + if (! DolibarrApiAccess::$user->rights->contrat->lire) { throw new RestException(401); - } + } $result = $this->contract->fetch($id); if( ! $result ) { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 1d6789d4e38..42d138402e9 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -367,6 +367,8 @@ abstract class CommonDocGenerator global $conf; $sumpayed=$sumdeposit=$sumcreditnote=''; + $already_payed_all=0; + $remain_to_pay=0; if ($object->element == 'facture') { $invoice_source=new Facture($this->db); @@ -377,6 +379,8 @@ abstract class CommonDocGenerator $sumpayed = $object->getSommePaiement(); $sumdeposit = $object->getSumDepositsUsed(); $sumcreditnote = $object->getSumCreditNotesUsed(); + $already_payed_all=$sumpayed + $sumdeposit + $sumcreditnote; + $remain_to_pay=$sumpayed - $sumdeposit - $sumcreditnote; } $date = ($object->element == 'contrat' ? $object->date_contrat : $object->date); @@ -438,12 +442,12 @@ abstract class CommonDocGenerator $array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs), $array_key.'_already_creditnote'=>price2num($sumcreditnote), - $array_key.'_already_payed_all_locale'=>price(price2num($sumpayed + $sumdeposit + $sumcreditnote, 'MT'), 0, $outputlangs), - $array_key.'_already_payed_all'=> price2num(($sumpayed + $sumdeposit + $sumcreditnote), 'MT'), + $array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs), + $array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'), // Remain to pay with all know infrmation (except open direct debit requests) - $array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT'), 0, $outputlangs), - $array_key.'_remain_to_pay'=>price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT') + $array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $remain_to_pay, 'MT'), 0, $outputlangs), + $array_key.'_remain_to_pay'=>price2num($object->total_ttc - $remain_to_pay, 'MT') ); if (method_exists($object, 'getTotalDiscount')) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 132e1b0a674..7fe050d8c59 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5434,8 +5434,7 @@ abstract class CommonObject elseif (in_array($type, array('int','integer','price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type)) { $morecss = 'maxwidth75'; - }elseif ($type == 'url') - { + } elseif ($type == 'url') { $morecss='minwidth400'; } elseif ($type == 'boolean') diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 89c1746ea76..3ed57a60aec 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1470,43 +1470,43 @@ class Form $contactstatic->id=$obj->rowid; $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=$obj->firstname; - if ($obj->statut == 1){ - if ($htmlname != 'none') - { - $disabled=0; - if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) $disabled=1; - if (is_array($limitto) && count($limitto) && ! in_array($obj->rowid, $limitto)) $disabled=1; - if (!empty($selected) && in_array($obj->rowid, $selected)) - { - $out.= ''; - } - else - { - $out.= ''; - } - } - else - { - if (in_array($obj->rowid, $selected)) - { - $out.= $contactstatic->getFullName($langs); - if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')'; - if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')'; - } - } - } + if ($obj->statut == 1) { + if ($htmlname != 'none') + { + $disabled=0; + if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) $disabled=1; + if (is_array($limitto) && count($limitto) && ! in_array($obj->rowid, $limitto)) $disabled=1; + if (!empty($selected) && in_array($obj->rowid, $selected)) + { + $out.= ''; + } + else + { + $out.= ''; + } + } + else + { + if (in_array($obj->rowid, $selected)) + { + $out.= $contactstatic->getFullName($langs); + if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')'; + if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')'; + } + } + } $i++; } } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 58c9950898c..282320444cd 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -888,4 +888,55 @@ class FormCompany } } } + + /** + * Return a HTML select for thirdparty type + * + * @param int $selected selected value + * @param string $htmlname HTML select name + * @param string $htmlidname HTML select id + * @param string $typeinput HTML output + * @param string $morecss More css + * @return string HTML string + */ + function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '') + { + + global $conf,$langs; + + $out = ''; + + return $out; + } } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 4cb2ebad882..9bf04b4ee1e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1346,7 +1346,7 @@ class FormFile print 'browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"').'>'; print ''; } - } + } } else { diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 780c87b3fcf..16c1f54ee31 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -713,5 +713,5 @@ class Menubase $this->recur($tab, $tab[$x]['rowid'], ($level+1)); } } - } + } } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 729470711e2..1145be1849b 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -152,6 +152,8 @@ class DoliDBPgsql extends DoliDB */ static function convertSQLFromMysql($line, $type = 'auto', $unescapeslashquot = false) { + global $conf; + // Removed empty line if this is a comment line for SVN tagging if (preg_match('/^--\s\$Id/i', $line)) { return ''; @@ -311,7 +313,14 @@ class DoliDBPgsql extends DoliDB } // To have postgresql case sensitive - $line=str_replace(' LIKE \'', ' ILIKE \'', $line); + $count_like=0; + $line=str_replace(' LIKE \'', ' ILIKE \'', $line, $count_like); + if (!empty($conf->global->PSQL_USE_UNACCENT) && $count_like > 0) + { + // @see https://docs.postgresql.fr/11/unaccent.html : 'unaccent()' function must be installed before + $line=preg_replace('/\s+(\(+\s*)([a-zA-Z0-9\-\_\.]+) ILIKE /', ' \1unaccent(\2) ILIKE ', $line); + } + $line=str_replace(' LIKE BINARY \'', ' LIKE \'', $line); // Replace INSERT IGNORE into INSERT diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 467bef6bb23..1ff024d6c6f 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1403,32 +1403,28 @@ class DoliDBSqlite3 extends DoliDB $weekday=self::calc_weekday($first_daynr, !$monday_first); $calc_year=$year; - if ($month == 1 && $day <= 7-$weekday) - { + if ($month == 1 && $day <= 7-$weekday) { if (!$week_year && (($first_weekday && $weekday != 0) || (!$first_weekday && $weekday >= 4))) return 0; $week_year= 1; $calc_year--; $first_daynr-= ($days=self::calc_days_in_year($calc_year)); $weekday= ($weekday + 53*7- $days) % 7; - } - - if (($first_weekday && $weekday != 0) || (!$first_weekday && $weekday >= 4)) { - $days= $daynr - ($first_daynr+ (7-$weekday)); - } - else { - $days= $daynr - ($first_daynr - $weekday); - } - - if ($week_year && $days >= 52*7) - { - $weekday= ($weekday + self::calc_days_in_year($calc_year)) % 7; - if ((!$first_weekday && $weekday < 4) || ($first_weekday && $weekday == 0)) - { - $calc_year++; - return 1; } - } - return floor($days/7+1); + + if (($first_weekday && $weekday != 0) || (!$first_weekday && $weekday >= 4)) { + $days= $daynr - ($first_daynr+ (7-$weekday)); + } else { + $days= $daynr - ($first_daynr - $weekday); + } + + if ($week_year && $days >= 52*7) { + $weekday= ($weekday + self::calc_days_in_year($calc_year)) % 7; + if ((!$first_weekday && $weekday < 4) || ($first_weekday && $weekday == 0)) { + $calc_year++; + return 1; + } + } + return floor($days/7+1); } } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 10fc1f3c900..986a566aa66 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1469,7 +1469,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. - if (! empty($conf->mailing->enabled) && ! empty($objcon->email) && (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) + if (! empty($conf->mailing->enabled) && ! empty($objcon->email)) { $langs->load("mails"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7b2d95a2fea..67217f9837f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2365,9 +2365,10 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli {//ex: +66_A_BCD_EF_GHI $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 3); } - } + } elseif (strtoupper($countrycode) == "MU") - {//Maurice + { + //Maurice if(dol_strlen($phone) == 11) {//ex: +230_ABC_DE_FG $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); @@ -2514,9 +2515,11 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli } } elseif(strtoupper($countrycode) == "AU") - {//Australie - if(dol_strlen($phone) == 12) - {//ex: +61_A_BCDE_FGHI + { + //Australie + if(dol_strlen($phone) == 12) + { + //ex: +61_A_BCDE_FGHI $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4); } } @@ -2593,7 +2596,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $rep.=($withpicto?img_picto($titlealt, 'object_'.$picto.'.png').' ':'').$newphone; if ($adddivfloat) $rep.='
'; else $rep.=''; - } + } return $rep; } @@ -5887,10 +5890,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REF__'] = $object->ref; $substitutionarray['__REF_CLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); + $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): ''); // For backward compatibility $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); - $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): ''); // TODO Remove this $msgishtml = 0; @@ -7085,7 +7088,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, } elseif (count($values) == 5) // deprecated { - dol_syslog('Passing 5 values in tabs module_parts is deprecated. Please update to 6 with permissions.', LOG_WARNING); + dol_syslog('Passing 5 values in tabs module_parts is deprecated. Please update to 6 with permissions.', LOG_WARNING); if ($values[0] != $type) continue; if ($values[3]) $langs->load($values[3]); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6956859aa03..a84edde3de9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -900,7 +900,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // First line of company infos $line1=""; $line2=""; $line3=""; $line4=""; - if ($showdetails == 1 || $showdetails == 3) + if ($showdetails == 1 || $showdetails == 3) { // Company name if ($fromcompany->name) @@ -1969,9 +1969,9 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) } else $result.=price($sign * $total_ht, 0, $outputlangs); - } + } } - return $result; + return $result; } /** diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 52b1b669dd5..f2287d6a69e 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -667,6 +667,10 @@ function dolSavePageContent($filetpl, $object, $objectpage) $tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent.= "ob_start();\n"; $tplcontent.= "// END PHP ?>\n"; + if (! empty($conf->global->WEBSITE_FORCE_DOCTYPE_HTML5)) + { + $tplcontent.= "\n"; + } $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; $tplcontent.= ''.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').''."\n"; diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 31646b9f852..8182b479aa9 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; /** - * Classe permettant de generer les projets au modele SEPAMandate + * Class to generate SEPA mandate */ class pdf_sepamandate extends ModeleBankAccountDoc diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 93d097856b6..db38ef45452 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -768,23 +768,22 @@ class pdf_einstein extends ModelePDFCommandes $posy=$pdf->GetY()+1; } - // Show payment mode + // Show payment mode if ($object->mode_reglement_code - && $object->mode_reglement_code != 'CHQ' - && $object->mode_reglement_code != 'VIR') - { - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->SetXY($this->marge_gauche, $posy); - $titre = $outputlangs->transnoentities("PaymentMode").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); + && $object->mode_reglement_code != 'CHQ' + && $object->mode_reglement_code != 'VIR') { + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetXY($this->marge_gauche, $posy); + $titre = $outputlangs->transnoentities("PaymentMode").':'; + $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posxval, $posy); - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); - $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posxval, $posy); + $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); + $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); - $posy=$pdf->GetY()+2; - } + $posy=$pdf->GetY()+2; + } // Show payment mode CHQ if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index d33c1e40e4f..3cde5d4de0f 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -828,30 +828,29 @@ class pdf_eratosthene extends ModelePDFCommandes $posy=$pdf->GetY()+1; } - // Show payment mode + // Show payment mode if ($object->mode_reglement_code - && $object->mode_reglement_code != 'CHQ' - && $object->mode_reglement_code != 'VIR') - { - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->SetXY($this->marge_gauche, $posy); - $titre = $outputlangs->transnoentities("PaymentMode").':'; - $pdf->MultiCell(80, 5, $titre, 0, 'L'); + && $object->mode_reglement_code != 'CHQ' + && $object->mode_reglement_code != 'VIR') { + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetXY($this->marge_gauche, $posy); + $titre = $outputlangs->transnoentities("PaymentMode").':'; + $pdf->MultiCell(80, 5, $titre, 0, 'L'); - $pdf->SetFont('', '', $default_font_size - 2); - $pdf->SetXY($posxval, $posy); - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); - $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); + $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($posxval, $posy); + $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); + $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); - $posy=$pdf->GetY()+2; - } + $posy=$pdf->GetY()+2; + } // Show payment mode CHQ if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { - // Si mode reglement non force ou si force a CHQ - if (! empty($conf->global->FACTURE_CHQ_NUMBER)) - { + // Si mode reglement non force ou si force a CHQ + if (! empty($conf->global->FACTURE_CHQ_NUMBER)) + { if ($conf->global->FACTURE_CHQ_NUMBER > 0) { $account = new Account($this->db); 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 9bce1f0d849..d9c7b041c7f 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 @@ -294,12 +294,13 @@ class doc_generic_contract_odt extends ModelePDFContract if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; - else { - $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use - $contactobject = $object->contact; - } + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $socobject = $object->contact; + } else { + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } } else { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 2b7fba96c5c..4765c6b692d 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -739,7 +739,7 @@ class pdf_crabe extends ModelePDFFactures // Affiche zone versements if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) { - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); + $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs, $heightforfooter); } // Pied de page @@ -785,9 +785,10 @@ class pdf_crabe extends ModelePDFFactures * @param Object $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output + * @param int $heightforfooter height for footer * @return int <0 if KO, >0 if OK */ - function _tableau_versements(&$pdf, $object, $posy, $outputlangs) + function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0) { // phpcs:enable global $conf; @@ -795,6 +796,7 @@ class pdf_crabe extends ModelePDFFactures $sign=1; if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; + $current_page = $pdf->getPage(); $tab3_posx = 120; $tab3_top = $posy + 8; $tab3_width = 80; @@ -806,26 +808,7 @@ class pdf_crabe extends ModelePDFFactures $default_font_size = pdf_getPDFFontSize($outputlangs); - $title=$outputlangs->transnoentities("PaymentsAlreadyDone"); - if ($object->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone"); - - $pdf->SetFont('', '', $default_font_size - 3); - $pdf->SetXY($tab3_posx, $tab3_top - 4); - $pdf->MultiCell(60, 3, $title, 0, 'L', 0); - - $pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top); - - $pdf->SetFont('', '', $default_font_size - 4); - $pdf->SetXY($tab3_posx, $tab3_top); - $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0); - $pdf->SetXY($tab3_posx+21, $tab3_top); - $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0); - $pdf->SetXY($tab3_posx+40, $tab3_top); - $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0); - $pdf->SetXY($tab3_posx+58, $tab3_top); - $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0); - - $pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); + $this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height); $y=0; @@ -847,6 +830,17 @@ class pdf_crabe extends ModelePDFFactures while ($i < $num) { $y+=3; + if ($tab3_top+$y >= ($this->page_hauteur - $heightforfooter)) + { + $y=0; + $current_page++; + $pdf->AddPage('', '', true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($current_page); + $this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top+$y-3, $tab3_width, $tab3_height); + } + $obj = $this->db->fetch_object($resql); if ($obj->type == 2) $text=$outputlangs->transnoentities("CreditNote"); @@ -893,6 +887,17 @@ class pdf_crabe extends ModelePDFFactures $i=0; while ($i < $num) { $y+=3; + if ($tab3_top+$y >= ($this->page_hauteur - $heightforfooter)) + { + $y=0; + $current_page++; + $pdf->AddPage('', '', true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($current_page); + $this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top+$y-3, $tab3_width, $tab3_height); + } + $row = $this->db->fetch_object($resql); $pdf->SetXY($tab3_posx, $tab3_top+$y); @@ -918,6 +923,44 @@ class pdf_crabe extends ModelePDFFactures } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Function _tableau_versements_header + * + * @param TCPDF $pdf Object PDF + * @param Facture $object Object invoice + * @param Translate $outputlangs Object langs for output + * @param int $default_font_size Font size + * @param int $tab3_posx pos x + * @param int $tab3_top pos y + * @param int $tab3_width width + * @param int $tab3_height height + * @return void + */ + function _tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height) + { + // phpcs:enable + $title=$outputlangs->transnoentities("PaymentsAlreadyDone"); + if ($object->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone"); + + $pdf->SetFont('', '', $default_font_size - 3); + $pdf->SetXY($tab3_posx, $tab3_top - 4); + $pdf->MultiCell(60, 3, $title, 0, 'L', 0); + + $pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top); + + $pdf->SetFont('', '', $default_font_size - 4); + $pdf->SetXY($tab3_posx, $tab3_top); + $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0); + $pdf->SetXY($tab3_posx+21, $tab3_top); + $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0); + $pdf->SetXY($tab3_posx+40, $tab3_top); + $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0); + $pdf->SetXY($tab3_posx+58, $tab3_top); + $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0); + + $pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** @@ -1292,31 +1335,27 @@ class pdf_crabe extends ModelePDFFactures foreach($localtax_rate as $tvakey => $tvaval) { - // 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 if (price2num($object->revenuestamp) != 0) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 2b818d907ae..098ef40ff4a 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1377,8 +1377,8 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } - //} - } + } + //} // Revenue stamp if (price2num($object->revenuestamp) != 0) diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 85b032b7967..08f3449d940 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/fichinter/modules_fichinter.php'; */ class mod_arctic extends ModeleNumRefFicheinter { - /** + /** * Dolibarr version of the loaded document * @public string */ @@ -130,7 +130,7 @@ class mod_arctic extends ModeleNumRefFicheinter require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; - // On d�fini critere recherche compteur + // On défini critere recherche compteur $mask=$conf->global->FICHINTER_ARTIC_MASK; if (! $mask) @@ -142,14 +142,14 @@ class mod_arctic extends ModeleNumRefFicheinter $numFinal=get_next_value($db, $mask, 'fichinter', 'ref', '', $objsoc, $object->datec); return $numFinal; - } + } /** - * Return next free value + * Return next free value * * @param Societe $objsoc Object third party - * @param Object $objforref Object for number to search + * @param Object $objforref Object for number to search * @return string Next free value */ function getNumRef($objsoc, $objforref) diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index ac70a4d39ca..59b102ecfe7 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012 Juanjo Menent +/* Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -321,12 +321,13 @@ class doc_generic_product_odt extends ModelePDFProduct if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; - else { - $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use - $contactobject = $object->contact; - } + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $socobject = $object->contact; + } else { + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } } else { diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 2bae7a9cd07..6e7ab4001f6 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -425,19 +425,19 @@ class pdf_beluga extends ModelePDFProjects $total_ttc = 0; $num = count($elementarray); - // Loop on each lines - for ($i = 0; $i < $num; $i ++) - { - $curY = $nexY; - $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage - $pdf->SetTextColor(0, 0, 0); + // Loop on each lines + for ($i = 0; $i < $num; $i ++) + { + $curY = $nexY; + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0, 0, 0); - $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. - $pageposbefore=$pdf->getPage(); + $pdf->setTopMargin($tab_top_newpage); + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore=$pdf->getPage(); - // Description of line - $idofelement=$elementarray[$i]; + // Description of line + $idofelement=$elementarray[$i]; if ($classname == 'ExpenseReport') { // We get id of expense report @@ -457,114 +457,114 @@ class pdf_beluga extends ModelePDFProjects $qualifiedfortotal = false; // Replacement invoice } - $showpricebeforepagebreak=1; + $showpricebeforepagebreak=1; - $pdf->startTransaction(); - // Label - $pdf->SetXY($this->posxref, $curY); - $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); - $pageposafter=$pdf->getPage(); - if ($pageposafter > $pageposbefore) // There is a pagebreak - { - $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; - //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - // Label - $pdf->SetXY($this->posxref, $curY); - $posybefore=$pdf->GetY(); - $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); - $pageposafter=$pdf->getPage(); - $posyafter=$pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text - { - if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page - { - $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); - } - } - else - { - // We found a page break - $showpricebeforepagebreak=0; - $forcedesconsamepage=1; - if ($forcedesconsamepage) - { - $pdf->rollbackTransaction(true); - $pageposafter=$pageposbefore; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->startTransaction(); + // Label + $pdf->SetXY($this->posxref, $curY); + $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); + $pageposafter=$pdf->getPage(); + if ($pageposafter > $pageposbefore) // There is a pagebreak + { + $pdf->rollbackTransaction(true); + $pageposafter=$pageposbefore; + //print $pageposafter.'-'.$pageposbefore;exit; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + // Label + $pdf->SetXY($this->posxref, $curY); + $posybefore=$pdf->GetY(); + $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); + $pageposafter=$pdf->getPage(); + $posyafter=$pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page + { + $pdf->AddPage('', '', true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($pageposafter+1); + } + } + else + { + // We found a page break + $showpricebeforepagebreak=0; + $forcedesconsamepage=1; + if ($forcedesconsamepage) + { + $pdf->rollbackTransaction(true); + $pageposafter=$pageposbefore; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - $pdf->AddPage('', '', true); - if (! empty($tplidx)) $pdf->useTemplate($tplidx); - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pageposafter+1); - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut - $pdf->MultiCell(0, 3, ''); // Set interline to 3 - $pdf->SetTextColor(0, 0, 0); + $pdf->AddPage('', '', true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($pageposafter+1); + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->SetTextColor(0, 0, 0); - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - $curY = $tab_top_newpage + $heightoftitleline + 1; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $curY = $tab_top_newpage + $heightoftitleline + 1; - // Label - $pdf->SetXY($this->posxref, $curY); - $posybefore=$pdf->GetY(); - $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); - $pageposafter=$pdf->getPage(); - $posyafter=$pdf->GetY(); - } - } - //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); - } - else // No pagebreak - { - $pdf->commitTransaction(); - } - $posYAfterDescription=$pdf->GetY(); + // Label + $pdf->SetXY($this->posxref, $curY); + $posybefore=$pdf->GetY(); + $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); + $pageposafter=$pdf->getPage(); + $posyafter=$pdf->GetY(); + } + } + //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); + } + else // No pagebreak + { + $pdf->commitTransaction(); + } + $posYAfterDescription=$pdf->GetY(); - $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); - $pdf->setPage($pageposbefore); - $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $nexY = $pdf->GetY(); + $pageposafter=$pdf->getPage(); + $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - // We suppose that a too long description is moved completely on next page - if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - //var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak); - $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; - } + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { + //var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak); + $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; + } - $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut - // Date - if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') - $date = $element->date_commande; - else { - $date = $element->date; - if (empty($date)) - $date = $element->datep; - if (empty($date)) - $date = $element->date_contrat; - if (empty($date)) - $date = $element->datev; // Fiche inter - } + // Date + if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') + $date = $element->date_commande; + else { + $date = $element->date; + if (empty($date)) + $date = $element->datep; + if (empty($date)) + $date = $element->date_contrat; + if (empty($date)) + $date = $element->datev; // Fiche inter + } - $pdf->SetXY($this->posxdate, $curY); - $pdf->MultiCell($this->posxsociety - $this->posxdate, 3, dol_print_date($date, 'day'), 1, 'C'); + $pdf->SetXY($this->posxdate, $curY); + $pdf->MultiCell($this->posxsociety - $this->posxdate, 3, dol_print_date($date, 'day'), 1, 'C'); - $pdf->SetXY($this->posxsociety, $curY); - if ($classname == 'ExpenseReport') - { - $fuser=new User($this->db); - $fuser->fetch($element->fk_user_author); - $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L'); - } - else - { - $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty)?$element->thirdparty->name:''), 1, 'L'); - } + $pdf->SetXY($this->posxsociety, $curY); + if ($classname == 'ExpenseReport') + { + $fuser=new User($this->db); + $fuser->fetch($element->fk_user_author); + $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L'); + } + else + { + $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty)?$element->thirdparty->name:''), 1, 'L'); + } // Amount without tax if (empty($value['disableamount'])) { 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 a720263261c..bedcefb5d9c 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 @@ -336,10 +336,10 @@ class doc_generic_proposal_odt extends ModelePDFPropales // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { - $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use - $contactobject = $object->contact; - } + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } } else { 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 c449bc44103..2cfec34bcf8 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 @@ -321,12 +321,13 @@ class doc_generic_stock_odt extends ModelePDFStock if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; - else { - $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use - $contactobject = $object->contact; - } + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $socobject = $object->contact; + } else { + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } } else { diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 1975026afb5..67dde2b7efa 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -65,7 +65,7 @@ class doc_generic_user_odt extends ModelePDFUser global $conf, $langs, $mysoc; // Load translation files required by the page - $langs->loadLangs(array("main","companies")); + $langs->loadLangs(array("main","companies")); $this->db = $db; $this->name = "ODT templates"; @@ -318,10 +318,10 @@ class doc_generic_user_odt extends ModelePDFUser // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { - $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use - $contactobject = $object->contact; - } + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } } else { diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 4be32baf368..fc0992ea5b1 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -320,10 +320,10 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { - $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use - $contactobject = $object->contact; - } + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } } else { diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 9d715b82388..330ba78dc34 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -235,7 +235,10 @@ if ($permission) { - +
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 2f218fa8050..db830a9bb68 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -21,10 +21,9 @@ // Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) -{ - print "Error, template page can't be called as URL"; - exit; +if (empty($conf) || ! is_object($conf)) { + print "Error, template page can't be called as URL"; + exit; } @@ -61,19 +60,24 @@ print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disable $colorbackhmenu1='60,70,100'; // topmenu if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1; -$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' +$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' ?> -global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { +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).'\')"'; ?>> - + dol_use_jmobile)) { ?> '."\n"; - } + if (! empty($conf->use_javascript_ajax)) { + print "\n".'\n"; + } print load_fiche_titre($langs->trans("DoPayment")); diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 48df7d20217..942ec66b002 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -806,7 +806,7 @@ if ($step == 3 && $datatoexport) $tablename=getablenamefromfield($code, $sqlmaxforexport); $htmltext =''.$langs->trans("Name").': '.$text.'
'; - if (! empty($objexport->array_export_special[0][$code])) + if (! empty($objexport->array_export_special[0][$code])) { $htmltext.=''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; } diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 01e9d36685f..046d8307466 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -191,9 +191,9 @@ class Interventions extends DolibarrApi */ function post($request_data = null) { - if(! DolibarrApiAccess::$user->rights->ficheinter->creer) { - throw new RestException(401, "Insuffisant rights"); - } + if(! DolibarrApiAccess::$user->rights->ficheinter->creer) { + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validate($request_data); foreach($request_data as $field => $value) { @@ -254,8 +254,8 @@ class Interventions extends DolibarrApi function postLine($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->ficheinter->creer) { - throw new RestException(401, "Insuffisant rights"); - } + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validateLine($request_data); @@ -263,13 +263,13 @@ class Interventions extends DolibarrApi $this->fichinter->$field = $value; } - if( ! $result ) { + if ( ! $result ) { throw new RestException(404, 'Intervention not found'); } - if( ! DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } $updateRes = $this->fichinter->addLine( DolibarrApiAccess::$user, @@ -280,10 +280,9 @@ class Interventions extends DolibarrApi ); if ($updateRes > 0) { - return $updateRes; - } - else { - throw new RestException(400, $this->fichinter->error); + return $updateRes; + } else { + throw new RestException(400, $this->fichinter->error); } } @@ -337,8 +336,8 @@ class Interventions extends DolibarrApi function validate($id, $notrigger = 0) { if(! DolibarrApiAccess::$user->rights->ficheinter->creer) { - throw new RestException(401, "Insuffisant rights"); - } + throw new RestException(401, "Insuffisant rights"); + } $result = $this->fichinter->fetch($id); if( ! $result ) { throw new RestException(404, 'Intervention not found'); @@ -350,10 +349,10 @@ class Interventions extends DolibarrApi $result = $this->fichinter->setValid(DolibarrApiAccess::$user, $notrigger); if ($result == 0) { - throw new RestException(304, 'Error nothing done. May be object is already validated'); + throw new RestException(304, 'Error nothing done. May be object is already validated'); } if ($result < 0) { - throw new RestException(500, 'Error when validating Intervention: '.$this->commande->error); + throw new RestException(500, 'Error when validating Intervention: '.$this->commande->error); } $this->fichinter->fetchObjectLinked(); @@ -388,10 +387,10 @@ class Interventions extends DolibarrApi $result = $this->fichinter->setStatut(3); if ($result == 0) { - throw new RestException(304, 'Error nothing done. May be object is already closed'); + throw new RestException(304, 'Error nothing done. May be object is already closed'); } if ($result < 0) { - throw new RestException(500, 'Error when closing Intervention: '.$this->fichinter->error); + throw new RestException(500, 'Error when closing Intervention: '.$this->fichinter->error); } $this->fichinter->fetchObjectLinked(); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 88e50eccf60..c85e74e43c9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3082,54 +3082,56 @@ class CommandeFournisseur extends CommonOrder } return 4; } - }elseif(! empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED) ) - {//set livraison to 'tot' if more products received than wished. (and if $closeopenorder is set to 1 of course...) + } elseif (! empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED) ) { + //set livraison to 'tot' if more products received than wished. (and if $closeopenorder is set to 1 of course...) - $close=0; + $close=0; - if( count($diff_array) > 0 ) - {//there are some difference between the two arrays + if( count($diff_array) > 0 ) + { + //there are some difference between the two arrays - //scan the array of results - foreach($diff_array as $key => $value) - {//if the quantity delivered is greater or equal to wish quantity - if($qtydelivered[$key] >= $qtywished[$key] ) - { - $close++; - } - } - } + //scan the array of results + foreach($diff_array as $key => $value) + { + //if the quantity delivered is greater or equal to wish quantity + if($qtydelivered[$key] >= $qtywished[$key] ) + { + $close++; + } + } + } - if($close == count($diff_array)) - {//all the products are received equal or more than the wished quantity - if ($closeopenorder) - { - $ret = $this->Livraison($user, $date_liv, 'tot', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can' - if ($ret<0) { - return -1; - } - return 5; - } - else - { - //Diff => received partially - $ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can' - if ($ret<0) { - return -1; - } - return 4; - } - } - else - {//all the products are not received - $ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can' - if ($ret<0) { - return -1; - } - return 4; - } - } + if($close == count($diff_array)) { + //all the products are received equal or more than the wished quantity + if ($closeopenorder) { + $ret = $this->Livraison($user, $date_liv, 'tot', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can' + if ($ret<0) { + return -1; + } + return 5; + } + else + { + //Diff => received partially + $ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can' + if ($ret<0) { + return -1; + } + return 4; + } + } + else + { + //all the products are not received + $ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can' + if ($ret<0) { + return -1; + } + return 4; + } + } else { //Diff => received partially @@ -3145,7 +3147,7 @@ class CommandeFournisseur extends CommonOrder } return 0; } - + /** * Load array this->receptions of lines of shipments with nb of products sent for each order line * Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order @@ -3169,7 +3171,7 @@ class CommandeFournisseur extends CommonOrder if ($this->fk_product > 0) $sql.= ' AND cd.fk_product = '.$this->fk_product; if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut; $sql.= ' GROUP BY cd.rowid, cd.fk_product'; - + dol_syslog(get_class($this)."::loadReceptions", LOG_DEBUG); $result = $this->db->query($sql); @@ -3184,7 +3186,7 @@ class CommandeFournisseur extends CommonOrder $i++; } $this->db->free(); - + return $num; } else @@ -3319,7 +3321,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->total_ttc = $objp->total_ttc; $this->product_type = $objp->product_type; $this->special_code = $objp->special_code; - + $this->ref = $objp->product_ref; $this->product_ref = $objp->product_ref; $this->product_libelle = $objp->product_libelle; diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 059c1c61697..49f23cf5191 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -312,7 +312,7 @@ class CommandeFournisseurDispatch extends CommonObject } else { - $this->error="Error ".$this->db->lasterror(); + $this->error="Error ".$this->db->lasterror(); return -1; } } @@ -391,7 +391,7 @@ class CommandeFournisseurDispatch extends CommonObject $result=$this->call_trigger('LINERECEPTION_UPDATE', $user); if ($result < 0) $error++; //// End call triggers - } + } } // Commit or rollback diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index aca1c204fd3..7bcb243cd21 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3218,4 +3218,4 @@ class SupplierInvoiceLine extends CommonObjectLine return -2; } } - } +} diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index df56bb27733..d7ab2180c2d 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2222,227 +2222,227 @@ elseif (! empty($object->id)) dol_fiche_end(); - /** - * Boutons actions - */ + /** + * Boutons actions + */ - if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete') + if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete') + { + print '
'; + + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + // modified by hook + if (empty($reshook)) { - print '
'; + $object->fetchObjectLinked(); // Links are used to show or not button, so we load them now. - $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been - // modified by hook - if (empty($reshook)) + // Validate + if ($object->statut == 0 && $num > 0) { - $object->fetchObjectLinked(); // Links are used to show or not button, so we load them now. - - // Validate - if ($object->statut == 0 && $num > 0) + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->commande->creer)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_order_advance->validate))) { - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_order_advance->validate))) - { - $tmpbuttonlabel=$langs->trans('Validate'); - if ($user->rights->fournisseur->commande->approuver && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE)) $tmpbuttonlabel = $langs->trans("ValidateAndApprove"); + $tmpbuttonlabel=$langs->trans('Validate'); + if ($user->rights->fournisseur->commande->approuver && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE)) $tmpbuttonlabel = $langs->trans("ValidateAndApprove"); - print ''; - print $tmpbuttonlabel; - print ''; - } + print ''; + print $tmpbuttonlabel; + print ''; } - // Create event - /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. - { - print ''; - }*/ + } + // Create event + /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. + { + print ''; + }*/ - // Modify - if ($object->statut == 1) + // Modify + if ($object->statut == 1) + { + if ($user->rights->fournisseur->commande->commander) { - if ($user->rights->fournisseur->commande->commander) - { - print ''.$langs->trans("Modify").''; - } - } - - // Approve - if ($object->statut == 1) - { - if ($user->rights->fournisseur->commande->approuver) - { - if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED && ! empty($object->user_approve_id)) - { - print ''.$langs->trans("ApproveOrder").''; - } - else - { - print ''.$langs->trans("ApproveOrder").''; - } - } - else - { - print ''.$langs->trans("ApproveOrder").''; - } - } - - // Second approval (if option SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set) - if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) - { - if ($object->statut == 1) - { - if ($user->rights->fournisseur->commande->approve2) - { - if (! empty($object->user_approve_id2)) - { - print ''.$langs->trans("Approve2Order").''; - } - else - { - print ''.$langs->trans("Approve2Order").''; - } - } - else - { - print ''.$langs->trans("Approve2Order").''; - } - } - } - - // Refuse - if ($object->statut == 1) - { - if ($user->rights->fournisseur->commande->approuver || $user->rights->fournisseur->commande->approve2) - { - print ''.$langs->trans("RefuseOrder").''; - } - else - { - print ''.$langs->trans("RefuseOrder").''; - } - } - - // Send - if (in_array($object->statut, array(2, 3, 4, 5))) - { - if ($user->rights->fournisseur->commande->commander) - { - print ''.$langs->trans('SendMail').''; - } - } - - // Reopen - if (in_array($object->statut, array(2))) - { - $buttonshown=0; - if (! $buttonshown && $user->rights->fournisseur->commande->approuver) - { - if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) - || (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) - { - print ''.$langs->trans("Disapprove").''; - $buttonshown++; - } - } - if (! $buttonshown && $user->rights->fournisseur->commande->approve2 && ! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) - { - if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) - || (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) - { - print ''.$langs->trans("Disapprove").''; - } - } - } - if (in_array($object->statut, array(3, 4, 5, 6, 7, 9))) - { - if ($user->rights->fournisseur->commande->commander) - { - print ''.$langs->trans("ReOpen").''; - } - } - - // Ship - - if (! empty($conf->stock->enabled) && (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) - { - if (in_array($object->statut, array(3,4,5))) { - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->receptionner) { - print ''; - } else { - print ''; - } - } - } - - if ($object->statut == 2) - { - if ($user->rights->fournisseur->commande->commander) - { - print ''; - } - else - { - print ''; - } - } - - // Create bill - if (! empty($conf->facture->enabled)) - { - if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) // statut 2 means approved, 7 means canceled - { - if ($user->rights->fournisseur->facture->creer) - { - print ''.$langs->trans("CreateBill").''; - } - } - } - - // Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not) - if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && $object->statut != 7 && $object->billed != 1) // statut 2 means approved - { - if (empty($conf->facture->enabled)) - { - print ''.$langs->trans("ClassifyBilled").''; - } - elseif (!empty($object->linkedObjectsIds['invoice_supplier'])) - { - if ($user->rights->fournisseur->facture->creer) - { - print ''.$langs->trans("ClassifyBilled").''; - } - } - } - - // Create a remote order using WebService only if module is activated - if (! empty($conf->syncsupplierwebservices->enabled) && $object->statut >= 2) // 2 means accepted - { - print ''.$langs->trans('CreateRemoteOrder').''; - } - - // Clone - if ($user->rights->fournisseur->commande->creer) - { - print ''.$langs->trans("ToClone").''; - } - - // Cancel - if ($object->statut == 2) - { - if ($user->rights->fournisseur->commande->commander) - { - print ''.$langs->trans("CancelOrder").''; - } - } - - // Delete - if ($user->rights->fournisseur->commande->supprimer) - { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Modify").''; } } - print "
"; + // Approve + if ($object->statut == 1) + { + if ($user->rights->fournisseur->commande->approuver) + { + if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED && ! empty($object->user_approve_id)) + { + print ''.$langs->trans("ApproveOrder").''; + } + else + { + print ''.$langs->trans("ApproveOrder").''; + } + } + else + { + print ''.$langs->trans("ApproveOrder").''; + } + } + + // Second approval (if option SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set) + if (! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) + { + if ($object->statut == 1) + { + if ($user->rights->fournisseur->commande->approve2) + { + if (! empty($object->user_approve_id2)) + { + print ''.$langs->trans("Approve2Order").''; + } + else + { + print ''.$langs->trans("Approve2Order").''; + } + } + else + { + print ''.$langs->trans("Approve2Order").''; + } + } + } + + // Refuse + if ($object->statut == 1) + { + if ($user->rights->fournisseur->commande->approuver || $user->rights->fournisseur->commande->approve2) + { + print ''.$langs->trans("RefuseOrder").''; + } + else + { + print ''.$langs->trans("RefuseOrder").''; + } + } + + // Send + if (in_array($object->statut, array(2, 3, 4, 5))) + { + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans('SendMail').''; + } + } + + // Reopen + if (in_array($object->statut, array(2))) + { + $buttonshown=0; + if (! $buttonshown && $user->rights->fournisseur->commande->approuver) + { + if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) + || (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) + { + print ''.$langs->trans("Disapprove").''; + $buttonshown++; + } + } + if (! $buttonshown && $user->rights->fournisseur->commande->approve2 && ! empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) + { + if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) + || (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) + { + print ''.$langs->trans("Disapprove").''; + } + } + } + if (in_array($object->statut, array(3, 4, 5, 6, 7, 9))) + { + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans("ReOpen").''; + } + } + + // Ship + + if (! empty($conf->stock->enabled) && (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) + { + if (in_array($object->statut, array(3,4,5))) { + if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->receptionner) { + print ''; + } else { + print ''; + } + } + } + + if ($object->statut == 2) + { + if ($user->rights->fournisseur->commande->commander) + { + print ''; + } + else + { + print ''; + } + } + + // Create bill + if (! empty($conf->facture->enabled)) + { + if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) // statut 2 means approved, 7 means canceled + { + if ($user->rights->fournisseur->facture->creer) + { + print ''.$langs->trans("CreateBill").''; + } + } + } + + // Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not) + if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && $object->statut != 7 && $object->billed != 1) // statut 2 means approved + { + if (empty($conf->facture->enabled)) + { + print ''.$langs->trans("ClassifyBilled").''; + } + elseif (!empty($object->linkedObjectsIds['invoice_supplier'])) + { + if ($user->rights->fournisseur->facture->creer) + { + print ''.$langs->trans("ClassifyBilled").''; + } + } + } + + // Create a remote order using WebService only if module is activated + if (! empty($conf->syncsupplierwebservices->enabled) && $object->statut >= 2) // 2 means accepted + { + print ''.$langs->trans('CreateRemoteOrder').''; + } + + // Clone + if ($user->rights->fournisseur->commande->creer) + { + print ''.$langs->trans("ToClone").''; + } + + // Cancel + if ($object->statut == 2) + { + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans("CancelOrder").''; + } + } + + // Delete + if ($user->rights->fournisseur->commande->supprimer) + { + print ''.$langs->trans("Delete").''; + } + } + + print "
"; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 95c4f0c4ce9..257750559a1 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -460,8 +460,8 @@ if ($id > 0 || ! empty($ref)) { $listwarehouses = $entrepot->list_array(1); if(empty($conf->reception->enabled))print '
'; - else print ''; - + else print ''; + print ''; if(empty($conf->reception->enabled))print ''; else print ''; @@ -726,19 +726,19 @@ if ($id > 0 || ! empty($ref)) { // modified by hook if (empty($reshook)) { - if(empty($conf->reception->enabled)){ - print $langs->trans("Comment").' : '; - print 'trans("DispatchSupplierOrder", $object->ref); - // print ' / '.$object->ref_supplier; // Not yet available - print '" class="flat">
'; + if (empty($conf->reception->enabled)){ + print $langs->trans("Comment").' : '; + print 'trans("DispatchSupplierOrder", $object->ref); + // print ' / '.$object->ref_supplier; // Not yet available + print '" class="flat">
'; - print ' '.$checkboxlabel; - } - empty($conf->reception->enabled)?$dispatchBt=$langs->trans("DispatchVerb"):$dispatchBt=$langs->trans("Receive"); + print ' '.$checkboxlabel; + } + empty($conf->reception->enabled)?$dispatchBt=$langs->trans("DispatchVerb"):$dispatchBt=$langs->trans("Receive"); - print '
'; } @@ -787,7 +787,7 @@ if ($id > 0 || ! empty($ref)) { print ''; if($conf->reception->enabled)print '' . $langs->trans("Reception") . ''; - + print '' . $langs->trans("Product") . ''; print '' . $langs->trans("DateCreation") . ''; print '' . $langs->trans("DateDeliveryPlanned") . ''; @@ -809,19 +809,19 @@ if ($id > 0 || ! empty($ref)) { $objp = $db->fetch_object($resql); print ""; - + if(!empty($conf->reception->enabled) ){ print ''; if (!empty($objp->fk_reception)){ - + $reception = new Reception($db); $reception->fetch($objp->fk_reception); print $reception->getNomUrl(1); } - + print ""; } - + print ''; print '' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . ''; print ' - ' . $objp->label; @@ -895,7 +895,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; print ''; - + print "\n"; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index d8b644f1e50..47a112fac76 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -622,7 +622,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''.price($objp->total_ttc).''; - print ''.price($objp->am).''; + print ''.price($objp->am); + if ($creditnotes) print '+'.price($creditnotes); + if ($deposits) print '+'.price($deposits); + print ''; print ''.price($remaintopay).''; @@ -677,6 +680,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $total+=$objp->total_ht; $total_ttc+=$objp->total_ttc; $totalrecu+=$objp->am; + $totalrecucreditnote+=$creditnotes; + $totalrecudeposits+=$deposits; $i++; } if ($i > 1) @@ -689,8 +694,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($conf->multicurrency->enabled)) print ' '; if (!empty($conf->multicurrency->enabled)) print ' '; print ''.price($total_ttc).''; - print ''.price($totalrecu).''; - print ''.price($total_ttc - $totalrecu).''; + print ''.price($totalrecu); + if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); + if ($totalrecudeposits) print '+'.price($totalrecudeposits); + print ''; + print ''.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).''; print ''; // Autofilled if (!empty($conf->multicurrency->enabled)) print ''; print "\n"; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 1051fca8ba3..d64d85813e6 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -28,46 +28,143 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + +$search_id = GETPOST('search_id', 'alpha'); +$year=GETPOST('year'); +if (empty($year)) +{ + $tmpdate=dol_getdate(dol_now()); + $year=$tmpdate['year']; +} + +// Load variable for pagination +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page', 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +//if (! $sortfield) $sortfield="p.date_fin"; +//if (! $sortorder) $sortorder="DESC"; + + // Protection if external user if ($user->societe_id > 0) accessforbidden(); // Si l'utilisateur n'a pas le droit de lire cette page if(!$user->rights->holiday->read_all) accessforbidden(); -$year=GETPOST('year'); -if (empty($year)) -{ - $tmpdate=dol_getdate(dol_now()); - $year=$tmpdate['year']; -} - // Load translation files required by the page $langs->load('users'); +// Initialize technical objects +$object = new Holiday($db); +$extrafields = new ExtraFields($db); +//$diroutputmassaction = $conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('leavemovementlist')); // Note that conf->hooks_modules contains array + +$arrayfields=array(); +$arrayofmassactions=array(); + + +/* + * Actions + */ + +if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') ||GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers + { + $search_id=''; + $toselect=''; + $search_array_options=array(); + } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) + { + $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } + + // Mass actions + /*$objectclass='MyObject'; + $objectlabel='MyObject'; + $permtoread = $user->rights->mymodule->read; + $permtodelete = $user->rights->mymodule->delete; + $uploaddir = $conf->mymodule->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + */ +} + + /* * View */ -$cp = new Holiday($db); +$form = new Form($db); -$alltypeleaves=$cp->getTypes(1, -1); // To have labels +$alltypeleaves=$object->getTypes(1, -1); // To have labels llxHeader('', $langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year.')'); -// Recent changes are more important than old changes -$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC', " AND date_action BETWEEN '".$db->idate(dol_get_first_day($year, 1, 1))."' AND '".$db->idate(dol_get_last_day($year, 12, 1))."'"); // Load $cp->logs -$pagination=''; + +$sqlwhere = ''; +$sqlwhere.= " AND date_action BETWEEN '".$db->idate(dol_get_first_day($year, 1, 1))."' AND '".$db->idate(dol_get_last_day($year, 12, 1))."'"; +if ($search_id != '') $sqlwhere.= natural_search('rowid', $search_id, 1); + +$sqlorder = 'ORDER BY cpl.rowid DESC'; + +// Recent changes are more important than old changes +$log_holiday = $object->fetchLog($sqlorder, $sqlwhere); // Load $object->logs + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); +if ($search_id) $param='&search_id='.urlencode($search_id); + +print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$pagination=''; print load_fiche_titre($langs->trans('LogCP'), $pagination, 'title_hrm.png'); print '
'.$langs->trans('LastUpdateCP').': '."\n"; -$lastUpdate = $cp->getConfCP('lastUpdate'); +$lastUpdate = $object->getConfCP('lastUpdate'); if ($lastUpdate) { $monthLastUpdate = $lastUpdate[4].$lastUpdate[5]; $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3]; - print ''.dol_print_date($db->jdate($cp->getConfCP('lastUpdate')), 'dayhour', 'tzuser').''; + print ''.dol_print_date($db->jdate($object->getConfCP('lastUpdate')), 'dayhour', 'tzuser').''; print '
'.$langs->trans("MonthOfLastMonthlyUpdate").': '.$yearLastUpdate.'-'.$monthLastUpdate.''."\n"; } else print $langs->trans('None'); @@ -75,12 +172,18 @@ print "

\n"; $moreforfilter=''; +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +//$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); +$selectedfields=''; + print '
'; print ''."\n"; print ''; print ''; +print ''; print ''; print ''; print ''; @@ -89,6 +192,11 @@ print ''; print ''; print ''; print ''; +// Action column +print ''; print ''; print ''; @@ -99,11 +207,13 @@ print_liste_field_titre('UserUpdateCP'); print_liste_field_titre('Description'); print_liste_field_titre('Type'); print_liste_field_titre('PrevSoldeCP', $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); +print_liste_field_titre('Variation', $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); print_liste_field_titre('NewSoldeCP', $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; print ''; -foreach($cp->logs as $logs_CP) +foreach($object->logs as $logs_CP) { $user_action = new User($db); $user_action->fetch($logs_CP['fk_user_action']); @@ -111,6 +221,9 @@ foreach($cp->logs as $logs_CP) $user_update = new User($db); $user_update->fetch($logs_CP['fk_user_update']); + $delta = price2num($logs_CP['new_solde'] - $logs_CP['prev_solde'], 5); + $detasign = ($delta > 0 ? '+' : '-'); + print ''; print ''; print ''; @@ -122,14 +235,16 @@ foreach($cp->logs as $logs_CP) print $label?$label:$logs_CP['fk_type']; print ''; print ''; + print ''; print ''; + print ''; print ''."\n"; } if ($log_holiday == '2') { - print ''; - print ''; + print ''; + print ''; print ''; } @@ -137,6 +252,8 @@ print ''."\n"; print '
'; +$searchpicto=$form->showFilterButtons(); +print $searchpicto; +print '
'.$logs_CP['rowid'].''.$logs_CP['date_action'].''.price2num($logs_CP['prev_solde'], 5).' '.$langs->trans('days').''.$detasign.$delta.''.price2num($logs_CP['new_solde'], 5).' '.$langs->trans('days').'
'.$langs->trans('NoRecordFound').'
'.$langs->trans('NoRecordFound').'
'."\n"; print '
'; +print '
'; + // End of page llxFooter(); $db->close(); diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 17e9c40f224..7964c378003 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1328,8 +1328,8 @@ if ($step == 5 && $datatoimport) } print '   '.$langs->trans("Modify").''; } else { - if ($objimport->array_import_updatekeys[0] && count($objimport->array_import_updatekeys[0])) - {//TODO dropdown UL is created inside nested SPANS + if (is_array($objimport->array_import_updatekeys[0]) && count($objimport->array_import_updatekeys[0])) + { //TODO dropdown UL is created inside nested SPANS print $form->multiselectarray('updatekeys', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '80%'); print $form->textwithpicto("", $langs->trans("SelectPrimaryColumnsForUpdateAttempt")); } diff --git a/htdocs/index.php b/htdocs/index.php index 672417fd80f..9217af0f4c3 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -552,8 +552,8 @@ if ($showweather) $nbworkboardempty=0; if (! empty($valid_dashboardlines)) { - $boxwork.='
'; - + $boxwork.='
'; + foreach($valid_dashboardlines as $board) { if (empty($board->nbtodo)) $nbworkboardempty++; @@ -567,9 +567,9 @@ if (! empty($valid_dashboardlines)) $boxwork .= ''.$board->img.' '.$board->label.'
'; $boxwork .= ''.$board->nbtodo.''; if ($board->total > 0 && ! empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) - { - $boxwork .= ' / '.price($board->total) .''; - } + { + $boxwork .= ' / '.price($board->total) .''; + } $boxwork .= '
'; if ($board->nbtodolate > 0) { @@ -593,7 +593,7 @@ if (! empty($valid_dashboardlines)) $boxwork .='
'; $boxwork .='
'; $boxwork .='
'; - + $boxwork .='
'; $boxwork .=''; } diff --git a/htdocs/install/check.php b/htdocs/install/check.php index bf39c5cb749..3477ad1d041 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -312,19 +312,19 @@ else } else { - require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; + require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; - // If password is encoded, we decode it - if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass)) - { - require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; - if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) - { - $dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted - $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); - } - else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); - } + // If password is encoded, we decode it + if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass)) + { + require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; + if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) + { + $dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted + $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); + } + else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); + } // $conf already created in inc.php $conf->db->type = $dolibarr_main_db_type; @@ -333,12 +333,12 @@ else $conf->db->name = $dolibarr_main_db_name; $conf->db->user = $dolibarr_main_db_user; $conf->db->pass = $dolibarr_main_db_pass; - $db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); + $db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); if ($db->connected && $db->database_selected) { $ok=true; } - } + } } } @@ -569,7 +569,7 @@ else print ''."\n"; print ''; } - } + } } print '