diff --git a/.gitignore b/.gitignore index 1ece034ae94..aa332681474 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ dolibarr_install.log upgrade.log doxygen_warnings.log /.project +/.vscode .DS_Store .idea *.iml diff --git a/ChangeLog b/ChangeLog index 891b27ba78f..8a80591f652 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ For Users: NEW: Stable module: Website NEW: Stable module: WebDAV NEW: Stable module: Module Builder +NEW: Stable module "Skype" has been replaced with module "Social Networks" to support more tools. NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making Android application like DoliDroid able to provide native features for multicompany module. @@ -24,6 +25,40 @@ Following changes may create regressions for some external modules, but were nec +***** ChangeLog for 8.0.2 compared to 8.0.1 ***** +FIX: #8452 +FIX: #9043 +FIX: #9316 Error when listing invoices +FIX: #9317 +FIX: #9353 Bug: html error - div inside span on graphs +FIX: #9355 +FIX: #9393 inconsistency behaviour. option FACTURE_ENABLE_NEGATIVE_LINES +FIX: #9394 +FIX: #9396 +FIX: #9403 +FIX: #9412 +FIX: #9497 +FIX: Add paypal error message in alert email when online payment fails. +FIX: better compatibility with multicompany +FIX: capital must be empty and not 0 if undefined +FIX: character making error on bill list +FIX: Entering negative price on order. +FIX: Expedition not showing extrafields on creation. +FIX: Homepage links were using wrong topmenus +FIX: inconsistency behaviour on option FACTURE_ENABLE_NEGATIVE_LINES +FIX: invert mime type and name. +FIX: invoice popup hide localtax2 and 3 if not defined. +FIX: Lose filter on payment type or category after a sort on invoice list. +FIX: Maxi debug to allow to load chart of account with multicompany. +FIX: Missing translation in predefined email to membership renewal. +FIX: Mixing tickets of different thirdparties. +FIX: "Other ..." link so the "Back to" link works. +FIX: PDF address: handle when contact thirdparty is different from thirdparty of document +FIX: Problems with permissions of module to record payment of salaries +FIX: remove debug +FIX: Several fixes on the management of minimal amount for orders +FIX: wrong var name + ***** ChangeLog for 8.0.1 compared to 8.0.0 ***** FIX: #9258 FIX: #9328 diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index 2eedcda8760..0e3b2c7513f 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -295,6 +295,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0; if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0; if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0; + if (preg_match('/InDolibarr$/', $value)) $qualifiedforclean=0; // admin.lang if (preg_match('/^DAV_ALLOW_PUBLIC_DIR/i', $value)) $qualifiedforclean=0; if (preg_match('/^DAV_ALLOW_ECM_DIR/i', $value)) $qualifiedforclean=0; diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index ca47dbc7b96..087f9957f16 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -63,9 +63,9 @@ if (! $sortorder) $sortorder = "ASC"; $arrayfields=array( 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0), + 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), - 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), + 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'), 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) ); @@ -122,16 +122,34 @@ if (empty($reshook)) { $sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql'; - // FIXME Get the ADD rowid and pass it + num of comapny * 100 000 000 to run_sql as a new parameter to say to update sql on the fly to add offset to rowid and account_parent value. + $offsetforchartofaccount = 0; + // Get the comment line '-- ADD CCCNNNNN to rowid...' to find CCCNNNNN (CCC is country num, NNNNN is id of accounting account) + // and pass CCCNNNNN + (num of company * 100 000 000) as offset to the run_sql as a new parameter to say to update sql on the fly to add offset to rowid and account_parent value. + // This is to be sure there is no conflict for each chart of account, whatever is country, whatever is company when multicompany is used. + $tmp = file_get_contents($sqlfile); + if (preg_match('/-- ADD (\d+) to rowid/ims', $tmp, $reg)) + { + $offsetforchartofaccount += $reg[1]; + } + $offsetforchartofaccount+=($conf->entity * 100000000); - $result = run_sql($sqlfile, 1, 0, 1); + $result = run_sql($sqlfile, 1, $conf->entity, 1, '', 'default', 32768, 0, $offsetforchartofaccount); + + if ($result > 0) + { + setEventMessages($langs->trans("ChartLoaded"), null); + } + else + { + setEventMessages($langs->trans("ErrorDuringChartLoad"), null, 'warnings'); + } } if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { $error++; } } else { - $error ++; + $error++; } } diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index b0c3adb7edd..7cd1f1d11b2 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -761,7 +761,7 @@ class AccountancyCategory // extends CommonObject * Return list of personalized groups that are active * * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups - * @return array Array of groups + * @return array|int Array of groups or -1 if error */ public function getCats($categorytype=-1) { @@ -818,7 +818,7 @@ class AccountancyCategory // extends CommonObject * * @param int $cat_id Id if personalized accounting group/category * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts - * @return array Array of accounting accounts + * @return array|int Array of accounting accounts or -1 if error */ public function getCptsCat($cat_id, $predefinedgroupwhere='') { diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index a67fd457e11..0ddbaeb5026 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -35,7 +35,7 @@ class lettering extends BookKeeping * lettrageTiers * * @param int $socid Thirdparty id - * @return void + * @return int 1 OK, <0 error */ public function lettrageTiers($socid) { diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 90f20ca323d..f3e4e4d0df8 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2019,52 +2019,47 @@ class Adherent extends CommonObject if ($mode == 0) { if ($statut == -1) return $langs->trans("MemberStatusDraft"); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return $langs->trans("MemberStatusActive"); elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate"); else return $langs->trans("MemberStatusPaid"); } - if ($statut == 0) return $langs->trans("MemberStatusResiliated"); + elseif ($statut == 0) return $langs->trans("MemberStatusResiliated"); } elseif ($mode == 1) { if ($statut == -1) return $langs->trans("MemberStatusDraftShort"); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort"); elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort"); else return $langs->trans("MemberStatusPaidShort"); } - if ($statut == 0) return $langs->trans("MemberStatusResiliatedShort"); + elseif ($statut == 0) return $langs->trans("MemberStatusResiliatedShort"); } elseif ($mode == 2) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraftShort"); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActiveShort"); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLateShort"); else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaidShort"); } - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); + elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); } elseif ($mode == 3) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0'); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1'); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); else return img_picto($langs->trans('MemberStatusPaid'),'statut4'); } - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); + elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); } elseif ($mode == 4) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActive"); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLate"); else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaid"); @@ -2074,8 +2069,7 @@ class Adherent extends CommonObject elseif ($mode == 5) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return ''.$langs->trans("MemberStatusActiveShort").' '.img_picto($langs->trans('MemberStatusActive'),'statut1'); elseif ($date_end_subscription < time()) return ''.$langs->trans("MemberStatusActiveLateShort").' '.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); else return ''.$langs->trans("MemberStatusPaidShort").' '.img_picto($langs->trans('MemberStatusPaid'),'statut4'); @@ -2085,8 +2079,7 @@ class Adherent extends CommonObject elseif ($mode == 6) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); - if ($statut >= 1) - { + if ($statut >= 1) { if (! $date_end_subscription) return ''.$langs->trans("MemberStatusActive").' '.img_picto($langs->trans('MemberStatusActive'),'statut1'); elseif ($date_end_subscription < time()) return ''.$langs->trans("MemberStatusActiveLate").' '.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); else return ''.$langs->trans("MemberStatusPaid").' '.img_picto($langs->trans('MemberStatusPaid'),'statut4'); @@ -2107,7 +2100,7 @@ class Adherent extends CommonObject // phpcs:enable global $conf; - $this->nb=array(); + $this->nb = array(); $sql = "SELECT count(a.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 842c8d01470..8215bdbe0b1 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -356,7 +356,7 @@ print '
';
print '';
print '';
- print ''.print_r($printer, true).''; - if (count($printer->getlist_available_printers())) { + if (count($printer->getlistAvailablePrinters())) { if ($printer->listAvailablePrinters()==0) { print $printer->resprint; } else { diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 76b3cf76b57..0dba6ea6700 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -67,6 +67,8 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'', $conf->entity); + + dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'', $conf->entity); @@ -572,31 +574,36 @@ else // Show print ""; print ''; - //Desc + // Hide Desc print '
';
@@ -170,6 +173,8 @@ foreach($fulltree as $key => $val)
}
+//print_barre_liste('', 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, 0, '', 0, $newcardbutton, '', 0, 1, 1);
+
print '
'.$file['name'].''; + $filesarray[]=$file; + } + if(count($files)<1){ + $nofile['date']=$db->idate($objd->date); + $nofile['paid']=$objd->paid; + $nofile['amount']=$objd->total_ttc; + $nofile['ref']=$objd->ref; + $nofile['fk']=$objd->fk_soc; + $nofile['item']=$objd->item; + $filesarray[]=$nofile; + } + } + $i++; + } + } + $db->free($resd); + +} +/* + * cleanup of old ZIP + */ +//FIXME +/* +*ZIP creation +*/ +if($result & $action=="dl"){ + unset($zip); + $log='date,type,ref,total,paid,filename,item_id'."\n"; + $zipname = ($date_start)."-".($date_stop).'_export.zip'; + $zip = new ZipArchive; + $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); + if ($res){ + foreach ($filesarray as $key=> $file) { + if(file_exists($file["fullname"])) $zip->addFile($file["fullname"],$file["name"]);// + $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; + } + $zip->addFromString('log.csv', $log); + $zip->close(); + ///Then download the zipped file. + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename='.$zipname); + header('Content-Length: ' . filesize($zipname)); + readfile($zipname); + unlink($zipname); + exit(); + } +} +// None +/* + * View + */ +$form = new Form($db); +$userstatic=new User($db); +$title=$langs->trans("ComptaFiles").' - '.$langs->trans("List"); +//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary"); +$help_url='EN:Module_Accounting|FR:Module_Compatibilite'; //FIXME +llxHeader('',$title,$help_url); +print ''."\n\t\t"; +if (!empty($date_start) && !empty($date_stop))echo dol_print_date($date_start)." - ".dol_print_date($date_stop); +print '
\n\t\t\t";
+
+
+
+llxFooter();
+$db->close();
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index a40ad636976..f1419f83e45 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -3644,7 +3644,7 @@ else if ($id > 0 || ! empty($ref))
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.=' | '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); - if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherBills").')'; + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherBills").')'; // Project if (! empty($conf->projet->enabled)) { @@ -4463,6 +4463,7 @@ else if ($id > 0 || ! empty($ref)) print ' | ';
}
@@ -4486,6 +4487,7 @@ else if ($id > 0 || ! empty($ref))
print ' | ';
print " | ';
}
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 0773e6eedc1..3ab5d84bfdb 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1982,7 +1982,8 @@ class Facture extends CommonInvoice
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
{
- $this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
+ $langs->load("errors");
+ $this->error=$langs->trans("ErrorFailToDeleteFile",$file);
$this->db->rollback();
return 0;
}
@@ -1991,7 +1992,8 @@ class Facture extends CommonInvoice
{
if (! dol_delete_dir_recursive($dir)) // For remove dir and meta
{
- $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
+ $langs->load("errors");
+ $this->error=$langs->trans("ErrorFailToDeleteDir",$dir);
$this->db->rollback();
return 0;
}
diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php
index 619487e9574..31e362445f0 100644
--- a/htdocs/compta/facture/class/paymentterm.class.php
+++ b/htdocs/compta/facture/class/paymentterm.class.php
@@ -135,18 +135,17 @@ class PaymentTerm // extends CommonObject
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_payment_term");
- if (! $notrigger)
- {
- // Uncomment this and change MYOBJECT to your own tag if you
- // want this action call a trigger.
+ // Uncomment this and change MYOBJECT to your own tag if you
+ // want this action call a trigger.
+ //if (! $notrigger) {
- //// Call triggers
- //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- //$interface=new Interfaces($this->db);
- //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
- //if ($result < 0) { $error++; $this->errors=$interface->errors; }
- //// End call triggers
- }
+ // // Call triggers
+ // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
+ // $interface=new Interfaces($this->db);
+ // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
+ // if ($result < 0) { $error++; $this->errors=$interface->errors; }
+ // // End call triggers
+ //}
}
// Commit or rollback
@@ -311,21 +310,16 @@ class PaymentTerm // extends CommonObject
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
- if (! $error)
- {
- if (! $notrigger)
- {
- // Uncomment this and change MYOBJECT to your own tag if you
- // want this action call a trigger.
-
+ // Uncomment this and change MYOBJECT to your own tag if you
+ // want this action call a trigger.
+ //if (! $error && ! $notrigger) {
// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
// End call triggers
- }
- }
+ //}
// Commit or rollback
if ($error)
@@ -367,21 +361,16 @@ class PaymentTerm // extends CommonObject
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
- if (! $error)
- {
- if (! $notrigger)
- {
- // Uncomment this and change MYOBJECT to your own tag if you
- // want this action call a trigger.
-
+ // Uncomment this and change MYOBJECT to your own tag if you
+ // want this action call a trigger.
+ //if (! $error && ! $notrigger) {
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
- }
- }
+ //}
// Commit or rollback
if ($error)
@@ -439,12 +428,9 @@ class PaymentTerm // extends CommonObject
$error++;
}
- if (! $error)
- {
-
-
-
- }
+ //if (! $error)
+ //{
+ //}
unset($this->context['createfromclone']);
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 804398232de..72cfa38e8c2 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -148,29 +148,29 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
$checkedtypetiers=0;
$arrayfields=array(
- 'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
- 'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
- 'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0),
- 'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
- 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
- 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
- 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
- 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
- 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
- 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
- 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
- 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
- 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
- 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
- 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
+ 'f.facnumber'=>array('label'=>"Ref", 'checked'=>1),
+ 'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1),
+ 'f.type'=>array('label'=>"Type", 'checked'=>0),
+ 'f.date'=>array('label'=>"DateInvoice", 'checked'=>1),
+ 'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1),
+ 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
+ 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
+ 's.town'=>array('label'=>"Town", 'checked'=>1),
+ 's.zip'=>array('label'=>"Zip", 'checked'=>1),
+ 'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
+ 'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
+ 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
+ 'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1),
+ 'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
+ 'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1")),
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj=="1")),
- 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
- 'dynamount_payed'=>array('label'=>$langs->trans("Received"), 'checked'=>0),
- 'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),
- 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
- 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
- 'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
+ 'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
+ 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0),
+ 'rtp'=>array('label'=>"Rest", 'checked'=>0),
+ 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
+ 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
+ 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@@ -422,22 +422,14 @@ if ($filtre)
}
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
-if ($search_type != '' && $search_type >= 0)
-{
- if ($search_type == '0') $sql.=" AND f.type = 0"; // standard
- if ($search_type == '1') $sql.=" AND f.type = 1"; // replacement
- if ($search_type == '2') $sql.=" AND f.type = 2"; // credit note
- if ($search_type == '3') $sql.=" AND f.type = 3"; // deposit
- if ($search_type == '4') $sql.=" AND f.type = 4"; // proforma
- if ($search_type == '5') $sql.=" AND f.type = 5"; // situation
-}
+if ($search_type != '') $sql.=" AND f.type IN (".$db->escape($search_type).")";
if ($search_project) $sql .= natural_search('p.ref', $search_project);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state);
-if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
-if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
+if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')';
+if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')';
if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1);
@@ -911,7 +903,8 @@ if ($resql)
print " | ||||||||||||||||||||||||||||||||||||||||||||
| '; - if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); + if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ' | '; if (! $i) $totalarray['nbfield']++; } + // Staff + if (! empty($arrayfields['staff.code']['checked'])) + { + print ''; + if (! is_array($staffArray) || count($staffArray)==0) $staffArray = $formcompany->effectif_array(1); + print $staffArray[$obj->staff_code]; + print ' | '; + if (! $i) $totalarray['nbfield']++; + } // Payment mode if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index c9794d9662e..1f0175bd370 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -135,15 +135,15 @@ class Cpaiement if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + //if (!$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) $error++; - //// End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_CREATE',$user); + // if ($result < 0) $error++; + // // End call triggers + //} } // Commit or rollback @@ -278,15 +278,15 @@ class Cpaiement dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - if (!$error && !$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (!$error && !$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_MODIFY',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} // Commit or rollback if ($error) { @@ -316,17 +316,15 @@ class Cpaiement $this->db->begin(); - if (!$error) { - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (!$error && !$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_DELETE',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_DELETE',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} if (!$error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index b22d4d21e43..b4a21e198de 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -74,7 +74,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char } } -// Create payment +// Validate social contribution +/* if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->charges->creer) { $db->begin(); @@ -111,6 +112,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char $db->rollback(); } } +*/ /* @@ -150,12 +152,14 @@ if ($action == 'delete') /* * Validation confirmation of payment */ +/* if ($action == 'valide') { $facid = $_GET['facid']; print $form->formconfirm('card.php?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); } +*/ $linkback = '' . $langs->trans("BackToList") . ''; diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index dc45c9a4fb0..ea67873c2ee 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -82,7 +82,6 @@ class PaymentSalary extends CommonObject $this->db = $db; $this->element = 'payment_salary'; $this->table_element = 'payment_salary'; - return 1; } /** diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index 409ee99aaae..9013edee195 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -25,7 +25,7 @@ */ // Put here all includes required by your class file -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; @@ -77,31 +77,18 @@ class Cchargesociales $error = 0; - // Clean parameters - - if (isset($this->libelle)) { - $this->libelle = trim($this->libelle); - } - if (isset($this->deductible)) { - $this->deductible = trim($this->deductible); - } - if (isset($this->active)) { - $this->active = trim($this->active); - } - if (isset($this->code)) { - $this->code = trim($this->code); - } - if (isset($this->fk_pays)) { - $this->fk_pays = trim($this->fk_pays); - } - if (isset($this->module)) { - $this->module = trim($this->module); - } - if (isset($this->accountancy_code)) { - $this->accountancy_code = trim($this->accountancy_code); - } - - + // Clean parameters + $this->trimParameters( + array( + 'libelle', + 'deductible', + 'active', + 'code', + 'fk_pays', + 'module', + 'accountancy_code', + ) + ); // Check parameters // Put here code to add control on parameters values @@ -143,7 +130,7 @@ class Cchargesociales if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - if (!$notrigger) { + //if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. @@ -151,7 +138,7 @@ class Cchargesociales //$result=$this->call_trigger('MYOBJECT_CREATE',$user); //if ($result < 0) $error++; //// End call triggers - } + //} } // Commit or rollback @@ -243,28 +230,17 @@ class Cchargesociales // Clean parameters - if (isset($this->libelle)) { - $this->libelle = trim($this->libelle); - } - if (isset($this->deductible)) { - $this->deductible = trim($this->deductible); - } - if (isset($this->active)) { - $this->active = trim($this->active); - } - if (isset($this->code)) { - $this->code = trim($this->code); - } - if (isset($this->fk_pays)) { - $this->fk_pays = trim($this->fk_pays); - } - if (isset($this->module)) { - $this->module = trim($this->module); - } - if (isset($this->accountancy_code)) { - $this->accountancy_code = trim($this->accountancy_code); - } - + $this->trimParameters( + array( + 'libelle', + 'deductible', + 'active', + 'code', + 'fk_pays', + 'module', + 'accountancy_code', + ) + ); // Check parameters @@ -290,7 +266,7 @@ class Cchargesociales dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - if (!$error && !$notrigger) { + //if (!$error && !$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -298,7 +274,7 @@ class Cchargesociales //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers - } + //} // Commit or rollback if ($error) { @@ -328,8 +304,8 @@ class Cchargesociales $this->db->begin(); - if (!$error) { - if (!$notrigger) { + //if (!$error) { + //if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -337,8 +313,8 @@ class Cchargesociales //$result=$this->call_trigger('MYOBJECT_DELETE',$user); //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers - } - } + //} + //} if (!$error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; @@ -476,34 +452,33 @@ class Cchargesociales if ($mode == 0) { - $prefix=''; if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 1) + elseif ($mode == 1) { if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } } @@ -526,4 +501,20 @@ class Cchargesociales $this->module = ''; $this->accountancy_code = ''; } + + /** + * Trim object parameters + * @param string[] $parameters array of parameters to trim + * + * @return void + */ + private function trimParameters($parameters) + { + if (!is_array($parameters)) return; + foreach ($parameters as $parameter) { + if (isset($this->$parameter)) { + $this->$parameter = trim($this->$parameter); + } + } + } } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 2ea82fb32c4..aa5786d0eb5 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -76,7 +76,6 @@ class ChargeSociales extends CommonObject function __construct($db) { $this->db = $db; - return 1; } /** @@ -431,8 +430,9 @@ class ChargeSociales extends CommonObject { // phpcs:enable global $langs; - $langs->load('customers'); - $langs->load('bills'); + + // Load translation files required by the page + $langs->loadLangs(array("customers","bills")); if ($mode == 0 || $mode == 1) { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 9e1757fdc5a..babc7e1453a 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -186,6 +186,8 @@ if (empty($reshook)) $object->country_id = GETPOST("country_id",'int'); $object->state_id = GETPOST("state_id",'int'); $object->skype = GETPOST("skype",'alpha'); + $object->twitter = GETPOST("twitter",'alpha'); + $object->facebook = GETPOST("facebook",'alpha'); $object->email = GETPOST("email",'alpha'); $object->phone_pro = GETPOST("phone_pro",'alpha'); $object->phone_perso = GETPOST("phone_perso",'alpha'); @@ -358,6 +360,8 @@ if (empty($reshook)) $object->email = GETPOST("email",'alpha'); $object->skype = GETPOST("skype",'alpha'); + $object->twitter = GETPOST("twitter",'alpha'); + $object->facebook = GETPOST("facebook",'alpha'); $object->phone_pro = GETPOST("phone_pro",'alpha'); $object->phone_perso = GETPOST("phone_perso",'alpha'); $object->phone_mobile = GETPOST("phone_mobile",'alpha'); @@ -658,13 +662,28 @@ else // Instant message and no email print '|||||||||||||||||||||||||||||||||||||||||||||||
| '; - print ' | jabberid).'"> | jabberid).'"> | '; - // Skype - if (! empty($conf->skype->enabled)) + if (! empty($conf->socialnetworks->enabled)) { - print '||||||||||||||||||||||||||||||||||||||||||||||
| '; - print ' | skype).'"> | |||||||||||||||||||||||||||||||||||||||||||||||
| '; + print ' | skype).'"> | |||||||||||||||||||||||||||||||||||||||||||||||
| '; + print ' | twitter).'"> | |||||||||||||||||||||||||||||||||||||||||||||||
| '; + print ' | facebook).'"> | |||||||||||||||||||||||||||||||||||||||||||||||
| '; - print ' | skype).'"> | |||||||||||||||||||||||||||||||||||||||||||||||
| '; + print ' | skype).'"> | |||||||||||||||||||||||||||||||||||||||||||||||
| '; + print ' | twitter).'"> | |||||||||||||||||||||||||||||||||||||||||||||||
| '; + print ' | facebook).'"> | |||||||||||||||||||||||||||||||||||||||||||||||
| '.$langs->trans('Discount').' | ';
- if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
- else print $langs->trans("CompanyHasNoRelativeDiscount");
- $absolute_discount=$object->thirdparty->getAvailableDiscounts();
+ if ($object->thirdparty->remise_percent) {
+ print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
+ } else {
+ print $langs->trans("CompanyHasNoRelativeDiscount");
+ }
+ $absolute_discount = $object->thirdparty->getAvailableDiscounts();
print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
@@ -239,9 +241,7 @@ if ($id > 0 || ! empty($ref))
// Contacts lines
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
- }
- else
- {
+ } else {
print "ErrorRecordNotFound";
}
}
diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php
index 302ad161241..d2d34cd523a 100644
--- a/htdocs/core/actions_printing.inc.php
+++ b/htdocs/core/actions_printing.inc.php
@@ -28,8 +28,7 @@
// Filename to print must be provided into 'file' parameter
// Print file
-if ($action == 'print_file' && $user->rights->printing->read)
-{
+if ($action == 'print_file' && $user->rights->printing->read) {
$langs->load("printing");
require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php';
$objectprint = new PrintingDriver($db);
@@ -55,7 +54,7 @@ if ($action == 'print_file' && $user->rights->printing->read)
$subdir = 'commande';
}
try {
- $ret = $printer->print_file(GETPOST('file', 'alpha'), $module, $subdir);
+ $ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir);
if ($ret > 0) {
//print ''.print_r($printer->errors, true).''; setEventMessages($printer->error, $printer->errors, 'errors'); diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 54d265bf6af..dd64a07b8d9 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -86,7 +86,7 @@ class box_factures_imp extends ModeleBoxes if ($user->rights->facture->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid,"; + $sql = "SELECT s.nom as name, s.rowid as socid, s.email,"; $sql.= " s.code_client,"; $sql.= " s.logo,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,"; @@ -134,9 +134,11 @@ class box_factures_imp extends ModeleBoxes $facturestatic->total_ttc = $objp->total_ttc; $facturestatic->statut = $objp->fk_statut; $facturestatic->date_lim_reglement = $db->jdate($objp->datelimite); + $societestatic->id = $objp->socid; $societestatic->name = $objp->name; $societestatic->client = 1; + $societestatic->email = $objp->email; $societestatic->code_client = $objp->code_client; $societestatic->logo = $objp->logo; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 45998a78869..d1a46e4d0b9 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -59,7 +59,11 @@ class CMailFile var $eol; var $eol2; - var $error=''; + + /** + * @var string Error code (or message) + */ + public $error=''; var $smtps; // Contains SMTPs object (if this method is used) var $phpmailer; // Contains PHPMailer object (if this method is used) @@ -1027,7 +1031,7 @@ class CMailFile $mimedone=0; $out = ""; - if ($filename_list) + if (is_array($filename_list)) { $filename_list_size=count($filename_list); for($i=0;$i < $filename_list_size;$i++) @@ -1199,7 +1203,7 @@ class CMailFile /** * Attach an image to email (mode = 'mail') * - * @param array $images_list Tableau + * @param array $images_list Array of array image * @return string Chaine images encodees */ function write_images($images_list) @@ -1207,7 +1211,7 @@ class CMailFile // phpcs:enable $out = ''; - if ($images_list) + if (is_array($images_list)) { foreach ($images_list as $img) { diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index c2512af70ef..b6c334f7e1c 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -34,15 +34,18 @@ */ class CSMSFile { - var $error=''; + /** + * @var string Error code (or message) + */ + public $error=''; - var $addr_from; - var $addr_to; - var $deferred; - var $priority; - var $class; - var $message; - var $nostop; + public $addr_from; + public $addr_to; + public $deferred; + public $priority; + public $class; + public $message; + public $nostop; /** diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index d18501d54d9..c67e3f5f59d 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -40,7 +40,10 @@ class AntiVir */ public $errors = array(); - var $output; + /** + * @var string Used to return message + */ + public $output; /** * @var DoliDB Database handler. diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index a4665701661..cf830048cc0 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -43,15 +43,15 @@ class Canvas */ public $errors = array(); - var $actiontype; + public $actiontype; - var $dirmodule; // Module directory - var $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...) - var $canvas; // Name of canvas (ex: company, individual, product, service, ...) - var $card; // Tab (sub-canvas) + public $dirmodule; // Module directory + public $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...) + public $canvas; // Name of canvas (ex: company, individual, product, service, ...) + public $card; // Tab (sub-canvas) - var $template_dir; // Initialized by getCanvas with templates directory - var $control; // Initialized by getCanvas with controller instance + public $template_dir; // Initialized by getCanvas with templates directory + public $control; // Initialized by getCanvas with controller instance /** diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 2f9a8636c8b..f07916a7511 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -76,7 +76,6 @@ class Ccountry // extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index a818bfe7a2f..3792aaf9327 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -33,7 +33,11 @@ */ abstract class CommonDocGenerator { - var $error=''; + /** + * @var string Error code (or message) + */ + public $error=''; + protected $db; @@ -491,11 +495,11 @@ abstract class CommonDocGenerator /** * Define array with couple substitution key => substitution value * - * @param array $line Array of lines + * @param Object $line Object line * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - function get_substitutionarray_lines($line,$outputlangs) + function get_substitutionarray_lines($line, $outputlangs) { // phpcs:enable global $conf; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index e9be4b1f9da..9b1cb8776c3 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -431,11 +431,11 @@ abstract class CommonInvoice extends CommonObject { global $langs; if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); - if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); - if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); - if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); - if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used. - if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); + elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); + elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); + elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); + elseif ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used. + elseif ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); return $langs->trans("Unknown"); } @@ -475,10 +475,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); - if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); - return $langs->trans('Bill'.$prefix.'StatusStarted'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); + else return $langs->trans('Bill'.$prefix.'StatusStarted'); } else { @@ -493,10 +493,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); - if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); - return $langs->trans('Bill'.$prefix.'StatusStarted'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); + else return $langs->trans('Bill'.$prefix.'StatusStarted'); } else { @@ -511,10 +511,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); - if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid'); - return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid'); + else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted'); } else { @@ -529,10 +529,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); - if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1'); - return img_picto($langs->trans('BillStatusStarted'),'statut3'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); + elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1'); + else return img_picto($langs->trans('BillStatusStarted'),'statut3'); } else { @@ -547,10 +547,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); - if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid'); - return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid'); + else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted'); } else { @@ -566,14 +566,14 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return ''.$langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('BillStatusDraft'),'statut0'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); - if ($alreadypaid <= 0) + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); + elseif ($alreadypaid <= 0) { if ($type == self::TYPE_CREDIT_NOTE) return ''.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' '.img_picto($langs->trans('StatusNotRefunded'),'statut1'); return ''.$langs->trans('Bill'.$prefix.'StatusNotPaid').' '.img_picto($langs->trans('BillStatusNotPaid'),'statut1'); } - return ''.$langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('BillStatusStarted'),'statut3'); + else return ''.$langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('BillStatusStarted'),'statut3'); } else { @@ -598,7 +598,9 @@ abstract class CommonInvoice extends CommonObject if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; - $cdr_nbjour=0; $cdr_type=0; $cdr_decalage=0; + $cdr_nbjour=0; + $cdr_type=0; + $cdr_decalage=0; $sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7991bbb9ae9..8f7366541e3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1164,8 +1164,8 @@ abstract class CommonObject $sql.= " ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE ec.element_id = ".$id; $sql.= " AND ec.fk_socpeople = c.rowid"; - if ($source == 'internal') $sql.= " AND c.entity IN (0,".$conf->entity.")"; - if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('socpeople').")"; + if ($source == 'internal') $sql.= " AND c.entity IN (".getEntity('user').")"; + if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('societe').")"; $sql.= " AND ec.fk_c_type_contact = tc.rowid"; $sql.= " AND tc.element = '".$element."'"; $sql.= " AND tc.source = '".$source."'"; @@ -2899,6 +2899,7 @@ abstract class CommonObject // Special case if ($origin == 'order') $origin='commande'; if ($origin == 'invoice') $origin='facture'; + if ($origin == 'invoice_template') $origin='facturerec'; $this->db->begin(); @@ -3824,6 +3825,7 @@ abstract class CommonObject print ' | |||||||||||||||||||||||||||||||||||||||||||||||
| '; // Description @@ -4911,6 +4913,9 @@ abstract class CommonObject } } + //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); + //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); + switch ($attributeType) { case 'int': @@ -4924,6 +4929,21 @@ abstract class CommonObject $new_array_options[$key] = null; } break; + case 'double': + $value = price2num($value); + if (!is_numeric($value) && $value!='') + { + dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG); + $this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel); + return -1; + } + elseif ($value=='') + { + $new_array_options[$key] = null; + } + //dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); + $new_array_options[$key] = $value; + break; /*case 'select': // Not required, we chosed value='0' for undefined values if ($value=='-1') { @@ -5118,6 +5138,9 @@ abstract class CommonObject $attributeParam = $extrafields->attributes[$this->table_element]['param'][$key]; $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$key]; + //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); + //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); + switch ($attributeType) { case 'int': @@ -5131,6 +5154,21 @@ abstract class CommonObject $this->array_options["options_".$key] = null; } break; + case 'double': + $value = price2num($value); + if (!is_numeric($value) && $value!='') + { + dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG); + $this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel); + return -1; + } + elseif ($value=='') + { + $this->array_options["options_".$key] = null; + } + //dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); + $this->array_options["options_".$key] = $value; + break; /*case 'select': // Not required, we chosed value='0' for undefined values if ($value=='-1') { @@ -5329,7 +5367,7 @@ abstract class CommonObject if (!$required && $value == '') $value = '-1'; // TODO Must also support $moreparam - $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0); + $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); } elseif (in_array($type,array('int','integer'))) { @@ -7288,7 +7326,7 @@ abstract class CommonObject $comment = new Comment($this->db); $result=$comment->fetchAllFor($this->element, $this->id); if ($result<0) { - $this->errors=array_merge($this->errors,$comment->errors); + $this->errors=array_merge($this->errors, $comment->errors); return -1; } else { $this->comments = $comment->comments; @@ -7305,4 +7343,20 @@ abstract class CommonObject { return count($this->comments); } + + /** + * Trim object parameters + * @param string[] $parameters array of parameters to trim + * + * @return void + */ + public function trimParameters($parameters) + { + if (!is_array($parameters)) return; + foreach ($parameters as $parameter) { + if (isset($this->$parameter)) { + $this->$parameter = trim($this->$parameter); + } + } + } } diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 6d4c32d82bb..5289ed882ff 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -61,9 +61,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; */ abstract class CommonStickerGenerator { - public $code; // Code of format - public $format; // Array with informations + + /** + * @var array format Array with informations + */ + public $format; // protected var $_Avery_Name = ''; // Nom du format de l'etiquette diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index db22d443c54..d6c768811c8 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -35,12 +35,12 @@ class Conf /** \public */ //! To store properties found in conf file var $file; - + /** * @var DoliDB Database handler. */ public $db; - + //! To store properties found into database var $global; //! To store browser info @@ -182,7 +182,7 @@ class Conf if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue; else if (in_array($partname,array('login','menus','substitutions','triggers','tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/'; else if (in_array($partname,array('models','theme'))) $value = '/'.$modulename.'/'; - else if (in_array($partname,array('sms'))) $value = $modulename; + else if (in_array($partname,array('sms'))) $value = '/'.$modulename.'/'; else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array } diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 085da06c754..4320446d7b5 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -56,7 +56,19 @@ class Cstate // extends CommonObject public $id; public $code_departement; - public $nom; + + /** + * @var string + * @deprecated + * @see name + */ + public $nom=''; + + /** + * @var string name + */ + public $name=''; + public $active; @@ -70,7 +82,6 @@ class Cstate // extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index 9366cf6317b..db8ed461727 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -66,7 +66,6 @@ class Ctypent // extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 618716ce0e4..ad7b900b033 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -39,46 +39,46 @@ */ class DolGraph { - var $type=array(); // Array with type of each series. Example: array('bars', 'lines', ...) - var $mode='side'; // Mode bars graph: side, depth + public $type=array(); // Array with type of each series. Example: array('bars', 'lines', ...) + public $mode='side'; // Mode bars graph: side, depth private $_library='jflot'; // Graphic library to use (jflot, artichow) //! Array of data - var $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) - var $title; // Title of graph - var $cssprefix=''; // To add into css styles - var $width=380; - var $height=200; - var $MaxValue=0; - var $MinValue=0; - var $SetShading=0; + public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) + public $title; // Title of graph + public $cssprefix=''; // To add into css styles + public $width=380; + public $height=200; + public $MaxValue=0; + public $MinValue=0; + public $SetShading=0; - var $PrecisionY=-1; + public $PrecisionY=-1; - var $horizTickIncrement=-1; - var $SetNumXTicks=-1; - var $labelInterval=-1; + public $horizTickIncrement=-1; + public $SetNumXTicks=-1; + public $labelInterval=-1; - var $hideXGrid=false; - var $hideYGrid=false; + public $hideXGrid=false; + public $hideYGrid=false; - var $Legend=array(); - var $LegendWidthMin=0; - var $showlegend=1; - var $showpointvalue=1; - var $showpercent=0; - var $combine=0; // 0.05 if you want to combine records < 5% into "other" - var $graph; // Objet Graph (Artichow, Phplot...) + public $Legend=array(); + public $LegendWidthMin=0; + public $showlegend=1; + public $showpointvalue=1; + public $showpercent=0; + public $combine=0; // 0.05 if you want to combine records < 5% into "other" + public $graph; // Objet Graph (Artichow, Phplot...) /** * @var string Error code (or message) */ public $error=''; - var $bordercolor; // array(R,G,B) - var $bgcolor; // array(R,G,B) - var $bgcolorgrid=array(255,255,255); // array(R,G,B) - var $datacolor; // array(array(R,G,B),...) + public $bordercolor; // array(R,G,B) + public $bgcolor; // array(R,G,B) + public $bgcolorgrid=array(255,255,255); // array(R,G,B) + public $datacolor; // array(array(R,G,B),...) private $stringtoshow; // To store string to output graph into HTML page diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 2ac2a51d2ed..436a708d312 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -117,7 +117,6 @@ class Events // extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index c86bd3eff3f..07f6849e7ec 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1001,7 +1001,7 @@ class ExtraFields if (!$required && $value == '') $value = '-1'; // TODO Must also support $moreparam - $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0); + $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); } elseif (in_array($type,array('int','integer'))) { diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index de4dc46ac90..c4ab50179d9 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -79,9 +79,7 @@ class Fiscalyear extends CommonObject $this->db = $db; $this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); - $this->statuts = array(0 => 'Opened', 1 => 'Closed'); - - return 1; + $this->statuts = array(0 => 'Opened', 1 => 'Closed'); } /** diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 177b05850ed..149f1681725 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1108,8 +1108,8 @@ class Form else if (!is_array($selected)) $selected = array($selected); // Clean $filter that may contains sql conditions so sql code - if (function_exists('test_sql_and_script_inject')) { - if (test_sql_and_script_inject($filter, 3)>0) { + if (function_exists('testSqlAndScriptInject')) { + if (testSqlAndScriptInject($filter, 3)>0) { $filter =''; } } @@ -4829,6 +4829,10 @@ class Form $tmpthirdparty=new Societe($this->db); $defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); $defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); + if (preg_match('/\((.*)\)/', $defaulttx, $reg)) { + $defaultcode=$reg[1]; + $defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx); + } if (empty($defaulttx)) $defaultnpr=0; } @@ -4928,18 +4932,17 @@ class Form * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field. * @param datetime $adddateof Add a link "Date of invoice" using the following date. - * @return string|null Nothing or string if nooutput is 1 + * @return string|null Nothing or string if nooutput is 1 * @deprecated * @see form_date, select_month, select_year, select_dayofweek */ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') { // phpcs:enable - $retstring = $this->selectDate($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $disabled=0, $fullday='', $addplusone='', $adddateof=''); + $retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); if (! empty($nooutput)) { return $retstring; } - print $retstring; return; } @@ -5730,7 +5733,7 @@ class Form * @param string $morecss Add more class to css styles * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. * @param string $placeholder String to use as placeholder - * @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) + * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return string HTML select string * @see selectArrayFilter, ajax_combobox in ajax.lib.php */ @@ -5832,7 +5835,7 @@ class Form * @param string $morecss Add more class to css styles * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. * @param string $placeholder String to use as placeholder - * @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) + * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return string HTML select string * @see selectArrayAjax, ajax_combobox in ajax.lib.php */ @@ -5949,55 +5952,76 @@ class Form * @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95% * @param string $moreattrib Add more options on select component. Example: 'disabled' * @param string $elemtype Type of element we show ('category', ...) + * @param string $placeholder String to use as placeholder + * @param int $addjscombo Add js combo * @return string HTML multiselect string * @see selectarray */ - static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='',$elemtype='') + static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=1) { global $conf, $langs; $out = ''; + // Add code for jquery to use multiselect if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { - $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; - $out.="\n".' - '; + $out.="\n".' + '; } // Try also magic suggest @@ -6075,7 +6099,7 @@ class Form } if ($val['label']) { - $lis.=' | ||||||||||||||||||||||||||||||||||||||||||||||||
| '; print ''; print ' | '; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index e01e1f2ad65..25a3973cbd8 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -48,7 +48,6 @@ class FormActions function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 22fa73741ce..8d8e65e5130 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -41,7 +41,6 @@ class FormAdmin function __construct($db) { $this->db = $db; - return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index c2c408801c4..eb08aab6de7 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -48,7 +48,6 @@ class FormBarCode function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 5c39bc0cef4..273a84cbc94 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -49,8 +49,6 @@ class FormCompany function __construct($db) { $this->db = $db; - - return 1; } diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index 496d77f1f68..94747481cb0 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -46,7 +46,6 @@ class FormCron extends Form function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c1bc479fc73..4a59e28f044 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -54,7 +54,6 @@ class FormFile { $this->db = $db; $this->numoffiles=0; - return 1; } @@ -128,11 +127,12 @@ class FormFile if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024; if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024; // Now $max and $maxphp are in Kb - if ($maxphp > 0) $max=min($max,$maxphp); + $maxmin = $max; + if ($maxphp > 0) $maxmin=min($max,$maxphp); - if ($max > 0) + if ($maxmin > 0) { - $out .= ''; + $out .= ''; } $out .= 'load('link'); $title = $langs->trans("LinkANewFile"); $out .= load_fiche_titre($title, null, null); @@ -213,19 +213,18 @@ class FormFile $out .= ''; $out .= ''; $out .= '||||||||||||||||||||||||||||||||||||||||||||||||