diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index e0adb2a256e..8f8b4e2a2d9 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 b5c1ae5b6a9..989e9535297 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -173,6 +173,8 @@ + + diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 637d9548eb9..6a3a8c16812 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -538,8 +538,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/categories_list.php b/htdocs/accountancy/admin/categories_list.php index e18be1b8d60..bb3db6fd0bf 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 f8f7a5f7a54..8d29d10708d 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 d61b3c991e4..a5a2a691e8f 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 81b1f81416a..d41af13d193 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 fcc6bbecd81..770f6ec74c9 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/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 319dbb1f75b..04d54c79b21 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 1a52c9226f5..c62534ec293 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/card.php b/htdocs/adherents/subscription/card.php index 014806a2a2f..31944968632 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 7e97752af5d..f4c5cb8bebc 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -459,8 +459,8 @@ while ($i < min($num, $limit)) $adherent->statut=$obj->statut; $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 ee3083410dd..537e79ca6a5 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1124,12 +1124,12 @@ if ($id) 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 65c7f5e8d68..dc0673cca2d 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 b16e9047b26..a4ff73b52bd 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; + { + 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 b8d92687d84..5a446b868c5 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_set $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 d25becaac4f..688e58f59ad 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/website.php b/htdocs/admin/website.php index 4abcaed9b6a..0053612803e 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 '
'; $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 ) - { - $obj = $db->fetch_object($result); - 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 951e88f63fc..9714f8d7e64 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 0d24b71b343..b75da58caba 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 843e2fc0ee6..52fca4f3772 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 ) { 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/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 1e9dde34bde..88b792507f4 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/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 0de2efbd9cf..79df55a2bb6 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -875,32 +875,32 @@ 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]."')"; - } - } + 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]."')"; + } + } } } } diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 0c98800b3ea..3b306e04a97 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -109,20 +109,18 @@ if (is_resource($handle)) print '
'.img_object('',$mailmodule->picto).' '.$obj->label.''.$obj->nb.''; - $i++; + while ($i < $num ) { + $obj = $db->fetch_object($result); + print ''.img_object('',$mailmodule->picto).' '.$obj->label.''.$obj->nb.''; + $i++; } - $db->free($result); + $db->free($result); } else { @@ -154,45 +152,42 @@ $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; + $num = $db->num_rows($result); + if ($num > 0) { + $i = 0; - while ($i < $num ) - { - $obj = $db->fetch_object($result); + while ($i < $num ) { + $obj = $db->fetch_object($result); - print ''; - print ''; - print ''; - print ''; - print ''; - $mailstatic=new Mailing($db); - print ''; - print ''; - $i++; - } + print ''; + print ''; + print ''; + print ''; + print ''; + $mailstatic=new Mailing($db); + print ''; + print ''; + $i++; + } } - else + else { - print ''; + print ''; } - 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).'
'.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").'
'.$langs->trans("None").'

"; - $db->free($result); + print "

"; + $db->free($result); } else { - dol_print_error($db); + dol_print_error($db); } @@ -207,7 +202,7 @@ if ($langs->file_exists("html/spam.html",0)) { print ''; print '
'; - } +} // End of page llxFooter(); diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 6ce38f8c432..07d7fdeba6c 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,25 +218,25 @@ 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; + } /** * Add a line to given commercial proposal @@ -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 b3da0634aee..3d51768106c 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/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 118bc3fbd37..5ad537c16b7 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,21 +53,22 @@ 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); - } ?> + if ($user->rights->propale->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> getLibStatut(3); ?> ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> @@ -86,7 +86,7 @@ if (count($linkedObjectBlock) > 1) - diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 7ad92a012b1..d94291dd106 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/compta-files.php b/htdocs/compta/compta-files.php index 5cce413a9ae..e524d6e26e1 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/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index c0dd351f009..c0896db8326 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 c3aeb8f6608..d1f08e891af 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/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 1748a3fa9d2..cfb5205ba8a 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -66,22 +66,20 @@ print ''; print ''.$langs->trans("BankChecks")."\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 ''.$langs->trans("BankChecksToReceipt").''; - print ''; - print ''.$num.''; - print ''; - 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 0003043fef4..89b7f01f881 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -551,8 +551,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 cfe2e2a942c..d8e454bd3e1 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 2c542f9bad0..cdade0bb079 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 397538d2ac1..8577ed96c4c 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -57,8 +57,7 @@ $date_startday = GETPOST("date_startday"); $date_endyear = GETPOST("date_endyear"); $date_endmonth = GETPOST("date_endmonth"); $date_endday = GETPOST("date_endday"); -if (empty($year)) -{ +if (empty($year)) { $year_current = strftime("%Y",dol_now()); $month_current = strftime("%m",dol_now()); $year_start = $year_current; @@ -211,7 +210,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 +242,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 +301,7 @@ print_liste_field_titre( "", $sortfield, $sortorder - ); +); if ($modecompta == 'CREANCES-DETTES') { print_liste_field_titre( $langs->trans('AmountHT'), @@ -313,8 +312,8 @@ if ($modecompta == 'CREANCES-DETTES') { 'align="right"', $sortfield, $sortorder - ); - } else { + ); +} else { print_liste_field_titre(''); } print_liste_field_titre( @@ -326,7 +325,7 @@ print_liste_field_titre( 'align="right"', $sortfield, $sortorder - ); +); print_liste_field_titre( $langs->trans("Percentage"), $_SERVER["PHP_SELF"],"amount_ttc", @@ -335,7 +334,7 @@ print_liste_field_titre( 'align="right"', $sortfield, $sortorder - ); +); print_liste_field_titre( $langs->trans("OtherStatistics"), $_SERVER["PHP_SELF"], @@ -343,7 +342,7 @@ print_liste_field_titre( "", "", 'align="center" width="20%"' - ); +); print "\n"; if (count($amount)) { @@ -390,22 +389,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 +412,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 +432,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 +449,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 727f65a8b68..5ac640b3b54 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -74,8 +74,7 @@ $date_startday = GETPOST("date_startday",'alpha'); $date_endyear = GETPOST("date_endyear",'alpha'); $date_endmonth = GETPOST("date_endmonth",'alpha'); $date_endday = GETPOST("date_endday",'alpha'); -if (empty($year)) -{ +if (empty($year)) { $year_current = strftime("%Y",dol_now()); $month_current = strftime("%m",dol_now()); $year_start = $year_current; @@ -451,9 +450,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 +463,7 @@ print_liste_field_titre( 'align="right"', $sortfield, $sortorder - ); +); print_liste_field_titre( $langs->trans("Percentage"), $_SERVER["PHP_SELF"], @@ -474,7 +473,7 @@ print_liste_field_titre( 'align="right"', $sortfield, $sortorder - ); +); print_liste_field_titre( $langs->trans("OtherStatistics"), $_SERVER["PHP_SELF"], @@ -482,7 +481,7 @@ print_liste_field_titre( "", "", 'align="center" width="20%"' - ); +); print "\n"; @@ -569,34 +568,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 +608,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 bd7819ee299..484d074ea0a 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 8631becc515..b09752012d4 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/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4f1d1d21c02..9abf23ff7b1 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 9401dce5622..a8e8ca85a6b 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.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8261b737e43..9f6534558e8 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 6d6f8471721..67c67aa2e41 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -712,5 +712,5 @@ class Menubase $this->recur($tab, $tab[$x]['rowid'], ($level+1)); } } - } + } } diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 18dfece171c..3d6fad1e588 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/functions.lib.php b/htdocs/core/lib/functions.lib.php index 52e5257907d..7ec211fa830 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2365,15 +2365,18 @@ 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 + { + //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); } elseif(dol_strlen($phone) == 12) - {//ex: +230_ABCD_EF_GH + { + //ex: +230_ABCD_EF_GH $newphone = substr($newphone,0,4).$separ.substr($newphone,4,4).$separ.substr($newphone,8,2).$separ.substr($newphone,10,2); } } @@ -2514,9 +2517,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 +2598,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; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index dba52f5c69e..5e5b9c71a8f 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/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 879319db2b9..679d4a10c20 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 a67327fa249..9cf1f9bb263 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 + // 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 399bdca0fe0..b9bb0e97c79 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 8e2b5a8b198..f1e381ba22b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1286,37 +1286,37 @@ class pdf_crabe extends ModelePDFFactures //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) + foreach( $this->localtax2 as $localtax_type => $localtax_rate ) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach( $localtax_rate as $tvakey => $tvaval ) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; - - foreach( $localtax_rate as $tvakey => $tvaval ) + // retrieve global local tax + if ($tvakey != 0) // On affiche pas taux 0 { - // retrieve global local tax - if ($tvakey != 0) // On affiche pas taux 0 + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/',$tvakey)) { - //$this->atleastoneratenotnull++; - - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $tvacompl=''; - if (preg_match('/\*/',$tvakey)) - { - $tvakey=str_replace('*','',$tvakey); - $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; - } - $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; - - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); + $tvakey=str_replace('*','',$tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; + + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } - //} + } } + //} // Revenue stamp 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 203711fc80f..84601b09f01 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 0b1932013cf..b7d25d5b94c 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 8ae2fe0eb9a..25bafee3e2f 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 32a2d10f72d..9d5f7bf75e8 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -425,26 +425,26 @@ 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]; - if ($classname == 'ExpenseReport') - { - // We get id of expense report - $expensereportline=new ExpenseReportLine($this->db); - $expensereportline->fetch($idofelement); - $idofelement = $expensereportline->fk_expensereport; - } + // Description of line + $idofelement=$elementarray[$i]; + if ($classname == 'ExpenseReport') + { + // We get id of expense report + $expensereportline=new ExpenseReportLine($this->db); + $expensereportline->fetch($idofelement); + $idofelement = $expensereportline->fk_expensereport; + } $element = new $classname($this->db); $element->fetch($idofelement); @@ -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 cfb1b87388f..bc8bd36e4a7 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 b4fb70c735e..3d6adea87ff 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 4a57a1e12cc..7e8eb1a6e3d 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 5e1418f8ed2..9a808250770 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 c53d30a10c8..06d78607cd6 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 4f50f55b4ba..2a8c5126910 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 =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 858db46b3f5..d5266d8d07c 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 1d7e4b9f939..cfeb62e52e3 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); @@ -267,9 +267,9 @@ class Interventions extends DolibarrApi 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 2b06dbbb0c4..66b134fb2e4 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 0e1ad52d46c..a0a42183b01 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 1f8b7b3ba8b..eb48d8e7821 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 04835089809..48ece92479b 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2224,227 +2224,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 a268619c84f..710b463a5b5 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -461,7 +461,7 @@ if ($id > 0 || ! empty($ref)) { if(empty($conf->reception->enabled))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/index.php b/htdocs/index.php index 3a6802abbf8..b3bdd4610c0 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 145992c0902..7c023d90aa9 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 '