diff --git a/ChangeLog b/ChangeLog index 06f749cbc34..54244427b81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -176,7 +176,8 @@ Following changes may create regressions for some external modules, but were nec * Deprecated property ->fk_departement is now ->state_id everywhere. * Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr. * Column llx_facture.facnumber change to llx_facture.ref - +* Variable $dolibarr_main_cookie_cryptkey is no more created at install (it was not used by Dolibarr). A new variable + called $dolibarr_main_instance_unique_id is now generated at each installation. It will be used by some future features. ***** ChangeLog for 9.0.3 compared to 9.0.2 ***** FIX: #11013 diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 30099b40be4..daf73e5b2a7 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -75,10 +75,13 @@ + @@ -97,8 +100,11 @@ - - + + + + 0 + + + + + 0 @@ -152,7 +162,10 @@ - + + + 0 + @@ -169,7 +182,16 @@ - + + @@ -310,22 +332,29 @@ - + + + + 0 + 0 0 + 0 @@ -334,12 +363,15 @@ + 0 + 0 + 0 diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 8ca2de4a132..0bfbbea2581 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2017 Elarifr. Ari Elbaz * Copyright (C) 2017-2019 Frédéric France - + * Copyright (C) 2017 André Schild * * 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 @@ -51,6 +51,7 @@ class AccountancyExport public static $EXPORT_TYPE_AGIRIS = 9; public static $EXPORT_TYPE_FEC = 11; public static $EXPORT_TYPE_OPENCONCERTO = 12; + public static $EXPORT_TYPE_SAGE50_SWISS = 13; /** @@ -106,6 +107,7 @@ class AccountancyExport self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'), self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), + self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'), ); } @@ -130,6 +132,7 @@ class AccountancyExport self::$EXPORT_TYPE_AGIRIS => 'agiris', self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto', self::$EXPORT_TYPE_FEC => 'fec', + self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch', ); return $formatcode[$type]; @@ -194,6 +197,10 @@ class AccountancyExport 'label' => $langs->trans('Modelcsv_openconcerto'), 'ACCOUNTING_EXPORT_FORMAT' => 'csv', ), + self::$EXPORT_TYPE_SAGE50_SWISS => array( + 'label' => $langs->trans('Modelcsv_Sage50_Swiss'), + 'ACCOUNTING_EXPORT_FORMAT' => 'csv', + ), ), 'cr'=> array ( '1' => $langs->trans("Unix"), @@ -261,6 +268,9 @@ class AccountancyExport case self::$EXPORT_TYPE_FEC : $this->exportFEC($TData); break; + case self::$EXPORT_TYPE_SAGE50_SWISS : + $this->exportSAGE50SWISS($TData); + break; default: $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); break; @@ -575,19 +585,19 @@ class AccountancyExport $date = dol_print_date($line->doc_date, '%d%m%Y'); print $line->piece_num . $separator; - print $line->label_operation . $separator; + print self::toAnsi($line->label_operation) . $separator; print $date . $separator; - print $line->label_operation . $separator; + print self::toAnsi($line->label_operation) . $separator; if (empty($line->subledger_account)) { print length_accountg($line->numero_compte) . $separator; - print $line->label_compte . $separator; + print self::toAnsi($line->label_compte) . $separator; } else { print length_accounta($line->subledger_account) . $separator; - print $line->subledger_label . $separator; + print self::toAnsi($line->subledger_label) . $separator; } - print $line->doc_ref . $separator; + print self::toAnsi($line->doc_ref) . $separator; print price($line->debit) . $separator; print price($line->credit) . $separator; print price($line->montant) . $separator; @@ -757,6 +767,156 @@ class AccountancyExport } } + /** + * Export format : SAGE50SWISS + * + * https://onlinehelp.sageschweiz.ch/default.aspx?tabid=19984 + * http://media.topal.ch/Public/Schnittstellen/TAF/Specification/Sage50-TAF-format.pdf + * + * @param array $objectLines data + * + * @return void + */ + public function exportSAGE50SWISS($objectLines) + { + // SAGE50SWISS + $this->separator = ','; + $this->end_line = "\r\n"; + + // Print header line + print "Blg,Datum,Kto,S/H,Grp,GKto,SId,SIdx,KIdx,BTyp,MTyp,Code,Netto,Steuer,FW-Betrag,Tx1,Tx2,PkKey,OpId,Flag"; + print $this->end_line; + $thisPieceNum= ""; + $thisPieceAccountNr= ""; + $aSize= count($objectLines); + foreach ($objectLines as $aIndex=>$line) + { + $sammelBuchung= false; + if ($aIndex-2 >= 0 && $objectLines[$aIndex-2]->piece_num == $line->piece_num) + { + $sammelBuchung= true; + } + elseif ($aIndex+2 < $aSize && $objectLines[$aIndex+2]->piece_num == $line->piece_num) + { + $sammelBuchung= true; + } + elseif ($aIndex+1 < $aSize + && $objectLines[$aIndex+1]->piece_num == $line->piece_num + && $aIndex-1 < $aSize + && $objectLines[$aIndex-1]->piece_num == $line->piece_num + ) + { + $sammelBuchung= true; + } + + //Blg + print $line->piece_num . $this->separator; + + // Datum + $date = dol_print_date($line->doc_date, '%d.%m.%Y'); + print $date . $this->separator; + + // Kto + print length_accountg($line->numero_compte) . $this->separator; + // S/H + if ($line->sens == 'D') + { + print 'S' . $this->separator; + } + else + { + print 'H' . $this->separator; + } + //Grp + print self::trunc($line->code_journal, 1) . $this->separator; + // GKto + if (empty($line->code_tiers)) + { + if ($line->piece_num == $thisPieceNum) + { + print length_accounta($thisPieceAccountNr) . $this->separator; + } + else + { + print "div" . $this->separator; + } + } + else + { + print length_accounta($line->code_tiers) . $this->separator; + } + //SId + print $this->separator; + //SIdx + print "0" . $this->separator; + //KIdx + print "0" . $this->separator; + //BTyp + print "0" . $this->separator; + + //MTyp 1=Fibu Einzelbuchung 2=Sammebuchung + if ($sammelBuchung) + { + print "2" . $this->separator; + } + else + { + print "1" . $this->separator; + } + // Code + print '""' . $this->separator; + // Netto + if ($line->montant >= 0) + { + print $line->montant . $this->separator; + } + else + { + print $line->montant*-1 . $this->separator; + } + // Steuer + print "0.00" . $this->separator; + // FW-Betrag + print "0.00" . $this->separator; + // Tx1 + $line1= self::toAnsi($line->label_compte, 29); + if ($line1 == "LIQ" || $line1 == "LIQ Beleg ok" || strlen($line1) <= 3) + { + $line1= ""; + } + $line2= self::toAnsi($line->doc_ref, 29); + if (strlen($line1) == 0) + { + $line1= $line2; + $line2= ""; + } + if (strlen($line1) > 0 && strlen($line2) > 0 && (strlen($line1) + strlen($line2)) < 27) + { + $line1= $line1 . ' / ' . $line2; + $line2= ""; + } + + print '"' . self::toAnsi($line1). '"' . $this->separator; + // Tx2 + print '"' . self::toAnsi($line2). '"' . $this->separator; + //PkKey + print "0" . $this->separator; + //OpId + print $this->separator; + + // Flag + print "0"; + + print $this->end_line; + + if ($line->piece_num !== $thisPieceNum) + { + $thisPieceNum= $line->piece_num; + $thisPieceAccountNr= $line->numero_compte; + } + } + } + /** * * @param string $str data @@ -767,4 +927,20 @@ class AccountancyExport { return dol_trunc($str, $size, 'right', 'UTF-8', 1); } + + /** + * + * @param unknown $str Original string to encode and optionaly truncate + * @param integer $size truncate string after $size characters + * @return string String encoded in Windows-1251 charset + */ + public static function toAnsi($str, $size = -1) + { + $retVal= dol_string_nohtmltag($str, 1, 'Windows-1251'); + if ($retVal >= 0 && $size >= 0) + { + $retVal= mb_substr($retVal, 0, $size, 'Windows-1251'); + } + return $retVal; + } } diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index c8a855c0d8a..a704b1c9789 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -83,13 +83,13 @@ class AccountancySystem if ($rowid > 0 || $ref) { - $sql = "SELECT a.pcg_version, a.label, a.active"; + $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a"; $sql .= " WHERE"; if ($rowid) { $sql .= " a.rowid = '" . $rowid . "'"; } elseif ($ref) { - $sql .= " a.pcg_version = '" . $ref . "'"; + $sql .= " a.pcg_version = '" . $this->db->escape($ref) . "'"; } dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 33f8990bc8d..4d97b38bfb7 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -151,12 +151,13 @@ class AccountingAccount extends CommonObject /** * Load record in memory * - * @param int $rowid Id - * @param string $account_number Account number - * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system - * @return int <0 if KO, 0 if not found, Id of record if OK and found + * @param int $rowid Id + * @param string $account_number Account number + * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account + * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC'. + * @return int <0 if KO, 0 if not found, Id of record if OK and found */ - public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) + public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '') { global $conf; @@ -174,6 +175,9 @@ class AccountingAccount extends CommonObject if (! empty($limittocurrentchart)) { $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')'; } + if (! empty($limittoachartaccount)) { + $sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'"; + } dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 85720de5156..3aed4bc11d5 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -273,7 +273,7 @@ if (empty($reshook)) { if (empty($login)) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); } } // Create new object @@ -509,7 +509,7 @@ if (empty($reshook)) { if (empty($login)) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); } else { $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fc61e56115c..3119e044be0 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -596,7 +596,7 @@ class Adherent extends CommonObject { while ($obj=$this->db->fetch_object($resql2)) { - $this->type=$obj->label; + $this->type=$obj->label; } } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 5e7847efa82..3a39632d783 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -411,7 +411,7 @@ class AdherentType extends CommonObject } } - /** + /** * Return translated label by the nature of a adherent (physical or moral) * * @param string $morphy Nature of the adherent (physical or moral) diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php index 4d860abcc68..885e453c6f1 100644 --- a/htdocs/adherents/htpasswd.php +++ b/htdocs/adherents/htpasswd.php @@ -43,13 +43,13 @@ if (empty($sortorder)) { $sortorder="ASC"; } if (empty($sortfield)) { $sortfield="d.login"; } if (! isset($statut)) { - $statut = 1 ; + $statut = 1 ; } if (! isset($cotis)) { - // by default, members must be up to date of subscription - $cotis=1; + // by default, members must be up to date of subscription + $cotis=1; } diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 2ae7e2d0001..bffb3418dba 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -235,7 +235,7 @@ else print '
'; print ''.$langs->trans("MembersStatisticsByTown").'
'; print '
';//+ - print ''.$langs->trans("MembersStatisticsByRegion").'
';//+ + print ''.$langs->trans("MembersStatisticsByRegion").'
';//+ } print '
'; } diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 574f061b25d..8e8482d4398 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -306,7 +306,7 @@ if (! empty($arrayfields['d.fk_type']['checked'])) { print ''; print ''; - print''; + print''; } if (! empty($arrayfields['d.lastname']['checked'])) diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index e85eed336fb..99e3cc5f526 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -47,10 +47,10 @@ foreach($linkedObjectBlock as $key => $objectlink) dateh, 'day'); ?> rights->adherent->lire) { - $total = $total + $objectlink->amount; - echo price($objectlink->amount); - } ?> + if ($user->rights->adherent->lire) { + $total = $total + $objectlink->amount; + echo price($objectlink->amount); + } ?> ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 1a5c368f177..650a466140c 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -281,9 +281,9 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''.dol_escape_htmltag($objp->label).''; print ''; - if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } - elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } - else print $langs->trans("Physical & Morale"); + if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } + elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } + else print $langs->trans("Physical & Morale"); print ''; print ''.yn($objp->subscription).''; print ''.yn($objp->vote).''; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 54f3a4cbb73..32398f05ada 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -987,7 +987,7 @@ else print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 160e8b079e8..1d05d5e0afe 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -268,8 +268,8 @@ print $langs->trans("DescWeather").'
'; if($action == 'edit') { - $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoPercentageMod')); - $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoStdMod')); + $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod')); + $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod')); if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std; else $str_mode_enabled = $str_mode_percentage; print ''.$str_mode_enabled.''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index a7e6a1aff67..14cb63cd923 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -439,7 +439,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index f6a526600d7..931d1168238 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -406,7 +406,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 51fe9a25554..b4f5fbd3355 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -177,13 +177,13 @@ if ($action == 'add') } if (! $error && ! $_POST['url']) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("URL")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors'); $action = 'create'; $error++; } if (! $error && ! $_POST['titre']) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors'); $action = 'create'; $error++; } diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index c0c67c52331..7ca92570aa4 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -421,7 +421,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index ae64665bbfd..d7302a2c795 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -449,7 +449,7 @@ class BlockedLog { if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties if (! in_array($key, array( - 'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines' + 'ref','ref_client','ref_supplier','date','datef','datev','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines' ))) continue; // Discard if not into a dedicated list if ($key == 'lines') { @@ -459,8 +459,8 @@ class BlockedLog $lineid++; foreach($tmpline as $keyline => $valueline) { - if (! in_array($keyline, array( - 'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2' + if (! in_array($keyline, array( + 'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2' ))) continue; // Discard if not into a dedicated list if (! is_object($this->object_data->invoiceline[$lineid])) $this->object_data->invoiceline[$lineid] = new stdClass(); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index fddba91eeeb..0f2dfb5e52b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -110,8 +110,40 @@ if (empty($reshook)) $autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO'; $trackid='bom'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; -} + // Add line + if ($action == 'addline' && $user->rights->bom->write) + { + $langs->load('errors'); + $error = 0; + + // Set if we used free entry or predefined product + $idprod=GETPOST('idprod', 'int'); + $qty=GETPOST('qty', 'int'); + $efficiency=GETPOST('efficiency', 'int'); + + if ($qty == '') { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); + $error++; + } + if (! ($idprod > 0)) { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Product')), null, 'errors'); + $error++; + } + + $bomline = new BOMLine($db); + $bomline->fk_bom = $id; + $bomline->fk_product = $idprod; + $bomline->qty = $qty; + $bomline->efficiency = $efficiency; + + $result = $bomline->create($user); + if ($result <= 0) + { + setEventMessages($bomline->error, $bomline->errors, 'errors'); + } + } +} /* @@ -320,7 +352,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - print '

'; + print '
'; dol_fiche_end(); @@ -347,7 +379,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print '
'; - if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print ''; } @@ -363,14 +395,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action != 'editline') { // Add products/services form -// $object->formAddObjectLine(1, $mysoc, $soc); + $object->formAddObjectLine(1, $mysoc, $soc, '/bom/tpl'); $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook } } - if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
'; } diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 62e6a21ac22..bbb51211137 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -372,12 +372,18 @@ print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; - if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) print ''; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield='center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -399,11 +405,11 @@ print ''."\n"; print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + $cssforfield=(empty($val['css'])?'':$val['css']); if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; @@ -444,31 +450,23 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print ''; if ($key == 'status') print $object->getLibStatut(5); elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); else print $object->showOutputField($val, $key, $obj->$key, ''); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 6ada9b167f9..de67cbc82e8 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -62,7 +62,7 @@ class BOM extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; - const STATUS_DISABLED = -1; + const STATUS_CANCELED = 9; /** @@ -94,18 +94,19 @@ class BOM extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), - 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), - 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,), - 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), - 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), - 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Enabled', '-1'=>'Disabled')), + 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,), + 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,), + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), + 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,), + 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), + 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), + 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900, 'notnull'=>-1,), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')), ); public $rowid; public $ref; @@ -121,6 +122,7 @@ class BOM extends CommonObject public $status; public $fk_product; public $qty; + public $efficiency; // END MODULEBUILDER PROPERTIES @@ -758,8 +760,9 @@ class BOM extends CommonObject { global $langs; //$langs->load("mrp"); - $this->labelstatus[1] = $langs->trans('Enabled'); - $this->labelstatus[0] = $langs->trans('Disabled'); + $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); } if ($mode == 0) @@ -772,28 +775,23 @@ class BOM extends CommonObject } elseif ($mode == 2) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 5) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 6) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } } @@ -948,7 +946,7 @@ class BOMLine extends CommonObject /** * @var string String with name of icon for bomline. Must be the part after the 'object_' into object_bomline.png */ - public $picto = 'bomline@bom'; + public $picto = 'bomline'; /** @@ -976,20 +974,22 @@ class BOMLine extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), + 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), + 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',), + 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), - 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'isameasure'=>'1',), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,), - 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>-1, 'index'=>1,), - 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>40, 'notnull'=>1,), ); public $rowid; - public $description; - public $import_key; - public $qty; - public $fk_product; public $fk_bom; + public $fk_product; + public $description; + public $qty; + public $efficiency; public $rank; + public $import_key; // END MODULEBUILDER PROPERTIES diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php new file mode 100644 index 00000000000..da9942fce44 --- /dev/null +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -0,0 +1,189 @@ + + * Copyright (C) 2010-2014 Laurent Destailleur + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2015-2016 Marcos García + * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Ferran Marcet + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + */ + +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) { + print "Error: this template page cannot be called directly as an URL"; + exit; +} + + +if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) +global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; + +if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility +elseif (empty($dateSelector)) $dateSelector=0; +if (empty($forceall)) $forceall=0; +if (empty($senderissupplier)) $senderissupplier=0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; + + +// Define colspan for the button 'Add' +$colspan = 3; // Columns: total ht + col edit + col delete +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required +if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button +//print $object->element; + +// Lines for extrafield +$objectline = new BOMLine($this->db); +?> + + +lines) == 0 || $forcetoshowtitlelines); +if ($nolinesbefore) { +?> + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + + global->PRODUCT_USE_UNITS) + { + print ''; + } + ?> + + + + + +global->MAIN_VIEW_LINE_NUMBER)) { + $coldisplay++; + echo ''; + } + + $coldisplay++; + ?> + + global->PRODUCT_USE_UNITS) + { + $coldisplay++; + print ''; + } + $remise_percent = $buyer->remise_percent; + if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') + { + $remise_percent = $seller->remise_supplier_percent; + } + + $coldisplay++; + ?> + + + + + +showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); +} +?> + + + + diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php new file mode 100644 index 00000000000..3763b771854 --- /dev/null +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -0,0 +1,325 @@ + + * Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2018 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $seller, $buyer + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + */ + +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) +{ + print "Error, template page can't be called as URL"; + exit; +} + + +global $forceall, $senderissupplier, $inputalsopricewithtax; +if (empty($dateSelector)) $dateSelector=0; +if (empty($forceall)) $forceall=0; +if (empty($senderissupplier)) $senderissupplier=0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; + + +// Define colspan for the button 'Add' +$colspan = 3; // Col total ht + col edit + col delete +if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc +if (in_array($object->element, array('propal','supplier_proposal','facture','facturerec','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; +?> + + + + + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + + element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + $coldisplay++; + ?> + + fk_prev_id == null) { + print ''; + } else { + print ''; + } + + $coldisplay++; + print ''; + + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + $coldisplay++; + print ''; + } + + if ($inputalsopricewithtax) + { + $coldisplay++; + print ''; + } + ?> + + + global->PRODUCT_USE_UNITS) + { + $coldisplay++; + print ''; + } + ?> + + + + + + + +showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); +} +?> + +service->enabled) && $line->product_type == 1 && $dateSelector) { ?> + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + + + + + + diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php new file mode 100644 index 00000000000..46c25e3674c --- /dev/null +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -0,0 +1,330 @@ + + * Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2017 Juanjo Menent + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $element (used to test $user->rights->$element->creer) + * $permtoedit (used to replace test $user->rights->$element->creer) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $object_rights->creer initialized from = $object->getRights() + * $disableedit, $disablemove, $disableremove + * + * $type, $text, $description, $line + */ + +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) +{ + print "Error, template page can't be called as URL"; + exit; +} + + +global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax; + +if (empty($dateSelector)) $dateSelector=0; +if (empty($forceall)) $forceall=0; +if (empty($senderissupplier)) $senderissupplier=0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; +if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; + +// add html5 elements +$domData = ' data-element="'.$line->element.'"'; +$domData .= ' data-id="'.$line->id.'"'; +$domData .= ' data-qty="'.$line->qty.'"'; +$domData .= ' data-product_type="'.$line->product_type.'"'; + + +?> + + + > + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + + element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + ?> + + + + + + + multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> + + + + + + + + + + global->PRODUCT_USE_UNITS) + { + print ''; + } + ?> + + remise_percent) && $line->special_code != 3) { ?> + + + + global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); + + ?> + + special_code == 3) { ?> + + + + multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> + + + + + + + + + statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?> + + + + + 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { ?> + + + + + + + + + + + + +showOptionals($extrafieldsline, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); +} +?> + + diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index fff9b40d5ea..a4bba8f7adc 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -267,7 +267,7 @@ if ($action == 'savefilter' || $action == 'createfilter') { $error = 0; if ($action == 'createfilter' && empty($template_name)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('AdvTgtOrCreateNewFilter')), null, 'errors'); $error ++; } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 9f31e8f64c1..b6f5d9328f8 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -424,7 +424,7 @@ if (empty($reshook)) $object->sendto = $_POST["sendto"]; if (! $object->sendto) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("MailTo")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTo")), null, 'errors'); $error++; } @@ -870,7 +870,7 @@ else } $text.=$langs->trans('ConfirmSendingEmailing').'
'; $text.=$langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 300); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 330, 600); } } diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index bbdfc57af50..1b78370048a 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink) - + - - + + diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 48b4ee6440d..eabb217fb99 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -161,7 +161,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) $error=0; if (empty($desc)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReasonDiscount")), null, 'errors'); $error++; } @@ -193,7 +193,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) } else { - setEventMessages($langs->trans("ErrorFieldFormat", $langs->trans("NewGlobalDiscount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("NewGlobalDiscount")), null, 'errors'); } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 47cdb8856cb..37f4ac4b9b2 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -816,7 +816,7 @@ class Commande extends CommonOrder } if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("Source")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Source")); dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } @@ -4053,6 +4053,33 @@ class OrderLine extends CommonOrderLine $error=0; + // check if order line is not in a shipment line before deleting + $sqlCheckShipmentLine = "SELECT"; + $sqlCheckShipmentLine .= " ed.rowid"; + $sqlCheckShipmentLine .= " FROM " . MAIN_DB_PREFIX . "expeditiondet ed"; + $sqlCheckShipmentLine .= " WHERE ed.fk_origin_line = " . $this->rowid; + + $resqlCheckShipmentLine = $this->db->query($sqlCheckShipmentLine); + if (!$resqlCheckShipmentLine) { + $error++; + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + } else { + $langs->load('errors'); + $num = $this->db->num_rows($resqlCheckShipmentLine); + if ($num > 0) { + $error++; + $objCheckShipmentLine = $this->db->fetch_object($resqlCheckShipmentLine); + $this->error = $langs->trans('ErrorRecordAlreadyExists') . ' : ' . $langs->trans('ShipmentLine') . ' ' . $objCheckShipmentLine->rowid; + $this->errors[] = $this->error; + } + $this->db->free($resqlCheckShipmentLine); + } + if ($error) { + dol_syslog(__METHOD__ . 'Error ; ' . $this->error, LOG_ERR); + return -1; + } + $this->db->begin(); $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid=".$this->rowid; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 0c43475f2fb..444927ea27d 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -877,12 +877,12 @@ if ($resql) } if (! empty($arrayfields['bu.label']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['ba.ref']['checked'])) { - print ''; } if (! empty($arrayfields['b.debit']['checked'])) @@ -940,7 +940,7 @@ if ($resql) if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], 'bu.label', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); @@ -961,6 +961,7 @@ if ($resql) $balancebefore = 0; // For balance $balancecalculated = false; $posconciliatecol = 0; + $cachebankaccount = array(); // Loop on each record $sign = 1; @@ -1337,7 +1338,7 @@ if ($resql) // Bank account if (! empty($arrayfields['ba.ref']['checked'])) { - print '\n"; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 5a7ac205fe5..cc43f9cf830 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -44,7 +44,7 @@ class PaymentVarious extends CommonObject /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'bill'; + public $picto = 'payment'; /** * @var int ID @@ -63,6 +63,7 @@ class PaymentVarious extends CommonObject public $amount; public $type_payment; public $num_payment; + public $category_transaction; /** * @var string various payments label @@ -414,13 +415,13 @@ class PaymentVarious extends CommonObject $sign=1; if ($this->sens == '0') $sign=-1; - $bank_line_id = $acc->addline( + $bank_line_id = $acc->addline( $this->datep, $this->type_payment, $this->label, $sign * abs($this->amount), $this->num_payment, - '', + ($this->category_transaction > 0 ? $this->category_transaction : 0), $user ); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index a1c1d8ae349..2d911b5c6bb 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -37,7 +37,7 @@ if (! empty($conf->projet->enabled)) } // Load translation files required by the page -$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); +$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy", "categories")); // Get parameters $id = GETPOST('id', 'int'); @@ -45,14 +45,15 @@ $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); -$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; -$label=GETPOST("label", "alpha"); -$sens=GETPOST("sens", "int"); -$amount=GETPOST("amount", "alpha"); -$paymenttype=GETPOST("paymenttype", "int"); -$accountancy_code=GETPOST("accountancy_code", "alpha"); -$subledger_account=GETPOST("subledger_account", "alpha"); -$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); +$accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; +$label = GETPOST("label", "alpha"); +$sens = GETPOST("sens", "int"); +$amount = GETPOST("amount", "alpha"); +$paymenttype = GETPOST("paymenttype", "int"); +$accountancy_code = GETPOST("accountancy_code", "alpha"); +$subledger_account = GETPOST("subledger_account", "alpha"); +$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); +$category_transaction = GETPOST("category_transaction", 'alpha'); // Security check $socid = GETPOST("socid", "int"); @@ -64,8 +65,6 @@ $object = new PaymentVarious($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('variouscard','globalcard')); - - /** * Actions */ @@ -113,6 +112,7 @@ if (empty($reshook)) $object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0; $object->num_payment=GETPOST("num_payment", 'alpha'); $object->fk_user_author=$user->id; + $object->category_transaction=GETPOST("category_transaction", 'alpha'); $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : ""; $object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; @@ -144,6 +144,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); $error++; } + // TODO Remove this and allow instead to edit a various payment to enter accounting code if (! empty($conf->accounting->enabled) && ! $object->accountancy_code) { $langs->load('errors'); @@ -240,6 +241,16 @@ if ($id) } } +$options = array(); + +// Load bank groups +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; +$bankcateg = new BankCateg($db); + +foreach ($bankcateg->fetchAll() as $bankcategory) { + $options[$bankcategory->id] = $bankcategory->label; +} + /* ************************************************************************** */ /* */ /* Create mode */ @@ -259,7 +270,7 @@ if ($action == 'create') print '
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + else print ''; + print '
+
trans('AddNewLine'); ?>trans("FreeZone"); ?> +
trans('Qty'); ?>'; + print ''; + print $langs->trans('Unit'); + print 'textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')); ?> 
+ + product->enabled) || ! empty($conf->service->enabled)) + { + if ($forceall >= 0 && $freelines) echo '
'; + echo ''; + + $filtertype=''; + if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; + + if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) + { + // hide products in closed warehouse, but show products for internal transfer + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + } + else + { + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); + } + + echo ''; + } + + $coldisplay++; + ?> +
"> + '; + print $form->selectUnits($line->fk_unit, "units"); + print '"> + +
+
+ + + + + + + + fk_product > 0) { ?> + + fk_parent_line > 0) echo img_picto('', 'rightarrow'); + ?> + + product_type==1) echo img_object($langs->trans('ShowService'), 'service'); + else print img_object($langs->trans('ShowProduct'), 'product'); + echo ' '.$line->ref; + ?> + + product_label); + ?> + +

+ + + + fk_parent_line); + $parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer); + $reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); + } + + ?> +
' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '%fk_prev_id != null) print ' readonly'; + print '>fk_prev_id != null) print ' readonly'; + print '> + info_bits & 2) != 2) { + // I comment this because it shows info even when not required + // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated + // must also not be output for most entities (proposal, intervention, ...) + //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; + print 'fk_prev_id != null ) print ' readonly'; + print '>'; + } else { ?> +   + + '; + print $form->selectUnits($line->fk_unit, "units"); + print ' + info_bits & 2) != 2) { + print 'fk_prev_id != null ) print ' readonly'; + print '>%'; + } else { ?> +   + + + ">
+ "> +
trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> + global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); + print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0); + print ' '.$langs->trans('to').' '; + print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateline", 1, 0); + print '' + ?> +
+ info_bits & 2) == 2) { + ?> + + trans("ShowReduc"), 'reduc').' '; + if ($line->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); + elseif ($line->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); + elseif ($line->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); + //else $txt=$langs->trans("Discount"); + print $txt; + ?> + + description) + { + if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0)); + } + elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0)); + // Add date of deposit + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) + echo ' ('.dol_print_date($discount->datec).')'; + } + elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0)); + } + elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); + } + else + { + echo ($txt?' - ':'').dol_htmlentitiesbr($line->description); + } + } + } + else + { + $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day'; + + if ($line->fk_product > 0) + { + echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); + } + else + { + if ($type==1) $text = img_object($langs->trans('Service'), 'service'); + else $text = img_object($langs->trans('Product'), 'product'); + + if (! empty($line->label)) { + $text.= ' '.$line->label.''; + echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); + } else { + if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow'); + echo $text.' '.dol_htmlentitiesbr($line->description); + } + } + + // Show date range + if ($line->element == 'facturedetrec') { + if ($line->date_start_fill || $line->date_end_fill) echo '
'; + if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); + if ($line->date_start_fill && $line->date_end_fill) echo ' - '; + if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); + if ($line->date_start_fill || $line->date_end_fill) echo '
'; + } + else { + if ($line->date_start || $line->date_end) echo '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + //echo get_date_range($line->date_start, $line->date_end, $format); + } + + // Add description in form + if ($line->fk_product > 0 && ! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + print (! empty($line->description) && $line->description!=$line->product_label)?'
'.dol_htmlentitiesbr($line->description):''; + } + } + + if (! empty($conf->accounting->enabled) && $line->fk_accounting_account > 0) + { + $accountingaccount=new AccountingAccount($this->db); + $accountingaccount->fetch($line->fk_accounting_account); + echo '

' . $langs->trans('AccountingAffectation') . ' : ' . $accountingaccount->getNomUrl(0, 1, 1); + } + + ?> +
ref_fourn?$line->ref_fourn:$line->ref_supplier); + ?>tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); + if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); + if (price2num($line->total_localtax2)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); + if (empty($positiverates)) $positiverates='0'; + echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits); + //echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); + ?>subprice); ?>multicurrency_subprice); ?>pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?> + info_bits & 2) != 2) && $line->special_code != 3) { + // I comment this because it shows info even when not required + // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated + // must also not be output for most entities (proposal, intervention, ...) + //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; + echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price + } else echo ' '; + ?> + '; + $label = $line->getLabelOfUnit('short'); + if ($label !== '') { + print $langs->trans($label); + } + print 'remise_percent, $langs); + ?> trans('Option'); ?>global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + print 'country_code).'='.price($line->total_ht); + print '
'.$langs->transcountry("TotalVAT", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_tva); + if (price2num($line->total_localtax1)) print '
'.$langs->transcountry("TotalLT1", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax1); + if (price2num($line->total_localtax2)) print '
'.$langs->transcountry("TotalLT2", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax2); + print '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc); + print '">'; + } + print price($line->total_ht); + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + print '
'; + } + ?> +
multicurrency_total_ht); ?>total_ttc); ?> + info_bits & 2) == 2 || ! empty($disableedit)) { ?> + + id.'#line_'.$line->id; ?>"> + + + + + fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation + print 'id . '">'; + print img_delete(); + print ''; + } + ?> + + 0) { ?> + id; ?>"> + + + + + id; ?>"> + + + + browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>>
getNomUrl(1); ?> ref_client; ?>date, 'day'); ?>date, 'day'); ?> rights->propale->lire) { $total = $total + $objectlink->total_ht; @@ -80,8 +80,8 @@ if (count($linkedObjectBlock) > 1)
trans("Total"); ?> '; - $form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || ! empty($ref)?' disabled="disabled"':'')); + print ''; + $form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''), 0, 'maxwidth100'); print ''; + print ''; print $bankaccount->getNomUrl(1); print "
'; // Date payment - print ''; @@ -314,17 +325,48 @@ if ($action == 'create') print ''."\n"; } + // Project + if (! empty($conf->projet->enabled)) + { + $formproject=new FormProjets($db); + + // Associated project + $langs->load("projects"); + + print ''; + } + + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print ''; + + // Category + if (is_array($options) && count($options) && $conf->categorie->enabled) + { + print ''; + } + // Accountancy account if (! empty($conf->accounting->enabled)) { - print ''; + // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code + print ''; print ''; } else // For external software { - print ''; + print ''; print ''; } @@ -351,26 +393,6 @@ if ($action == 'create') print ''; } - // Project - if (! empty($conf->projet->enabled)) - { - $formproject=new FormProjets($db); - - // Associated project - $langs->load("projects"); - - print ''; - } - - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print '
'; + print '
'; print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).''; print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1); print '
'.$langs->trans("Project").''; + + $numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); + + print '
'.$langs->trans("RubriquesTransactions").''; + print Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1); + print '
'.$langs->trans("AccountAccounting").'
'.$langs->trans("AccountAccounting").''; print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, ''); print '
'.$langs->trans("AccountAccounting").'
'.$langs->trans("AccountAccounting").''; print '
'.$langs->trans("Project").''; - - $numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); - - print '
'; dol_fiche_end(); @@ -395,7 +417,7 @@ if ($id) { $head=various_payment_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, 'payment'); + dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto); $morehtmlref='
'; // Project @@ -479,7 +501,7 @@ if ($id) print ''; print $object->subledger_account; print ''; - + if (! empty($conf->banque->enabled)) { if ($object->fk_account > 0) @@ -502,7 +524,6 @@ if ($id) print ''; - print '
'; print '
'; print '
'; @@ -514,7 +535,12 @@ if ($id) * Action buttons */ print '
'."\n"; - if ($object->rappro == 0) + + // TODO + // Add button modify + + // Delete + if (empty($object->rappro)) { if (! empty($user->rights->banque->modifier)) { @@ -529,6 +555,7 @@ if ($id) { print ''.$langs->trans("Delete").''; } + print "
"; } diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 02c3b331544..3d37b7e7de6 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -82,7 +82,7 @@ if ($object->id) { $head=various_payment_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, 'payment'); + dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, $object->picto); $morehtmlref='
'; // Project diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index 9afae281f78..33fd53b602b 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -50,7 +50,7 @@ $object->info($id); $head = various_payment_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, 'payment'); +dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $object->picto); $morehtmlref='
'; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 537bd6aee66..c9aba472dd8 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -57,7 +57,7 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield="v.datep"; +if (! $sortfield) $sortfield="v.datep,v.rowid"; if (! $sortorder) $sortorder="DESC"; $filtre=GETPOST("filtre", 'alpha'); @@ -110,13 +110,13 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria -if ($search_ref) $sql.=" AND v.rowid=".$search_ref; +if ($search_ref) $sql.=" AND v.rowid=".$db->escape($search_ref); if ($search_label) $sql.=natural_search(array('v.label'), $search_label); if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); -if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account; -if ($search_date) $sql.=" AND v.datep=".$search_date; -if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$search_accountancy_code; +if ($search_account > 0) $sql.=" AND b.fk_account=".$db->escape($search_account); +if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'"; +if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code); if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; if ($filtre) { $filtre=str_replace(":", "=", $filtre); @@ -234,7 +234,7 @@ if ($result) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left '); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 816d1486970..d18a8c38cfe 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -458,7 +458,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ae9641a1600..a7ce35974fb 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -939,7 +939,7 @@ if (empty($reshook)) if (empty($dateinvoice)) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); @@ -1566,7 +1566,7 @@ if (empty($reshook)) $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) { $error++; - $mesg = $langs->trans("ErrorFieldRequired", $langs->trans("Date")); + $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); setEventMessages($mesg, null, 'errors'); } @@ -1574,7 +1574,7 @@ if (empty($reshook)) if (!($_POST['situations'] > 0)) { $error++; - $mesg = $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")); + $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation")); setEventMessages($mesg, null, 'errors'); } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6e85f10e658..686190c359b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2284,7 +2284,7 @@ class Facture extends CommonInvoice // Controle que facture source connue if ($this->fk_facture_source <= 0) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("InvoiceReplacement")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceReplacement")); $this->db->rollback(); return -10; } @@ -3133,7 +3133,13 @@ class Facture extends CommonInvoice // phpcs:enable global $mysoc,$user; - include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; + // Progress should never be changed for discount lines + if (($line->info_bits & 2) == 2) + { + return; + } + + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Cap percentages to 100 if ($percent > 100) $percent = 100; @@ -3149,7 +3155,6 @@ class Facture extends CommonInvoice $line->multicurrency_total_ttc = $tabprice[18]; $line->update($user); $this->update_price(1); - $this->db->commit(); } /** @@ -4597,6 +4602,7 @@ class FactureLigne extends CommonInvoiceLine if ($result <= 0) { $this->error='ErrorProductIdDoesNotExists'; + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index d184fb58966..97f0b876abc 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -47,10 +47,31 @@ foreach($linkedObjectBlock as $key => $objectlink) if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - trans("CustomerInvoice"); ?> + type) { + case Facture::TYPE_REPLACEMENT: + echo $langs->trans("InvoiceReplacement"); + break; + case Facture::TYPE_CREDIT_NOTE: + echo $langs->trans("InvoiceAvoir"); + break; + case Facture::TYPE_DEPOSIT: + echo $langs->trans("InvoiceDeposit"); + break; + case Facture::TYPE_PROFORMA: + echo $langs->trans("InvoiceProForma"); + break; + case Facture::TYPE_SITUATION: + echo $langs->trans("InvoiceSituation"); + break; + default: + echo $langs->trans("CustomerInvoice"); + break; + } + ?> getNomUrl(1); ?> - ref_client; ?> - date, 'day'); ?> + ref_client; ?> + date, 'day'); ?> rights->facture->lire) { $sign = 1; @@ -76,8 +97,8 @@ if (count($linkedObjectBlock) > 1) trans("Total"); ?> - - + + diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index 33728093ec1..8b11716bf6f 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -59,7 +59,7 @@ if ($action == 'confirm_rejet') if (empty($daterej)) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } elseif ($daterej > dol_now()) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 12acff2ee4d..3ac50a65e9a 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -602,6 +602,8 @@ if ($id > 0) $num = $db->num_rows($resql); $i = 0; $total = 0; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; print ''; @@ -668,6 +670,8 @@ if ($id > 0) print '\n"; print "
'.$langs->trans("RefPayment").''.price($resteapayer)."
"; + print '
'; + $db->free($resql); } else diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 886a6171818..4d26fef7965 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -146,11 +146,20 @@ $dolibarr_main_db_character_set='utf8'; // Database character set used to sort data (forced during database creation. value of database is then used). // Default value: depends on database driver // Examples: -// dolibarr_main_db_collation='utf8_unicode_ci'; +// $dolibarr_main_db_collation='utf8_unicode_ci'; // $dolibarr_main_db_collation='utf8_unicode_ci'; +// dolibarr_main_instance_unique_id +// An ID that is unique for each installation. +// Default value: randomly defined during installation +// Examples: +// $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62'; +// +$dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62'; + + //################## // Login @@ -159,18 +168,18 @@ $dolibarr_main_db_collation='utf8_unicode_ci'; // dolibarr_main_authentication // This parameter contains the way authentication is done. // If value "ldap" is used, you must also set parameters dolibarr_main_auth_ldap_* -// Default value: dolibarr +// Default value: 'dolibarr' // Possible values: Any values found in files in htdocs/core/login directory after // the "function_" string and before the ".php" string. You can also separate several // values using a ",". In this case, Dolibarr will check login/pass for each value in // order defined into value. However, note that this can't work with all values. // Examples: -// $dolibarr_main_authentication='http'; -// $dolibarr_main_authentication='dolibarr'; -// $dolibarr_main_authentication='ldap'; -// $dolibarr_main_authentication='openid,dolibarr'; -// $dolibarr_main_authentication='forceuser'; // Add also $dolibarr_auto_user='loginforuser'; - +// $dolibarr_main_authentication='dolibarr'; // Use the password defined into application on user record. +// $dolibarr_main_authentication='http'; // Use the HTTP Basic authentication +// $dolibarr_main_authentication='ldap'; // Check the password into a LDAP server +// $dolibarr_main_authentication='ldap,dolibarr'; // You can set several mode using a comma as a separator. +// $dolibarr_main_authentication='forceuser'; // This need to add also $dolibarr_auto_user='loginforuser'; +// $dolibarr_main_authentication='twofactor'; // To use Google Authenticator. This need the non official external module "Two Factor" available on www.dolistore.com // $dolibarr_main_authentication='dolibarr'; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index e310d3e0b6d..97dd835bda0 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -376,21 +376,24 @@ if (empty($reshook)) $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) $error++; - $result = $object->update($contactid, $user); - - if ($result > 0) { - // Categories association - $categories = GETPOST('contcats', 'array'); - $object->setCategories($categories); - - $object->old_lastname=''; - $object->old_firstname=''; - $action = 'view'; - } - else + if (! $error) { - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'edit'; + $result = $object->update($contactid, $user); + + if ($result > 0) { + // Categories association + $categories = GETPOST('contcats', 'array'); + $object->setCategories($categories); + + $object->old_lastname=''; + $object->old_firstname=''; + $action = 'view'; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'edit'; + } } } @@ -505,7 +508,7 @@ else $linkback=''; print load_fiche_titre($title, $linkback, 'title_companies.png'); - // Affiche les erreurs + // Show errors dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); if ($conf->use_javascript_ajax) @@ -800,8 +803,8 @@ else $objsoc = new Societe($db); $objsoc->fetch($object->socid); - // Affiche les erreurs - dol_htmloutput_errors($error, $errors); + // Show errors + dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); if ($conf->use_javascript_ajax) { @@ -1122,11 +1125,10 @@ else { $objsoc = new Societe($db); - /* - * Fiche en mode visualisation - */ + // View mode - dol_htmloutput_errors($error, $errors); + // Show errors + dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); dol_fiche_head($head, 'card', $title, -1, 'contact'); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 687dc2c7f2f..5c9ac3375dd 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2139,22 +2139,22 @@ else { if ($user->rights->contrat->activer) { - print ''; + print ''; } else { - print ''; + print ''; } } if ($object->nbofservicesclosed < $nbofservices) { if ($user->rights->contrat->desactiver) { - print ''; + print ''; } else { - print ''; + print ''; } //if (! $numactive) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 316983a5d0a..d21b383bf97 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -878,14 +878,14 @@ class Contrat extends CommonObject if ($this->commercial_signature_id <= 0) { $langs->load("commercial"); - $this->error.=$langs->trans("ErrorFieldRequired", $langs->trans("SalesRepresentativeSignature")); + $this->error.=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeSignature")); $paramsok=0; } if ($this->commercial_suivi_id <= 0) { $langs->load("commercial"); $this->error.=($this->error?"
":''); - $this->error.=$langs->trans("ErrorFieldRequired", $langs->trans("SalesRepresentativeFollowUp")); + $this->error.=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeFollowUp")); $paramsok=0; } if (! $paramsok) return -1; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index a58a768eace..bf9b617693f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -506,7 +506,7 @@ class CMailFile } $sendingmode = $this->sendmode; - if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') + if ($this->context == 'emailing' && ! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // List of sending methods $listofmethods=array(); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ab29a100894..a064e611c2f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3860,9 +3860,10 @@ abstract class CommonObject * @param int $dateSelector 1=Show also date range input fields * @param Societe $seller Object thirdparty who sell * @param Societe $buyer Object thirdparty who buy + * @param string $defaulttpldir Directory where to find the template * @return void */ - public function formAddObjectLine($dateSelector, $seller, $buyer) + public function formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir = '/core/tpl') { global $conf,$user,$langs,$object,$hookmanager; global $form,$bcnd,$var; @@ -3874,10 +3875,17 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer - $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_create.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { @@ -4130,9 +4138,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { @@ -4153,9 +4168,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_edit.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { @@ -4355,9 +4377,16 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach($dirtpls as $reldir) + foreach($dirtpls as $module => $reldir) { - $tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); + if (!empty($module)) + { + $tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); + } + else + { + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/originproductline.tpl.php'; + } if (empty($conf->file->strict_mode)) { $res=@include $tpl; } else { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 22e9dbf663c..8e0cf0946dc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1970,7 +1970,7 @@ class ExtraFields public function setOptionalsFromPost($extralabels, &$object, $onlykey = '') { global $_POST, $langs; - $nofillrequired='';// For error when required field left blank + $nofillrequired=0;// For error when required field left blank $error_field_required = array(); if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; @@ -2001,7 +2001,8 @@ class ExtraFields if ($this->attributes[$object->table_element]['required'][$key]) // Value is required { // Check if empty without using GETPOST, value can be alpha, int, array, etc... - if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0') + if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') + || (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) { //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0c22b463975..63246fb0287 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1914,6 +1914,16 @@ class Form $selected_input_value=$producttmpselect->ref; unset($producttmpselect); } + // handle case where product or service module is disabled + no filter specified + if ($filtertype == '') + { + if (empty($conf->product->enabled)) { // when product module is disabled, show services only + $filtertype = 1; + } + elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only + $filtertype = 0; + } + } // mode=1 means customers products $urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; //Price by customer @@ -2165,7 +2175,14 @@ class Form { $sql.= " AND p.tosell = ".$status; } - if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype; + // Filter by product type + if (strval($filtertype) != '') $sql.= " AND p.fk_product_type = ".$filtertype; + elseif (empty($conf->product->enabled)) { // when product module is disabled, show services only + $sql.= " AND p.fk_product_type = 1"; + } + elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only + $sql.= " AND p.fk_product_type = 0"; + } // Add criteria on ref/label if ($filterkey != '') { @@ -3649,9 +3666,10 @@ class Form * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @param string $moreattrib To add more attribute on select * @param int $showcurrency Show currency in label + * @param string $morecss More CSS * @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...) */ - public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0) + public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '') { // phpcs:enable global $langs, $conf; @@ -3674,7 +3692,7 @@ class Form $i = 0; if ($num) { - print ''; if ($useempty == 1 || ($useempty == 2 && $num > 1)) { print ''; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 9b8801aa4cc..135fd2969d3 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -688,7 +688,9 @@ class FormFile $out.= ''; $addcolumforpicto=($delallowed || $printer || $morepicto); - $out.= ''; + $colspan = (3+($addcolumforpicto?1:0)); $colspanmore = 0; + + $out.= ''; // Model if (! empty($modellist)) @@ -745,13 +747,17 @@ class FormFile { foreach($hookmanager->hooks['formfile'] as $module) { - if (method_exists($module, 'formBuilddocLineOptions')) $out .= ''; + if (method_exists($module, 'formBuilddocLineOptions')) + { + $colspanmore++; + $out .= ''; + } } } $out.= ''; // Execute hooks - $parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart); + $parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'modulepart'=>$modulepart); if (is_object($hookmanager)) { $reshook = $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']); @@ -801,9 +807,10 @@ class FormFile // Show file name with link to download $out.= ''; $out.= 'trans("File").': '.$file["name"]); $out.= dol_trunc($file["name"], 150); $out.= ''."\n"; @@ -847,14 +854,17 @@ class FormFile if (is_object($hookmanager)) { - $parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath); + $parameters=array('colspan'=>($colspan+$colspanmore), 'socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart,'relativepath'=>$relativepath); $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file); if (empty($res)) { $out.= $hookmanager->resPrint; // Complete line $out.= ''; } - else $out = $hookmanager->resPrint; // Replace line + else + { + $out = $hookmanager->resPrint; // Replace all $out + } } } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 40c5ef8c048..fe00f803a6b 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -196,6 +196,7 @@ class Translate $modulename = ''; // Search if a module directory name is provided into lang file name + $regs=array(); if (preg_match('/^([^@]+)@([^@]+)$/i', $domain, $regs)) { $newdomain = $regs[1]; @@ -223,7 +224,7 @@ class Translate return -1; } - foreach($this->dir as $keydir => $searchdir) + foreach($this->dir as $searchdir) { // Directory of translation files $file_lang = $searchdir.($modulename?'/'.$modulename:'')."/langs/".$langofdir."/".$newdomain.".lang"; diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 575cf2256ef..b05f118b08b 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -284,7 +284,7 @@ abstract class DoliDB implements Database if ($string==0 || $string=="0000-00-00 00:00:00") return ''; $string=preg_replace('/([^0-9])/i', '', $string); $tmp=$string.'000000'; - $date=dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), $gm); + $date=dol_mktime((int) substr($tmp, 8, 2), (int) substr($tmp, 10, 2), (int) substr($tmp, 12, 2), (int) substr($tmp, 4, 2), (int) substr($tmp, 6, 2), (int) substr($tmp, 0, 4), $gm); return $date; } diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index db86d5e8b58..cf8557de961 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -841,10 +841,11 @@ function copyToClipboard(text,text2) * @return boolean False * @see document_preview */ -function newpopup(url,title) { +function newpopup(url, title) { var argv = newpopup.arguments; var argc = newpopup.arguments.length; tmp=url; + console.log("newpopup "+argv[2]+" "+argv[3]); var l = (argc > 2) ? argv[2] : 600; var h = (argc > 3) ? argv[3] : 400; var left = (screen.width - l)/2; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bcd1b555906..19b39fd776d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -649,7 +649,7 @@ function dol_include_once($relpath, $classname = '') * @param int $returnemptyifnotfound 0:If $type==0 and if file was not found into alternate dir, return default path into main dir (no test on it) * 1:If $type==0 and if file was not found into alternate dir, return empty string * 2:If $type==0 and if file was not found into alternate dir, test into main dir, return default path if found, empty string if not found - * @return string Full filesystem path (if path=0), Full url path (if mode=1) + * @return string Full filesystem path (if path=0) or '' if file not found, Full url path (if mode=1) */ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) { @@ -1982,7 +1982,7 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $ //var_dump($localtz); //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute); $dt = new DateTime(null, $localtz); - $dt->setDate($year, $month, $day); + $dt->setDate((int) $year, (int) $month, (int) $day); $dt->setTime((int) $hour, (int) $minute, (int) $second); $date=$dt->getTimestamp(); // should include daylight saving time //var_dump($date); @@ -3441,16 +3441,17 @@ function img_info($titlealt = 'default') * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"'). If 1, add float: right. Can't be "class" attribute. + * @param string $morecss Add more CSS * @return string Return img tag */ -function img_warning($titlealt = 'default', $moreatt = '') +function img_warning($titlealt = 'default', $moreatt = '', $morecss = 'pictowarning') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); //return '
'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'
'; - return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')); + return img_picto($titlealt, 'warning.png', 'class="valignmiddle'.($morecss?' '.$morecss:'').'"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')); } /** @@ -3626,7 +3627,7 @@ function img_mime($file, $titlealt = '', $morecss = '') if (empty($titlealt)) $titlealt = 'Mime type: '.$mimetype; //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"'); - return ''; + return ''; } @@ -8274,7 +8275,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u */ function isAFileWithExecutableContent($filename) { - if (preg_match('/\.(htm|html|js|php|phtml|pl|py|cgi|ksh|sh|bash)$/i', $filename)) + if (preg_match('/\.(htm|html|js|php|phtml|pl|py|cgi|ksh|sh|bash|bat|cmd|wpk|exe|dmg)$/i', $filename)) { return true; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index fac25451ece..a315747b8f6 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -568,7 +568,7 @@ function isValidUrl($url, $http = 0, $pass = 0, $port = 0, $path = 0, $query = 0 * Check if VAT numero is valid (check done on syntax only, no database or remote access) * * @param Societe $company VAT number - * @return int 1=Check is OK, 0=Check is KO + * @return int 1=Check is OK, 0=Check is KO */ function isValidVATID($company) { @@ -577,7 +577,7 @@ function isValidVATID($company) $vatprefix = $company->country_code; if ($vatprefix == 'GR') $vatprefix = '(EL|GR)'; else $vatprefix = preg_quote($vatprefix, '/'); - if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/', $company->tva_intra)) + if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,14}$/i', str_replace(' ', '', $company->tva_intra))) { return 0; } diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index c161eb056fe..714bc26b7da 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -172,14 +172,18 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = * For example: https://www.abc.mydomain.com/dir/page.html return 'mydomain' * * @param string $url Full URL. + * @param int $mode 0=return 'mydomain', 1=return 'mydomain.com' * @return string Returns domaine name */ -function getDomainFromURL($url) +function getDomainFromURL($url, $mode = 0) { $tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s):// $tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain - $tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...) - $tmpdomain = preg_replace('/^[^\.]+\./', '', $tmpdomain); // Remove part www. before domain name + $tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)$/', '\1.\2', $tmpdomain); // Remove part www.abc before domain name + if (empty($mode)) + { + $tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...) + } return $tmpdomain; } diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 3eafc454530..ffb1fd83cce 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -76,7 +76,7 @@ class ExportExcel extends ModeleExports $this->db = $db; $this->id='excel'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 95'; // Label of driver + $this->label='Excel 95 (old library)'; // Label of driver $this->desc = $langs->trans('Excel95FormatDesc'); $this->extension='xls'; // Extension for generated file by this driver $this->picto='mime/xls'; // Picto diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index e33849427b1..7460d71ff13 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -76,7 +76,7 @@ class ExportExcel2007 extends ExportExcel $this->db = $db; $this->id='excel2007'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 2007'; // Label of driver + $this->label='Excel 2007 (old library)'; // Label of driver $this->desc = $langs->trans('Excel2007FormatDesc'); $this->extension='xlsx'; // Extension for generated file by this driver $this->picto='mime/xls'; // Picto diff --git a/htdocs/core/modules/export/export_excel2007new.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php index 32b6029a294..266cedc1310 100644 --- a/htdocs/core/modules/export/export_excel2007new.modules.php +++ b/htdocs/core/modules/export/export_excel2007new.modules.php @@ -78,7 +78,7 @@ class ExportExcel2007new extends ModeleExports $this->db = $db; $this->id='excel2007new'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 2007 by PHPSpreadSheet'; // Label of driver + $this->label='Excel 2007'; // Label of driver $this->desc = $langs->trans('Excel2007FormatDesc'); $this->extension='xlsx'; // Extension for generated file by this driver $this->picto='mime/xls'; // Picto diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index dd6300f4296..5be8ca2646a 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1238,23 +1238,6 @@ class pdf_crabe extends ModelePDFFactures //} // VAT - // Situations totals migth be wrong on huge amounts - if ($object->situation_cycle_ref && $object->situation_counter > 1) { - - $sum_pdf_tva = 0; - foreach($this->tva as $tvakey => $tvaval){ - $sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object - } - - if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one) - $coef_fix_tva = $object->total_tva / $sum_pdf_tva; - - foreach($this->tva as $tvakey => $tvaval) { - $this->tva[$tvakey]=$tvaval * $coef_fix_tva; - } - } - } - foreach($this->tva as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 6eba74b17e4..f75e5035670 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -137,7 +137,7 @@ class ImportCsv extends ModeleImports * * @param Translate $outputlangs Output language * @param array $headerlinefields Array of fields name - * @return string + * @return string$limittoachartaccount */ public function write_title_example($outputlangs, $headerlinefields) { @@ -443,11 +443,29 @@ class ImportCsv extends ModeleImports } $classinstance=new $class($this->db); // Try the fetch from code or ref - call_user_func_array(array($classinstance, $method), array('', $newval)); + $param_array = array('', $newval); + if ($class == 'AccountingAccount') + { + //var_dump($arrayrecord[0]['val']); + /*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php'; + $tmpchartofaccount = new AccountancySystem($this->db); + $tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS); + var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']); + if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val']) + { + $this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref); + $this->errors[$error]['type']='RESTRICTONCURRENCTCHART'; + $errorforthistable++; + $error++; + }*/ + $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. + } + call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { - call_user_func_array(array($classinstance, $method), array('', '', $newval)); + $param_array = array('', '', $newval); + call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id; //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; @@ -459,7 +477,7 @@ class ImportCsv extends ModeleImports { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); - else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; + else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile'; $this->errors[$error]['type']='FOREIGNKEY'; $errorforthistable++; $error++; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index e83e22bd8ca..ae0290401cc 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -470,11 +470,29 @@ class ImportXlsx extends ModeleImports } $classinstance=new $class($this->db); // Try the fetch from code or ref - call_user_func_array(array($classinstance, $method), array('', $newval)); + $param_array = array('', $newval); + if ($class == 'AccountingAccount') + { + //var_dump($arrayrecord[0]['val']); + /*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php'; + $tmpchartofaccount = new AccountancySystem($this->db); + $tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS); + var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']); + if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val']) + { + $this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref); + $this->errors[$error]['type']='RESTRICTONCURRENCTCHART'; + $errorforthistable++; + $error++; + }*/ + $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. + } + call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { - call_user_func_array(array($classinstance, $method), array('', '', $newval)); + $param_array = array('', '', $newval); + call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id; //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; @@ -486,7 +504,7 @@ class ImportXlsx extends ModeleImports { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); - else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; + else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile'; $this->errors[$error]['type']='FOREIGNKEY'; $errorforthistable++; $error++; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 66b2a511bf7..b7ef8950fe1 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -301,11 +301,12 @@ class modAccounting extends DolibarrModules $this->import_tables_array[$r]=array('aa'=>MAIN_DB_PREFIX.'accounting_account'); $this->import_tables_creator_array[$r]=array('aa'=>'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r]=array('aa.fk_pcg_version'=>"Chartofaccounts*",'aa.account_number'=>"AccountAccounting*",'aa.label'=>"Label*",'aa.account_parent'=>"Accountparent","aa.fk_accounting_category"=>"AccountingCategory","aa.pcg_type"=>"Pcgtype*",'aa.pcg_subtype'=>'Pcgsubtype*','aa.active'=>'Status*','aa.datec'=>"DateCreation"); - $this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^\d{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^\d{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$'); + $this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^.{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^.{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$'); $this->import_convertvalue_array[$r]=array( - 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'), - 'aa.account_parent'=>array('rule'=>'zeroifnull'), + 'aa.account_parent'=>array('rule'=>'fetchidfromref','classfile'=>'/accountancy/class/accountingaccount.class.php','class'=>'AccountingAccount','method'=>'fetch','element'=>'AccountingAccount'), + 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'), ); - $this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28"); + $this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"ref:7 or id:1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28"); + $this->import_updatekeys_array[$r]=array('aa.fk_pcg_version'=>'Chartofaccounts','aa.account_number'=>'AccountAccounting'); } } diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php deleted file mode 100644 index f3d34c4a9cd..00000000000 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ /dev/null @@ -1,174 +0,0 @@ -isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', 'ChromePhp.class.php'); - } - - /** - * Is the module active ? - * - * @return int -1 if not active, 0 if active but lib/path not found, 1 if OK - */ - public function isActive() - { - global $conf; - try - { - if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) { - $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/'; - } - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - - $res = @include_once 'ChromePhp.php'; - if (! $res) $res=@include_once 'ChromePhp.class.php'; - - restore_include_path(); - - if ($res) - { - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler - } - else - { - return 0; - } - } - catch(Exception $e) - { - print ''."\n"; - } - - return -1; - } - - /** - * Return array of configuration data - * - * @return array Return array of configuration data - */ - public function configure() - { - global $langs; - - return array( - array( - 'name' => $langs->trans('IncludePath', 'SYSLOG_CHROMEPHP_INCLUDEPATH'), - 'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH', - 'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/', - 'attr' => 'size="60"', - 'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/' - ) - ); - } - - /** - * Return if configuration is valid - * - * @return array Array of errors. Empty array if ok. - */ - public function checkConfiguration() - { - global $langs,$conf; - - $errors = array(); - - if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) - { - $conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop - if (is_object($langs)) // $langs may not be defined yet. - { - $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); - } - else - { - $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; - } - } - - return $errors; - } - - /** - * Output log content. We also start output buffering at first log write. - * - * @param array $content Content to log - * @return null|false - */ - public function export($content) - { - global $conf; - - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler - - //We check the configuration to avoid showing PHP warnings - if (count($this->checkConfiguration()) > 0) return false; - - try - { - // Warning ChromePHP must be into PHP include path. It is not possible to use into require_once a constant from - // database or config file because we must be able to log data before database or config file read. - $oldinclude=get_include_path(); - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - $res = @include_once 'ChromePhp.php'; - if (! $res) $res=@include_once 'ChromePhp.class.php'; - set_include_path($oldinclude); - - ob_start(); // To be sure headers are not flushed until all page is completely processed - if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); - elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); - elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']); - else ChromePhp::log($content['message']); - } - catch (Exception $e) - { - // Do not use dol_syslog here to avoid infinite loop - } - } -} diff --git a/htdocs/core/modules/syslog/mod_syslog_firephp.php b/htdocs/core/modules/syslog/mod_syslog_firephp.php deleted file mode 100644 index abc341f9a30..00000000000 --- a/htdocs/core/modules/syslog/mod_syslog_firephp.php +++ /dev/null @@ -1,175 +0,0 @@ - - * Copyright (C) 2015 Raphaël Doursenaud - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; - -/** - * Class to manage logging to a FirePHP - */ -class mod_syslog_firephp extends LogHandler implements LogHandlerInterface -{ - public $code = 'firephp'; - private static $firephp_include_path = '/includes/firephp/firephp-core/lib/'; - private static $firephp_class_path = 'FirePHPCore/FirePHP.class.php'; - - /** - * Return name of logger - * - * @return string Name of logger - */ - public function getName() - { - return 'FirePHP'; - } - - /** - * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') - * - * @return string - */ - public function getVersion() - { - return 'dolibarr'; - } - - /** - * Content of the info tooltip. - * - * @return false|string - */ - public function getInfo() - { - global $langs; - - return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path); - } - - /** - * Is the module active ? - * - * @return int - */ - public function isActive() - { - global $conf; - try - { - if (empty($conf->global->SYSLOG_FIREPHP_INCLUDEPATH)) { - $conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . self::$firephp_include_path; - } - set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); - $res = @include_once self::$firephp_class_path; - restore_include_path(); - if ($res) { - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler - } else { - return 0; - } - } - catch(Exception $e) - { - print ''."\n"; - } - - return -1; - } - - /** - * Return array of configuration data - * - * @return array Return array of configuration data - */ - public function configure() - { - global $langs; - - return array( - array( - 'name' => $langs->trans('IncludePath', 'SYSLOG_FIREPHP_INCLUDEPATH'), - 'constant' => 'SYSLOG_FIREPHP_INCLUDEPATH', - 'default' => DOL_DOCUMENT_ROOT . self::$firephp_include_path, - 'attr' => 'size="60"', - 'example' => '/usr/share/php, ' . DOL_DOCUMENT_ROOT . self::$firephp_include_path - ) - ); - } - - /** - * Return if configuration is valid - * - * @return array Array of errors. Empty array if ok. - */ - public function checkConfiguration() - { - global $conf, $langs; - - $errors = array(); - - if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path)) - { - $conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop - if (is_object($langs)) // $langs may not be defined yet. - { - $errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path); - } - else - { - $errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path; - } - } - - return $errors; - } - - /** - * Output log content - * - * @param array $content Content to log - * @return null|false - */ - public function export($content) - { - global $conf; - - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return; // Global option to disable output of this handler - - //We check the configuration to avoid showing PHP warnings - if (count($this->checkConfiguration())) return false; - - try - { - // Warning FirePHPCore must be into PHP include path. It is not possible to use into require_once a constant from - // database or config file because we must be able to log data before database or config file read. - $oldinclude=get_include_path(); - set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); - include_once self::$firephp_class_path; - set_include_path($oldinclude); - ob_start(); // To be sure headers are not flushed until all page is completely processed - $firephp = FirePHP::getInstance(true); - if ($content['level'] == LOG_ERR) $firephp->error($content['message']); - elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']); - elseif ($content['level'] == LOG_INFO) $firephp->log($content['message']); - else $firephp->log($content['message']); - } - catch (Exception $e) - { - // Do not use dol_syslog here to avoid infinite loop - return false; - } - } -} diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 6c473b83691..2ecb127f3b2 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -488,7 +488,7 @@ jQuery(document).ready(function() { console.log("We click on submitcrop"); var idClicked = e.target.id; if (parseInt(jQuery(\'#w\').val())) return true; - alert(\''.dol_escape_js($langs->trans("ErrorFieldRequired", $langs->trans("Dimension"))).'\'); + alert(\''.dol_escape_js($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Dimension"))).'\'); return false; }); }); diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index f6d59435e74..49b234c651c 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -90,10 +90,10 @@ foreach($object->fields as $key => $val) print ''; - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); + if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); else print $langs->trans($val['label']); print ''; print ''; diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 316e85a3ac6..3830e2bc31a 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -129,7 +129,7 @@ if ($permission) { selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
- select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 0, 'minwidth100imp'); ?> + select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp'); ?>
datestart)==0) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronDtStart')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronDtStart')); $error++; } if (empty($this->label)) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronLabel')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronLabel')); $error++; } if ((dol_strlen($this->datestart)!=0) && (dol_strlen($this->dateend)!=0) && ($this->dateend<$this->datestart)) { @@ -171,28 +171,27 @@ class Cronjob extends CommonObject $error++; } if (empty($this->unitfrequency)) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronFrequency')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronFrequency')); $error++; } if (($this->jobtype=='command') && (empty($this->command))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronCommand')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronCommand')); $error++; } if (($this->jobtype=='method') && (empty($this->classesname))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronClass')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronClass')); $error++; } if (($this->jobtype=='method' || $this->jobtype == 'function') && (empty($this->methodename))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronMethod')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronMethod')); $error++; } if (($this->jobtype=='method') && (empty($this->objectname))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronObject')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronObject')); $error++; } - if (($this->jobtype=='function') && (empty($this->libname))) { - $this->errors[]=$langs->trans('CronFieldMandatory', $langs->trans('CronLib')); + $this->errors[]=$langs->trans('CronFieldMandatory', $langs->transnoentitiesnoconv('CronLib')); $error++; } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 6bfa0c025af..7273640e77e 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -55,7 +55,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='t.status,t.priority'; if (! $sortorder) $sortorder='DESC,ASC'; -$search_status=GETPOST('search_status', 'int')?GETPOST('search_status', 'int'):GETPOST('status', 'int'); +$search_status=(GETPOSTISSET('search_status')?GETPOST('search_status', 'int'):GETPOST('status', 'int')); //Search criteria $search_label=GETPOST("search_label", 'alpha'); @@ -251,7 +251,7 @@ $sql.= " t.libname,"; $sql.= " t.test"; $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t"; $sql.= " WHERE entity IN (0,".$conf->entity.")"; -if ($search_status >= 0 && $search_status < 2) $sql.= " AND t.status = ".(empty($search_status)?'0':'1'); +if ($search_status >= 0 && $search_status < 2 && $search_status != '') $sql.= " AND t.status = ".(empty($search_status)?'0':'1'); //Manage filter if (is_array($filter) && count($filter)>0) { foreach($filter as $key => $value) { @@ -337,12 +337,9 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; -// Line with explanation and button new job -$newcardbutton=''; -$newcardbutton.= dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter, '', $user->rights->cron->create); +// Line with explanation and button new +$newcardbutton = dolGetButtonTitle($langs->trans('New'), $langs->trans('CronCreateJob'), 'fa fa-plus-circle', DOL_URL_ROOT.'/cron/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->cron->create); print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_setup', 0, $newcardbutton, '', $limit); diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 5662b3272f0..cd92d8d02f5 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -84,14 +84,14 @@ if ($action == 'update') if (empty($donation_date)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = "create"; $error++; } if (empty($amount)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); $action = "create"; $error++; } @@ -140,14 +140,14 @@ if ($action == 'add') if (empty($donation_date)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = "create"; $error++; } if (empty($amount)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); $action = "create"; $error++; } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index de360d8cc3b..d75e658a191 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -271,32 +271,32 @@ class Don extends CommonObject { if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Company').'/'.$langs->transnoentitiesnoconv('Firstname').'-'.$langs->transnoentitiesnoconv('Lastname')); $err++; } } if (dol_strlen(trim($this->address)) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Address')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Address')); $err++; } if (dol_strlen(trim($this->zip)) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Zip')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Zip')); $err++; } if (dol_strlen(trim($this->town)) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Town')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Town')); $err++; } if (dol_strlen(trim($this->email)) == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('EMail')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('EMail')); $err++; } @@ -308,7 +308,7 @@ class Don extends CommonObject { if (!isset($map[substr($this->amount, $i, 1)])) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Amount')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Amount')); $err++; $amount_invalid = 1; break; @@ -319,14 +319,14 @@ class Don extends CommonObject { if ($this->amount == 0) { - $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Amount')); + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Amount')); $err++; } else { if ($this->amount < $minimum && $minimum > 0) { - $error_string[] = $langs->trans('MinimumAmount', $langs->trans('$minimum')); + $error_string[] = $langs->trans('MinimumAmount', $langs->transnoentitiesnoconv('$minimum')); $err++; } } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index e6354c01105..0d008cea93d 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2076,17 +2076,13 @@ else if ($action != 'editline' || $line->rowid != GETPOST('rowid', 'int')) { print ''; - + // Num print ''; print $numline; print ''; - - /*print ''; - print img_picto($langs->trans("Document"), "object_generic"); - print ' '.$piece_comptable.''; - print '';*/ - + // Date print ''.dol_print_date($db->jdate($line->date), 'day').''; + // Project if (! empty($conf->projet->enabled)) { print ''; @@ -2094,21 +2090,26 @@ else { $projecttmp->id=$line->fk_project; $projecttmp->ref=$line->projet_ref; + $projecttmp->title=$line->projet_title; print $projecttmp->getNomUrl(1); } print ''; } + // IK if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { print ''; print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label'); print ''; } + // Type of fee print ''; $labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code)); print $labeltype; print ''; + // Comment print ''.dol_nl2br($line->comments).''; + // VAT rate print ''.vatrate($line->vatrate, true).''; // Unit price HT print ''; @@ -2716,9 +2717,6 @@ if ($action != 'create' && $action != 'edit') print '
'; -//$conf->global->DOL_URL_ROOT_DOCUMENT_PHP=dol_buildpath('/expensereport/documentwrapper.php',1); - - // Select mail models is same action as presend if (GETPOST('modelselected', 'alpha')) { $action = 'presend'; diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 9663806fdc2..b6dfc23cf48 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -1009,7 +1009,7 @@ if ($step == 4 && $datatoexport) print ''; print $value.' '; - print ''; + print ''; if ($value < count($array_selected)) print ''.img_down().''; if ($value > 1) print ''.img_up().''; print ''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 20d9d786354..31db9d0c2b4 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -427,7 +427,7 @@ if (empty($reshook)) } else { - $mesg='
'.$langs->trans("ErrorFieldRequired", $langs->trans("ThirdParty")).'
'; + $mesg='
'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")).'
'; $action = 'create'; } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e876d5caee2..bf0a3da62b3 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1540,7 +1540,7 @@ class CommandeFournisseur extends CommonOrder // Check parameters if ($qty < 1 && ! $fk_product) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("Product")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")); return -1; } if ($type < 0) return -1; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 8028dff3855..6c4cb05a17e 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -71,6 +71,11 @@ $error = 0; * Actions */ +if (GETPOST('cancel', 'alpha')) +{ + $action = ''; +} + // If create a request if ($action == 'create') { @@ -193,7 +198,35 @@ if ($action == 'create') } } -if ($action == 'update') +if ($action == 'update' && GETPOSTISSET('savevalidator') && ! empty($user->rights->holiday->approve)) +{ + $object = new Holiday($db); + $object->fetch($id); + + $object->oldcopy = dol_clone($object); + + $object->fk_validator = GETPOST('valideur', 'int'); + + if ($object->fk_validator != $object->oldcopy->fk_validator) + { + $verif = $object->update($user); + + if ($verif <= 0) + { + setEventMessages($object->error, $object->errors, 'warnings'); + $action='editvalidator'; + } + else + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + } + + $action = ''; +} + +if ($action == 'update' && ! GETPOSTISSET('savevalidator')) { $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); @@ -1087,9 +1120,10 @@ else { $head=holiday_prepare_head($object); - if ($action == 'edit' && $object->statut == 1) + if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { - $edit = true; + if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) $edit = true; + print '
'."\n"; print ''."\n"; print ''."\n"; @@ -1129,7 +1163,7 @@ else $starthalfday=($object->halfday == -1 || $object->halfday == 2)?'afternoon':'morning'; $endhalfday=($object->halfday == 1 || $object->halfday == 2)?'morning':'afternoon'; - if(!$edit) + if (!$edit) { print ''; print ''.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; @@ -1178,7 +1212,7 @@ else print ''.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).''; print ''; - if ($object->statut == 5) + if ($object->statut == Holiday::STATUS_REFUSED) { print ''; print ''.$langs->trans('DetailRefusCP').''; @@ -1228,25 +1262,40 @@ else } // Validator - if (!$edit) { + if (!$edit && $action != 'editvalidator') { print ''; print ''; - if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy'); + if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) print $langs->trans('ApprovedBy'); else print $langs->trans('ReviewedByCP'); print ''; - print ''.$valideur->getNomUrl(-1).''; + print ''.$valideur->getNomUrl(-1); + $include_users = $object->fetch_users_approver_holiday(); + if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED) + { + print ''.img_edit($langs->trans("Edit")).''; + } + print ''; print ''; } else { print ''; print ''.$langs->trans('ReviewedByCP').''; print ''; $include_users = $object->fetch_users_approver_holiday(); + if (! in_array($object->fk_validator, $include_users)) // Add the current validator to the list to not lose it when editing. + { + $include_users[]=$object->fk_validator; + } if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays"); else { - $s=$form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id)), 0, $include_users); + $s=$form->select_dolusers($object->fk_validator, "valideur", (($action == 'editvalidator') ? 0 : 1), ($user->admin ? '' : array($user->id)), 0, $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); } + if ($action == 'editvalidator') + { + print ''; + print ''; + } print ''; print ''; } @@ -1255,19 +1304,19 @@ else print ''.$langs->trans('DateCreateCP').''; print ''.dol_print_date($object->date_create, 'dayhour').''; print ''; - if ($object->statut == 3 || $object->statut == 4) { + if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) { print ''; print ''.$langs->trans('DateValidCP').''; print ''.dol_print_date($object->date_valid, 'dayhour').''; // warning: date_valid is approval date on holiday module print ''; } - if ($object->statut == 4) { + if ($object->statut == Holiday::STATUS_CANCELED) { print ''; print ''.$langs->trans('DateCancelCP').''; print ''.dol_print_date($object->date_cancel, 'dayhour').''; print ''; } - if ($object->statut == 5) { + if ($object->statut == Holiday::STATUS_REFUSED) { print ''; print ''.$langs->trans('DateRefusCP').''; print ''.dol_print_date($object->date_refuse, 'dayhour').''; @@ -1325,20 +1374,21 @@ else print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleSetToDraft"), $langs->trans("ConfirmSetToDraft"), "confirm_draft", '', 1, 1); } - - if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) + if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { - print '
'; - if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) + if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) { - print ''; + print '
'; + if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) + { + print ''; + } + print '
'; } - print '
'; print '
'; } - if (! $edit) { print '
'; diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 37a3d7f538b..071277bd501 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -127,7 +127,7 @@ elseif ($action == 'update') $name = GETPOST('name', 'alpha'); if (empty($name)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('Name')), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Name')), null, 'errors'); $error ++; } @@ -291,7 +291,7 @@ if (($id || $ref) && $action == 'edit') print ''.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).''; print ''; print ''; - + // Parent print ''.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; print ''; @@ -380,7 +380,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Name").''; print ''.$object->name.''; print ''; - + // Parent print ''; print ''.$langs->trans("Parent").''; diff --git a/htdocs/includes/ccampbell/chromephp/ChromePhp.php b/htdocs/includes/ccampbell/chromephp/ChromePhp.php deleted file mode 100644 index 577b1cecb9d..00000000000 --- a/htdocs/includes/ccampbell/chromephp/ChromePhp.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class ChromePhp -{ - /** - * @var string - */ - const VERSION = '4.1.0'; - - /** - * @var string - */ - const HEADER_NAME = 'X-ChromeLogger-Data'; - - /** - * @var string - */ - const BACKTRACE_LEVEL = 'backtrace_level'; - - /** - * @var string - */ - const LOG = 'log'; - - /** - * @var string - */ - const WARN = 'warn'; - - /** - * @var string - */ - const ERROR = 'error'; - - /** - * @var string - */ - const GROUP = 'group'; - - /** - * @var string - */ - const INFO = 'info'; - - /** - * @var string - */ - const GROUP_END = 'groupEnd'; - - /** - * @var string - */ - const GROUP_COLLAPSED = 'groupCollapsed'; - - /** - * @var string - */ - const TABLE = 'table'; - - /** - * @var string - */ - protected $_php_version; - - /** - * @var int - */ - protected $_timestamp; - - /** - * @var array - */ - protected $_json = array( - 'version' => self::VERSION, - 'columns' => array('log', 'backtrace', 'type'), - 'rows' => array() - ); - - /** - * @var array - */ - protected $_backtraces = array(); - - /** - * @var bool - */ - protected $_error_triggered = false; - - /** - * @var array - */ - protected $_settings = array( - self::BACKTRACE_LEVEL => 1 - ); - - /** - * @var ChromePhp - */ - protected static $_instance; - - /** - * Prevent recursion when working with objects referring to each other - * - * @var array - */ - protected $_processed = array(); - - /** - * constructor - */ - private function __construct() - { - $this->_php_version = phpversion(); - $this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time(); - $this->_json['request_uri'] = $_SERVER['REQUEST_URI']; - } - - /** - * gets instance of this class - * - * @return ChromePhp - */ - public static function getInstance() - { - if (self::$_instance === null) { - self::$_instance = new self(); - } - return self::$_instance; - } - - /** - * logs a variable to the console - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function log() - { - $args = func_get_args(); - return self::_log('', $args); - } - - /** - * logs a warning to the console - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function warn() - { - $args = func_get_args(); - return self::_log(self::WARN, $args); - } - - /** - * logs an error to the console - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function error() - { - $args = func_get_args(); - return self::_log(self::ERROR, $args); - } - - /** - * sends a group log - * - * @param string value - */ - public static function group() - { - $args = func_get_args(); - return self::_log(self::GROUP, $args); - } - - /** - * sends an info log - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function info() - { - $args = func_get_args(); - return self::_log(self::INFO, $args); - } - - /** - * sends a collapsed group log - * - * @param string value - */ - public static function groupCollapsed() - { - $args = func_get_args(); - return self::_log(self::GROUP_COLLAPSED, $args); - } - - /** - * ends a group log - * - * @param string value - */ - public static function groupEnd() - { - $args = func_get_args(); - return self::_log(self::GROUP_END, $args); - } - - /** - * sends a table log - * - * @param string value - */ - public static function table() - { - $args = func_get_args(); - return self::_log(self::TABLE, $args); - } - - /** - * internal logging call - * - * @param string $type - * @return void - */ - protected static function _log($type, array $args) - { - // nothing passed in, don't do anything - if (count($args) == 0 && $type != self::GROUP_END) { - return; - } - - $logger = self::getInstance(); - - $logger->_processed = array(); - - $logs = array(); - foreach ($args as $arg) { - $logs[] = $logger->_convert($arg); - } - - $backtrace = debug_backtrace(false); - $level = $logger->getSetting(self::BACKTRACE_LEVEL); - - $backtrace_message = 'unknown'; - if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) { - $backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line']; - } - - $logger->_addRow($logs, $backtrace_message, $type); - } - - /** - * converts an object to a better format for logging - * - * @param Object - * @return array - */ - protected function _convert($object) - { - // if this isn't an object then just return it - if (!is_object($object)) { - return $object; - } - - //Mark this object as processed so we don't convert it twice and it - //Also avoid recursion when objects refer to each other - $this->_processed[] = $object; - - $object_as_array = array(); - - // first add the class name - $object_as_array['___class_name'] = get_class($object); - - // loop through object vars - $object_vars = get_object_vars($object); - foreach ($object_vars as $key => $value) { - - // same instance as parent object - if ($value === $object || in_array($value, $this->_processed, true)) { - $value = 'recursion - parent object [' . get_class($value) . ']'; - } - $object_as_array[$key] = $this->_convert($value); - } - - $reflection = new ReflectionClass($object); - - // loop through the properties and add those - foreach ($reflection->getProperties() as $property) { - - // if one of these properties was already added above then ignore it - if (array_key_exists($property->getName(), $object_vars)) { - continue; - } - $type = $this->_getPropertyKey($property); - - if ($this->_php_version >= 5.3) { - $property->setAccessible(true); - } - - try { - $value = $property->getValue($object); - } catch (ReflectionException $e) { - $value = 'only PHP 5.3 can access private/protected properties'; - } - - // same instance as parent object - if ($value === $object || in_array($value, $this->_processed, true)) { - $value = 'recursion - parent object [' . get_class($value) . ']'; - } - - $object_as_array[$type] = $this->_convert($value); - } - return $object_as_array; - } - - /** - * takes a reflection property and returns a nicely formatted key of the property name - * - * @param ReflectionProperty - * @return string - */ - protected function _getPropertyKey(ReflectionProperty $property) - { - $static = $property->isStatic() ? ' static' : ''; - if ($property->isPublic()) { - return 'public' . $static . ' ' . $property->getName(); - } - - if ($property->isProtected()) { - return 'protected' . $static . ' ' . $property->getName(); - } - - if ($property->isPrivate()) { - return 'private' . $static . ' ' . $property->getName(); - } - } - - /** - * adds a value to the data array - * - * @var mixed - * @return void - */ - protected function _addRow(array $logs, $backtrace, $type) - { - // if this is logged on the same line for example in a loop, set it to null to save space - if (in_array($backtrace, $this->_backtraces)) { - $backtrace = null; - } - - // for group, groupEnd, and groupCollapsed - // take out the backtrace since it is not useful - if ($type == self::GROUP || $type == self::GROUP_END || $type == self::GROUP_COLLAPSED) { - $backtrace = null; - } - - if ($backtrace !== null) { - $this->_backtraces[] = $backtrace; - } - - $row = array($logs, $backtrace, $type); - - $this->_json['rows'][] = $row; - $this->_writeHeader($this->_json); - } - - protected function _writeHeader($data) - { - header(self::HEADER_NAME . ': ' . $this->_encode($data)); - } - - /** - * encodes the data to be sent along with the request - * - * @param array $data - * @return string - */ - protected function _encode($data) - { - return base64_encode(utf8_encode(json_encode($data))); - } - - /** - * adds a setting - * - * @param string key - * @param mixed value - * @return void - */ - public function addSetting($key, $value) - { - $this->_settings[$key] = $value; - } - - /** - * add ability to set multiple settings in one call - * - * @param array $settings - * @return void - */ - public function addSettings(array $settings) - { - foreach ($settings as $key => $value) { - $this->addSetting($key, $value); - } - } - - /** - * gets a setting - * - * @param string key - * @return mixed - */ - public function getSetting($key) - { - if (!isset($this->_settings[$key])) { - return null; - } - return $this->_settings[$key]; - } -} diff --git a/htdocs/includes/ccampbell/chromephp/README.md b/htdocs/includes/ccampbell/chromephp/README.md deleted file mode 100644 index 3dd7dbe19dd..00000000000 --- a/htdocs/includes/ccampbell/chromephp/README.md +++ /dev/null @@ -1,23 +0,0 @@ -## Overview -ChromePhp is a PHP library for the Chrome Logger Google Chrome extension. - -This library allows you to log variables to the Chrome console. - -## Requirements -- PHP 5 or later - -## Installation -1. Install the Chrome extension from: https://chrome.google.com/extensions/detail/noaneddfkdjfnfdakjjmocngnfkfehhd -2. Click the extension icon in the browser to enable it for the current tab's domain -3. Put ChromePhp.php somewhere in your PHP include path -4. Log some data - - ```php - include 'ChromePhp.php'; - ChromePhp::log('Hello console!'); - ChromePhp::log($_SERVER); - ChromePhp::warn('something went wrong!'); - ``` - -More information can be found here: -http://www.chromelogger.com diff --git a/htdocs/includes/ccampbell/chromephp/composer.json b/htdocs/includes/ccampbell/chromephp/composer.json deleted file mode 100644 index dc16853d3ec..00000000000 --- a/htdocs/includes/ccampbell/chromephp/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ccampbell/chromephp", - "type": "library", - "description": "Log variables to the Chrome console (via Chrome Logger Google Chrome extension).", - "keywords": ["log","logging"], - "homepage": "http://github.com/ccampbell/chromephp", - "license": "Apache-2.0", - "authors": [ - { - "name": "Craig Campbell", - "email": "iamcraigcampbell@gmail.com", - "homepage": "http://craig.is", - "role": "Developer" - } - ], - "require": { - "php": ">=5.0.0" - }, - "autoload": { - "psr-0": { - "ChromePhp": "" - } - } -} diff --git a/htdocs/install/mysql/data/llx_accounting_abc.sql b/htdocs/install/mysql/data/llx_accounting_abc.sql index b1dcdb64c35..54ae1d6e466 100644 --- a/htdocs/install/mysql/data/llx_accounting_abc.sql +++ b/htdocs/install/mysql/data/llx_accounting_abc.sql @@ -129,3 +129,6 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE -- Description of chart of account DZ NSCF INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 13, 'NSCF', 'Nouveau système comptable financier', 1); + +-- Description of chart of account NL NL-VERKORT +INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 17, 'NL-VERKORT', 'Verkort rekeningschema', 1); diff --git a/htdocs/install/mysql/data/llx_accounting_account_nl.sql b/htdocs/install/mysql/data/llx_accounting_account_nl.sql new file mode 100644 index 00000000000..8cd08eb474d --- /dev/null +++ b/htdocs/install/mysql/data/llx_accounting_account_nl.sql @@ -0,0 +1,117 @@ +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2009 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2011-2017 Alexandre Spangaro +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- + +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l'install et tous les sigles '--' sont supprimés. +-- + +-- Description of the accounts in NL-VERKORT +-- ID 0100-9999 +-- ADD 7006000 to rowid # Do no remove this comment -- +-- + +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1000, 'NL_VERKORT', 'BALANS', 'XXXXXX', '0050', '', 'Bedrijfspand en woning', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1001, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0055', '', 'Afschrijving bedrijfspand en woning', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1002, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0100', '', 'Inventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1003, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0105', '', 'Afschrijving inventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1004, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0150', '', 'Kantoor-inventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1005, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0155', '', 'Afschrijving kantoor-inventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1006, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0200', '', 'Transportmiddelen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1007, 'NL-VERKORT', 'BALANS', 'XXXXXX', '0205', '', 'Afschrijving transportmiddelen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1008, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1100', '', 'Kas', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1009, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1200', '', 'Bank', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1010, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1300', '', 'Debiteuren', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1011, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1310', '', 'Oninbare debiteuren', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1012, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1500', '', 'Privé', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1013, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1520', '', 'Privé IB/ZORGVERZ', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1014, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1600', '', 'Crediteuren', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1015, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1700', '', 'Ingehouden loonbelasing', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1016, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1710', '', 'Afdracht loonbelasting', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1017, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1720', '', 'Ingehouden pensioenlasten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1018, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1730', '', 'Reservering vakantiegeld', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1019, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1820', '', 'BTW te betalen hoog', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1020, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1825', '', 'BTW te betalen laag', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1021, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1828', '', 'BTW te betalen auto privé', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1022, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1829', '', 'BTW te betalen telefoon privé', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1023, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1830', '', 'BTW te vorderen hoog', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1024, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1835', '', 'BTW te vorderen laag', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1025, 'NL-VERKORT', 'BALANS', 'XXXXXX', '1890', '', 'Betaalde BTW', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1026, 'NL-VERKORT', 'BALANS', 'XXXXXX', '2200', '', 'Te betalen netto lonen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1027, 'NL-VERKORT', 'BALANS', 'XXXXXX', '2500', '', 'Kruisposten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1028, 'NL-VERKORT', 'BALANS', 'XXXXXX', '2900', '', 'Vraagposten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1029, 'NL-VERKORT', 'BALANS', 'XXXXXX', '3000', '', 'Voorraad', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1030, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4000', '', 'Kantoorbenodigdheden', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1031, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4010', '', 'Porti', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1032, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4020', '', 'Telefoon/Internet', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1033, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4030', '', 'Onderhoud gebouwen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1034, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4040', '', 'Overige huisvestingskosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1035, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4050', '', 'Belastingen en heffingen onroerend goed', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1036, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4060', '', 'Onderhoud inventaris e.d.', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1037, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4070', '', 'Kleine aanschaffingen < 500', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1038, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4080', '', 'Kosten automatisering', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1039, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4090', '', 'Abonnementen en contributies', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1040, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4100', '', 'Autokosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1041, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4110', '', 'Boetes', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1042, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4120', '', 'Auto brandstof', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1043, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4130', '', 'Auto belasting en verzekering', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1044, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4140', '', 'BTW privé gebruik', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1045, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4150', '', 'Bijtelling auto', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1046, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4200', '', 'Reiskosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1047, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4210', '', 'Reiskosten/eten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1048, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4220', '', 'Representatiekosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1049, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4230', '', 'Werkkleding', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1050, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4300', '', 'Magazijnkosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1051, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4310', '', 'Stroom, gas en water', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1052, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4320', '', 'Huur', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1053, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4330', '', 'Reclamekosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1054, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4340', '', 'Sponsoring', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1055, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4350', '', 'Vertegenwoordigers/provisie', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1056, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4400', '', 'Bruto lonen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1057, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4410', '', 'Sociale lasten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1058, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4500', '', 'Afschr. kosten gebouwen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1059, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4510', '', 'Afschr. kosten bedrijfsinventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1060, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4520', '', 'Afschr. kosten kantoorinventaris', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1061, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4530', '', 'Afschr. kosten transportmiddelen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1062, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4600', '', 'Administratiekosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1063, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4610', '', 'Kantinekosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1064, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4620', '', 'Provisie ass. tussenpersoon', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1065, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4630', '', 'Vraagposten (V&W)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1066, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4640', '', 'Diverse verzekeringen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1067, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4700', '', 'Overige kosten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1068, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4750', '', 'Nog te verdelen posten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1069, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4800', '', 'Rente hypotheek', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1070, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4810', '', 'Rente overige leningen', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1071, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '4820', '', 'Rente en kosten RC', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1072, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7000', '', 'Inkoop hoog', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1073, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7010', '', 'Inkoop laag', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1074, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7020', '', 'Inkoop nul BTW', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1075, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7030', '', 'Inkoop binnen EU', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1076, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '7040', '', 'Inkoop buiten EU', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1077, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8000', '', 'Omzet hoog', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1078, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8010', '', 'Omzet laag', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1079, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8020', '', 'Omzet nul BTW', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1080, 'NL-VERKORT', 'INCOME', 'XXXXXX', '8090', '', 'Onderhanden omzet', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1081, 'NL-VERKORT', 'INCOME', 'XXXXXX', '9000', '', 'Bijzondere baten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1082, 'NL-VERKORT', 'EXPENSE', 'XXXXXX', '9010', '', 'Bijzondere lasten', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1083, 'NL-VERKORT', 'BALANS', 'XXXXXX', '9900', '', 'Kapitaal', 1); diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index c0ab1631d8c..f639db56ab5 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -270,8 +270,8 @@ CREATE TABLE llx_pos_cash_fence( -- Withdrawals / Prelevements -UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; -UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; +UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_END_TO_END')__ where name = __ENCRYPT('END_TO_END')__; +UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_USTRD')__ where name = __ENCRYPT('USTRD')__; -- Delete duplicate accounting account, but only if not used diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 035cd0d48c5..81a1e315751 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -212,19 +212,22 @@ CREATE TABLE llx_bom_bom( description text, note_public text, note_private text, + fk_product integer, + qty double(24,8), + efficiency double(8,4), date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp, date_valid datetime, fk_user_creat integer NOT NULL, fk_user_modif integer, fk_user_valid integer, import_key varchar(14), - status integer NOT NULL, - fk_product integer, - qty double(24,8) + status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; +ALTER TABLE llx_bom_bom ADD COLUMN efficiency double(8,4) DEFAULT 1; + create table llx_bom_bom_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, @@ -236,15 +239,21 @@ create table llx_bom_bom_extrafields CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, + fk_bom_child integer NULL, description text, import_key varchar(14), - qty double(24,8), - fk_product integer, - fk_bom integer, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; +ALTER TABLE llx_bom_bomline ADD COLUMN efficiency double(8,4) DEFAULT 1; +ALTER TABLE llx_bom_bomline ADD COLUMN fk_bom_child integer NULL; + + create table llx_bom_bomline_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, @@ -295,8 +304,8 @@ ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer; ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN datelastok datetime; ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN maxemailpercollect integer DEFAULT 100; -DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_HOVER' AND value = '0'; -DELETE FROM llx_const WHERE name = 'THEME_ELDY_USE_CHECKED' AND value = '0'; +DELETE FROM llx_const WHERE name = __ENCRYPT('THEME_ELDY_USE_HOVER')__ AND value = __ENCRYPT('0')__; +DELETE FROM llx_const WHERE name = __ENCRYPT('THEME_ELDY_USE_CHECKED')__ AND value = __ENCRYPT('0')__; ALTER TABLE llx_inventorydet DROP COLUMN pmp; ALTER TABLE llx_inventorydet DROP COLUMN pa; diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql index a406229a0e4..4e559566817 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -23,6 +23,9 @@ CREATE TABLE llx_bom_bom( description text, note_public text, note_private text, + fk_product integer, + qty double(24,8), + efficiency double(8,4) DEFAULT 1, date_creation datetime NOT NULL, tms timestamp, date_valid datetime, @@ -30,8 +33,6 @@ CREATE TABLE llx_bom_bom( fk_user_modif integer, fk_user_valid integer, import_key varchar(14), - status integer NOT NULL, - fk_product integer, - qty double(24,8) + status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql index d1a958e9633..bafaaf73694 100644 --- a/htdocs/install/mysql/tables/llx_bom_bomline.sql +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -13,15 +13,16 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see http://www.gnu.org/licenses/. - CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, + fk_bom_child integer NULL, description text, import_key varchar(14), - qty double(24,8), - fk_product integer, - fk_bom integer, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS -) ENGINE=innodb; \ No newline at end of file +) ENGINE=innodb; diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index fa1b070cc40..d55cdd7d01f 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -67,17 +67,17 @@ $actiondone=1; print '

'.$langs->trans("Repair").'

'; -print 'Option standard (0 or \'confirmed\') is '.(GETPOST('standard', 'alpha')?GETPOST('standard', 'alpha'):'0').'
'."\n"; -print 'Option restore_thirdparties_logos (0 or \'confirmed\') is '.(GETPOST('restore_thirdparties_logos', 'alpha')?GETPOST('restore_thirdparties_logos', 'alpha'):'0').'
'."\n"; -print 'Option clean_linked_elements (0 or \'confirmed\') is '.(GETPOST('clean_linked_elements', 'alpha')?GETPOST('clean_linked_elements', 'alpha'):'0').'
'."\n"; -print 'Option clean_menus (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_menus', 'alpha')?GETPOST('clean_menus', 'alpha'):'0').'
'."\n"; -print 'Option clean_orphelin_dir (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir', 'alpha')?GETPOST('clean_orphelin_dir', 'alpha'):'0').'
'."\n"; -print 'Option clean_product_stock_batch (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch', 'alpha')?GETPOST('clean_product_stock_batch', 'alpha'):'0').'
'."\n"; -print 'Option set_empty_time_spent_amount (0 or \'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'0').'
'."\n"; -print 'Option rebuild_product_thumbs (0 or \'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'0').'
'."\n"; -print 'Option force_disable_of_modules_not_found (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'0').'
'."\n"; -print 'Option clean_perm_table (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'0').'
'."\n"; -print 'Option force_utf8_on_tables, for mysql/mariadb only (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'0').'
'."\n"; +print 'Option standard (\'test\' or \'confirmed\') is '.(GETPOST('standard', 'alpha')?GETPOST('standard', 'alpha'):'undefined').'
'."\n"; +print 'Option restore_thirdparties_logos (\'test\' or \'confirmed\') is '.(GETPOST('restore_thirdparties_logos', 'alpha')?GETPOST('restore_thirdparties_logos', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_linked_elements (\'test\' or \'confirmed\') is '.(GETPOST('clean_linked_elements', 'alpha')?GETPOST('clean_linked_elements', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_menus (\'test\' or \'confirmed\') is '.(GETPOST('clean_menus', 'alpha')?GETPOST('clean_menus', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_orphelin_dir (\'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir', 'alpha')?GETPOST('clean_orphelin_dir', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_product_stock_batch (\'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch', 'alpha')?GETPOST('clean_product_stock_batch', 'alpha'):'undefined').'
'."\n"; +print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'undefined').'
'."\n"; +print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'undefined').'
'."\n"; +print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'
'."\n"; +print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'undefined').'
'."\n"; +print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'
'."\n"; print '
'; print ''; @@ -302,14 +302,23 @@ if ($ok && GETPOST('standard', 'alpha')) ); //var_dump($field_desc);exit; - $result=$db->DDLAddField($tableextra, $code, $field_desc, ""); - if ($result < 0) + $result = 0; + if (GETPOST('standard', 'alpha') == 'confirmed') { - print "KO ".$db->lasterror."
\n"; + $result=$db->DDLAddField($tableextra, $code, $field_desc, ""); + + if ($result < 0) + { + print "KO ".$db->lasterror."
\n"; + } + else + { + print "OK
\n"; + } } else { - print "OK
\n"; + print ' - Mode test, no column added.'; } } } @@ -324,7 +333,6 @@ if ($ok && GETPOST('standard', 'alpha')) } - // clean_data_ecm_dir: Clean data into ecm_directories table if ($ok && GETPOST('standard', 'alpha')) { @@ -332,10 +340,76 @@ if ($ok && GETPOST('standard', 'alpha')) } +// clean declaration constants +if ($ok && GETPOST('standard', 'alpha')) +{ + print ''; + $sql ="SELECT name, entity, value"; + $sql.=" FROM ".MAIN_DB_PREFIX."const as c"; + $sql.=" WHERE name LIKE 'MAIN_MODULE_%_TPL' OR name LIKE 'MAIN_MODULE_%_CSS' OR name LIKE 'MAIN_MODULE_%_JS' OR name LIKE 'MAIN_MODULE_%_HOOKS'"; + $sql.=" OR name LIKE 'MAIN_MODULE_%_TRIGGERS' OR name LIKE 'MAIN_MODULE_%_THEME' OR name LIKE 'MAIN_MODULE_%_SUBSTITUTIONS' OR name LIKE 'MAIN_MODULE_%_MODELS'"; + $sql.=" OR name LIKE 'MAIN_MODULE_%_MENUS' OR name LIKE 'MAIN_MODULE_%_LOGIN' OR name LIKE 'MAIN_MODULE_%_BARCODE'"; + $sql.=" ORDER BY name, entity"; -/* From here, actions need a parameter */ + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + if ($num) + { + $db->begin(); + + $i = 0; + while ($i < $num) + { + $obj=$db->fetch_object($resql); + + $reg = array(); + if (preg_match('/MAIN_MODULE_(.*)_(.*)/i', $obj->name, $reg)) + { + $name=$reg[1]; + $type=$reg[2]; + + $sql2 ="SELECT COUNT(*) as nb"; + $sql2.=" FROM ".MAIN_DB_PREFIX."const as c"; + $sql2.=" WHERE name LIKE 'MAIN_MODULE_".$name."'"; + $sql2.=" AND entity = ".$obj->entity; + $resql2 = $db->query($sql2); + if ($resql2) + { + $obj2 = $db->fetch_object($resql2); + if ($obj2 && $obj2->nb == 0) + { + // Module not found, so we canremove entry + $sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$db->escape($obj->name)."' AND entity = ".$obj->entity; + + if (GETPOST('standard', 'alpha') == 'confirmed') + { + $db->query($sqldelete); + + print ''; + } + else + { + print ''; + } + } + else + { + //print ''; + } + } + } + + $i++; + } + + $db->commit(); + } + } +} // restore_thirdparties_logos: Move logos to correct new directory. @@ -903,7 +977,7 @@ if ($ok && GETPOST('set_empty_time_spent_amount', 'alpha')) // force_disable_of_modules_not_found if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) { - print ''; + print ''; $arraylistofkey=array('hooks','js','css'); @@ -931,12 +1005,16 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) $db->begin(); + $reg = array(); if (preg_match('/MAIN_MODULE_(.*)_'.strtoupper($key).'/i', $constantname, $reg)) { $name=strtolower($reg[1]); - if ($name) // And entry for key $key and module $name was found in database. + if ($name) // An entry for key $key and module $name was found in database. { + $reloffile = ''; + $result = 'found'; + if ($key == 'hooks') $reloffile=$name.'/class/actions_'.$name.'.class.php'; if ($key == 'js') { @@ -953,13 +1031,17 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) $reloffile=preg_replace('/^\//', '', $valuearray[0]); } - //var_dump($key.' - '.$value.' - '.$reloffile); - try { - $result = dol_buildpath($reloffile, 0, 2); - } - catch(Exception $e) + if ($reloffile) { - // No catch yet + //var_dump($key.' - '.$value.' - '.$reloffile); + try { + $result = dol_buildpath($reloffile, 0, 2); + } + catch(Exception $e) + { + // No catch yet + $result = 'found'; // If error, we force lke if we found to avoid any deletion + } } if (! $result) @@ -967,7 +1049,7 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) print ' - File of '.$key.' ('.$reloffile.') NOT found, we disable the module.'; if (GETPOST('force_disable_of_modules_not_found') == 'confirmed') { - $sql2 ="DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'MAIN_MODULE_".strtoupper($name)."_".strtoupper($key)."'"; + $sql2 ="DELETE FROM ".MAIN_DB_PREFIX."const WHERE name 'MAIN_MODULE_".strtoupper($name)."_".strtoupper($key)."'"; $resql2=$db->query($sql2); if (! $resql2) { diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 0cb8fe68c5a..c37dee6570a 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -366,7 +366,7 @@ if (! $error && $db->connected && $action == "set") print "'; - // insurance amount + // Insurance amount print ''; // Project @@ -707,7 +707,9 @@ if ($id > 0) $total_insurance = 0; $total_interest = 0; $total_capital = 0; - print '

*** Clean module_parts entries of modules not enabled
Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we delete record
Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we should delete record (not done, mode test)
Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module found in entity '.$obj->entity.', we keep record

*** Force modules not found to be disabled (only modules adding js, css or hooks can be detected as removed)

*** Force modules not found physicaly to be disabled (only modules adding js, css or hooks can be detected as removed physicaly)
"; print $langs->trans("ErrorDirDoesNotExists", $main_dir).'
'; - print $langs->trans("ErrorWrongValueForParameter", $langs->trans("WebPagesDirectory")).'
'; + print $langs->trans("ErrorWrongValueForParameter", $langs->transnoentitiesnoconv("WebPagesDirectory")).'
'; print $langs->trans("ErrorGoBackAndCorrectParameters").'

'; print '
'; print $langs->trans("Error"); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 25b8f8d11aa..20b9862e187 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -292,6 +292,7 @@ Modelcsv_agiris=Export for Agiris Modelcsv_openconcerto=Export for OpenConcerto (Test) Modelcsv_configurable=Export CSV Configurable Modelcsv_FEC=Export FEC (Art. L47 A) +Modelcsv_Sage50_Swiss=Export for Sage 50 Switzerland ChartofaccountsId=Chart of accounts Id ## Tools - Init accounting account on product / service diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e0c2afd7e34..5fc1994247c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1889,4 +1889,5 @@ IFTTT_SERVICE_KEY=IFTTT Service key IFTTT_DOLIBARR_ENDPOINT_SECUREKEY=Security key to secure the endpoint URL used by IFTTT to send messages to your Dolibarr. IFTTTDesc=This module is designed to trigger events on IFTTT and/or to execute some action on external IFTTT triggers. UrlForIFTTT=URL endpoint for IFTTT -YouWillFindItOnYourIFTTTAccount=You will find it on your IFTTT account \ No newline at end of file +YouWillFindItOnYourIFTTTAccount=You will find it on your IFTTT account +EndPointFor=End point for %s : %s \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 233861a2f0e..fd74d0cae07 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -971,3 +971,5 @@ ShowMoreInfos=Show More Infos NoFilesUploadedYet=Please upload a document first SeePrivateNote=See private note PaymentInformation=Payment information +ValidFrom=Valid from +ValidUntil=Valid until \ No newline at end of file diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 0d57c7ed4a7..c4bb9193a33 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -11,3 +11,5 @@ BOMsModelModule=BOMS document templates FreeLegalTextOnBOMs=Free text on document of BOM WatermarkOnDraftBOMs=Watermark on draft BOM ConfirmCloneBillOfMaterials=Are you sure you want to clone this bill of material ? +ManufacturingEfficiency=Manufacturing efficiency +ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the production diff --git a/htdocs/langs/en_US/paybox.lang b/htdocs/langs/en_US/paybox.lang index 269242b910b..d3c26c8e65a 100644 --- a/htdocs/langs/en_US/paybox.lang +++ b/htdocs/langs/en_US/paybox.lang @@ -37,3 +37,4 @@ PAYBOX_PAYONLINE_SENDEMAIL=Email notification after payment attempt (success or PAYBOX_PBX_SITE=Value for PBX SITE PAYBOX_PBX_RANG=Value for PBX Rang PAYBOX_PBX_IDENTIFIANT=Value for PBX ID +PAYBOX_HMAC_KEY=HMAC key \ No newline at end of file diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 9d70262a519..6a2d7e89cb7 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -268,7 +268,8 @@ TicketPublicInterfaceForbidden=The public interface for the tickets was not enab ErrorEmailOrTrackingInvalid=Bad value for tracking ID or email OldUser=Old user NewUser=New user - +NumberOfTicketsByMonth=Number of tickets per month +NbOfTickets=Number of tickets # notifications TicketNotificationEmailSubject=Ticket %s updated TicketNotificationEmailBody=This is an automatic message to notify you that ticket %s has just been updated diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 4655bf3493a..43f82e9f1fb 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -97,4 +97,7 @@ ThisPageHasTranslationPages=This page/container has translation NoWebSiteCreateOneFirst=No website has been created yet. Create one first. GoTo=Go to DynamicPHPCodeContainsAForbiddenInstruction=You add dynamic PHP code that contains the PHP instruction '%s' that is forbidden by default as dynamic content (see hidden options WEBSITE_PHP_ALLOW_xxx to increase list of allowed commands). -NotAllowedToAddDynamicContent=You don't have permission to add or edit PHP dynamic content in websites. Ask permission or just keep code into php tags unmodified. \ No newline at end of file +NotAllowedToAddDynamicContent=You don't have permission to add or edit PHP dynamic content in websites. Ask permission or just keep code into php tags unmodified. +ReplaceWebsiteContent=Replace website content +DeleteAlsoJs=Delete also all javascript files specific to this website? +DeleteAlsoMedias=Delete also all medias files specific to this website? \ No newline at end of file diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index bb2b69f63f2..e826e86ea57 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -302,7 +302,7 @@ if ($action == 'create') // Rate print '
'.$langs->trans("Rate").' %
'.$langs->trans("Insurance").'
'; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; print ''; print ''; print ''; @@ -748,6 +750,8 @@ if ($id > 0) print ''; } print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").'
"; + print '
'; + $db->free($resql); } else diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 78d0716f9bf..09db1c0362d 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -135,9 +135,9 @@ if ($id > 0 || ! empty($ref)) $sql.= " f.datef, f.paye, f.fk_statut as statut, f.type,"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " sc.fk_soc, sc.fk_user,"; $sql.= " sum(d.total_ht) as selling_price,"; // may be negative or positive - $sql.= " IF(f.type = 2, -1, 1) * sum(d.qty) as qty,"; // not always positive in case of Credit note - $sql.= " IF(f.type = 2, -1, 1) * sum(d.qty * d.buy_price_ht) as buying_price,"; // not always positive in case of Credit note - $sql.= " IF(f.type = 2, -1, 1) * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty)) as marge" ; // not always positive in case of Credit note + $sql.= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty) as qty,"; // not always positive in case of Credit note + $sql.= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty * d.buy_price_ht) as buying_price,"; // not always positive in case of Credit note + $sql.= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty)) as marge" ; // not always positive in case of Credit note $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 06658b71576..c36debb9a12 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -60,7 +60,7 @@ class MyObject extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; - const STATUS_DISABLED = -1; + const STATUS_DISABLED = 9; /** @@ -105,7 +105,7 @@ class MyObject extends CommonObject 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), - 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Canceled')), + 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', 9=>'Canceled')), ); /** @@ -541,8 +541,9 @@ class MyObject extends CommonObject { global $langs; //$langs->load("mymodule"); - $this->labelstatus[1] = $langs->trans('Enabled'); - $this->labelstatus[0] = $langs->trans('Disabled'); + $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); } if ($mode == 0) @@ -555,28 +556,23 @@ class MyObject extends CommonObject } elseif ($mode == 2) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 5) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 6) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } } diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index b536b264952..1f693282e5f 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -141,7 +141,7 @@ if ($object->id > 0) $head = myobjectPrepareHead($object); - dol_fiche_head($head, 'agenda', $langs->trans("MyObject"), -1, 'myobject@mymodule'); + dol_fiche_head($head, 'agenda', $langs->trans("MyObject"), -1, $object->picto); // Object card // ------------------------------------------------------------ diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index e24c6b6d32d..1fc376dfe17 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -248,7 +248,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $res = $object->fetch_optionals(); $head = myobjectPrepareHead($object); - dol_fiche_head($head, 'card', $langs->trans("MyObject"), -1, 'myobject@mymodule'); + dol_fiche_head($head, 'card', $langs->trans("MyObject"), -1, $object->picto); $formconfirm = ''; @@ -356,7 +356,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print ''; - print '

'; + print '
'; dol_fiche_end(); diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index 55fcdc6f9eb..6c956826e4c 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -110,7 +110,7 @@ if ($object->id) */ $head = myobjectPrepareHead($object); - dol_fiche_head($head, 'document', $langs->trans("MyObject"), -1, 'myobject@mymodule'); + dol_fiche_head($head, 'document', $langs->trans("MyObject"), -1, $object->picto); // Build file list diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 8fee6ca6664..5e6388d55f9 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -354,19 +354,7 @@ print ''; print ''; print ''; -$newcardbutton=''; -//if ($user->rights->mymodule->creer) -//{ - $newcardbutton=''.$langs->trans('New').''; - $newcardbutton.= ''; - $newcardbutton.= ''; -//} -//else -//{ -// $newcardbutton=''.$langs->trans('New').'; -// $newcardbutton.= ''; -// $newcardbutton.= ''; -//} +$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/mymodule/myobject_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->mymodule->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); @@ -413,12 +401,18 @@ print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + $cssforfield=(empty($val['css'])?'':$val['css']); if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) print ''; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -440,11 +434,11 @@ print ''."\n"; print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + $cssforfield=(empty($val['css'])?'':$val['css']); if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; @@ -485,14 +479,14 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; + $cssforfield=(empty($val['css'])?'':$val['css']); if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; @@ -503,13 +497,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print ''; if ($key == 'status') print $object->getLibStatut(5); elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); else print $object->showOutputField($val, $key, $obj->$key, ''); @@ -600,7 +588,7 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n $filedir=$diroutputmassaction; $genallowed=$user->rights->mymodule->read; - $delallowed=$user->rights->mymodule->create; + $delallowed=$user->rights->mymodule->write; print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php index 0cbf4c40d8b..6ebe37b674a 100644 --- a/htdocs/modulebuilder/template/myobject_note.php +++ b/htdocs/modulebuilder/template/myobject_note.php @@ -95,7 +95,7 @@ if ($id > 0 || ! empty($ref)) $head = myobjectPrepareHead($object); - dol_fiche_head($head, 'note', $langs->trans("MyObject"), -1, 'myobject@mymodule'); + dol_fiche_head($head, 'note', $langs->trans("MyObject"), -1, $object->picto); // Object card // ------------------------------------------------------------ diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 3c761b930e3..abad76ce228 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -73,7 +73,7 @@ if ($action == 'setvalue' && $user->admin) if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PAYBOX_HMAC_KEY", dol_encode(GETPOST('PAYBOX_HMAC_KEY', 'alpha')), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error++; - + if (! $error) { @@ -151,7 +151,7 @@ print ''; print ''; print ''; @@ -181,7 +181,8 @@ print ''; print ''; diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php index 7dca957e489..2d9eceb4a5f 100644 --- a/htdocs/paybox/lib/paybox.lib.php +++ b/htdocs/paybox/lib/paybox.lib.php @@ -78,15 +78,15 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) return -1; } + $conf->global->PAYBOX_HASH = 'sha512'; + // Definition des parametres vente produit pour paybox - $IBS_CMD=$TAG; + $IBS_CMD=$TAG; $IBS_TOTAL=$PRICE*100; // En centimes $IBS_MODE=1; // Mode formulaire $IBS_PORTEUR=$EMAIL; $IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; // Format des parametres du get de validation en reponse (url a definir sous paybox) $IBS_TXT=' '; // Use a space - $IBS_BOUTPI=$langs->trans("Wait"); - //$IBS_BOUTPI=''; $IBS_EFFECTUE=$urlok; $IBS_ANNULE=$urlko; $IBS_REFUSE=$urlko; @@ -102,7 +102,9 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) $IBS_OUTPUT='E'; $PBX_SOURCE='HTML'; $PBX_TYPEPAIEMENT='CARTE'; - + $PBX_HASH = $conf->global->PAYBOX_HASH; + $PBX_TIME = dol_print_date(dol_now(), 'dayhourrfc', 'gmt'); + $msg = "PBX_IDENTIFIANT=".$PBX_IDENTIFIANT. "&PBX_MODE=".$IBS_MODE. "&PBX_SITE=".$IBS_SITE. @@ -122,11 +124,13 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) "&PBX_OUTPUT=".$IBS_OUTPUT. "&PBX_SOURCE=".$PBX_SOURCE. "&PBX_TYPEPAIEMENT=".$PBX_TYPEPAIEMENT; - + "&PBX_HASH=".$PBX_HASH; + "&PBX_TIME=".$PBX_TIME; + $binKey = pack("H*", dol_decode($conf->global->PAYBOX_HMAC_KEY)); - - $hmac = strtoupper(hash_hmac('sha512', $msg, $binKey)); - + + $hmac = strtoupper(hash_hmac($PBX_HASH, $msg, $binKey)); + dol_syslog("Soumission Paybox", LOG_DEBUG); dol_syslog("IBS_MODE: $IBS_MODE", LOG_DEBUG); @@ -147,10 +151,12 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) dol_syslog("PBX_IDENTIFIANT: $PBX_IDENTIFIANT", LOG_DEBUG); dol_syslog("PBX_SOURCE: $PBX_SOURCE", LOG_DEBUG); dol_syslog("PBX_TYPEPAIEMENT: $PBX_TYPEPAIEMENT", LOG_DEBUG); + dol_syslog("PBX_HASH: $PBX_HASH", LOG_DEBUG); + dol_syslog("PBX_TIME: $PBX_TIME", LOG_DEBUG); header("Content-type: text/html; charset=".$conf->file->character_set_client); header("X-Content-Type-Options: nosniff"); - + print ''."\n"; print ''."\n"; print "\n"; @@ -182,6 +188,9 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) print ''."\n"; print ''."\n"; print ''."\n"; + print ''."\n"; + print ''."\n"; + // Footprint of parameters print ''."\n"; print ''."\n"; diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index 7b0e1ddcc64..d50e474026e 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -183,7 +183,7 @@ $genPriceOptions = function ($level) use ($price_options) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2c8b70efbd1..847c6325b50 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -497,7 +497,7 @@ if (empty($reshook)) $originalId = $id; if ($object->id > 0) { - $object->ref = GETPOST('clone_ref'); + $object->ref = GETPOST('clone_ref', 'alphanohtml'); $object->status = 0; $object->status_buy = 0; $object->id = null; @@ -505,7 +505,8 @@ if (empty($reshook)) if ($object->check()) { - $id = $object->create($user); + $object->context['createfromclone'] = 'createfromclone'; + $id = $object->create($user); if ($id > 0) { if (GETPOST('clone_composition')) @@ -546,7 +547,7 @@ if (empty($reshook)) $object->fetch($id); } else - { + { $db->rollback(); if (count($object->errors)) { @@ -560,6 +561,8 @@ if (empty($reshook)) } } } + + unset($object->context['createfromclone']); } } else @@ -1966,7 +1969,7 @@ if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf- if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js || (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 260, 600); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 350, 600); } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index f27aac68eb4..a3b444db6b7 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -214,7 +214,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print '
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + else print ''; + print '
'; print ''.$langs->trans("PAYBOX_HMAC_KEY").''; print ''; -print '
'.$langs->trans("Example").': 2 ('.$langs->trans("Test").')'; +print '
'.$langs->trans("Example").': 1A2B3C4D5E6F'; print '
'; print ''.$langs->trans("PAYBOX_CGI_URL_V2").''; print ''; -print '
'.$langs->trans("Example").': http://mysite/cgi-bin/modulev2_redhat72.cgi'; +print '
'.$langs->trans("Example").' (preprod): https://preprod-tpeweb.paybox.com/php/'; +print '
'.$langs->trans("Example").' (prod): https://tpeweb.paybox.com/php/'; print '
- trans('PercentDiscountOver', $langs->trans('SellingPrice').' '.$i) ?> + trans('PercentDiscountOver', $langs->transnoentitiesnoconv('SellingPrice').' '.$i) ?>
'; + print '
'; // Nature if ($object->type!=Product::TYPE_SERVICE) @@ -268,236 +268,223 @@ if ($id > 0 || ! empty($ref)) $nbofsubproducts=count($prodschild); // This include only first level of childs - // Number of parent virtual products - //print $form->textwithpicto($langs->trans("ParentProductsNumber").': '.count($prodsfather), $langs->trans('IfZeroItIsNotUsedByVirtualProduct')); + print '
'; - //if (count($prodsfather) > 0) - //{ - print load_fiche_titre($langs->trans("ProductParentList"), '', ''); - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (count($prodsfather) > 0) + print load_fiche_titre($langs->trans("ProductParentList"), '', ''); + + print '
'.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + if (count($prodsfather) > 0) + { + foreach($prodsfather as $value) { - $class='pair'; + $idprod= $value["id"]; + $productstatic->id=$idprod;// $value["id"]; + $productstatic->type=$value["fk_product_type"]; + $productstatic->ref=$value['ref']; + $productstatic->label=$value['label']; + $productstatic->entity=$value['entity']; - foreach($prodsfather as $value) - { - $idprod= $value["id"]; - $productstatic->id=$idprod;// $value["id"]; - $productstatic->type=$value["fk_product_type"]; - $productstatic->ref=$value['ref']; - $productstatic->label=$value['label']; - $productstatic->entity=$value['entity']; - - $class=($class=='impair')?'pair':'impair'; - print ''; - - print ''; - print ''; - print ''; - print ''; - } - } - else - { - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; } - print '
'.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''.$value['qty'].'
'.$langs->trans("None").'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''.$value['qty'].'
'; - //} - + } + else + { + print ''; + print ''.$langs->trans("None").''; + print ''; + } + print ''; + print ''; print '
'."\n"; - // Number of subproducts - //print $form->textwithpicto($langs->trans("AssociatedProductsNumber").': '.(empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)?$nbofsubproducts:$nbofsubsubproducts), $langs->trans('IfZeroItIsNotAVirtualProduct')); + print '
'; - // List of subproducts - //if (count($prods_arbo) > 0) - //{ - $atleastonenotdefined=0; - print load_fiche_titre($langs->trans("ProductAssociationList"), '', ''); + $atleastonenotdefined=0; + print load_fiche_titre($langs->trans("ProductAssociationList"), '', ''); - print '
'; - print ''; - print ''; + print ''; + print ''; + print ''; - print ''; + print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->stock->enabled)) print ''; - print ''; - print ''; - print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->stock->enabled)) print ''; + print ''; + print ''; + print ''."\n"; - $class='pair'; - - $totalsell=0; - if (count($prods_arbo)) + $totalsell=0; + if (count($prods_arbo)) + { + foreach($prods_arbo as $value) { - foreach($prods_arbo as $value) + $productstatic->fetch($value['id']); + + if ($value['level'] <= 1) { - $productstatic->fetch($value['id']); + print ''; - if ($value['level'] <= 1) + $notdefined=0; + $nb_of_subproduct = $value['nb']; + + print ''; + print ''; + + // Best buying price + print ''; + print $langs->trans("BuyingPriceMinShort").': '; + if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0); + else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; } + } + print ''; - $notdefined=0; - $nb_of_subproduct = $value['nb']; + // For avoid a non-numeric value + $fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0); + $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); + $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - print ''; - print ''; + $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); + $total+=$totalline; - // Best buying price - print ''; + print ''; - // For avoid a non-numeric value - $fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0); - $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); - $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - - $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); - $total+=$totalline; - - print ''; - - // Best selling price - $pricesell=$productstatic->price; - if (! empty($conf->global->PRODUIT_MULTIPRICES)) - { - $pricesell='Variable'; - } - else - { - $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); - $totalsell+=$totallinesell; - } - print ''; - - // Stock - if (! empty($conf->stock->enabled)) print ''; // Real stock - - // Qty + IncDec - if ($user->rights->produit->creer || $user->rights->service->creer) - { - print ''; - print ''; - } - else{ - print ''; - print ''; - } - - print ''."\n"; + // Best selling price + $pricesell=$productstatic->price; + if (! empty($conf->global->PRODUIT_MULTIPRICES)) + { + $pricesell='Variable'; } else { - $hide=''; - if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand - - $class=($class=='impair')?'pair':'impair'; - print ''; - - //$productstatic->ref=$value['label']; - $productstatic->ref=$value['ref']; - print ''; - print ''; - - // Best buying price - print ''; - print ''; - // Best selling price - print ''; - print ''; - - if (! empty($conf->stock->enabled)) print ''; // Real stock - print ''; - print ''; - - print ''."\n"; + $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); + $totalsell+=$totallinesell; } + print ''; + + // Stock + if (! empty($conf->stock->enabled)) print ''; // Real stock + + // Qty + IncDec + if ($user->rights->produit->creer || $user->rights->service->creer) + { + print ''; + print ''; + } + else{ + print ''; + print ''; + } + + print ''."\n"; } - - print ''; - print ''; - print ''; - - // Minimum buying price - print ''; - - print ''; - - // Minimum selling price - print ''; - - print ''; - - // Stock - if (! empty($conf->stock->enabled)) print ''; - - print ''; + + //$productstatic->ref=$value['label']; + $productstatic->ref=$value['ref']; + print ''; + print ''; + + // Best buying price + print ''; + print ''; + // Best selling price + print ''; + print ''; + + if (! empty($conf->stock->enabled)) print ''; // Real stock + print ''; + print ''; + + print ''."\n"; } - print ''; - print ''."\n"; } - else + + print ''; + print ''; + print ''; + + // Minimum buying price + print ''; + + print ''; + + // Minimum selling price + print ''; + + print ''; + + // Stock + if (! empty($conf->stock->enabled)) print ''; + + print ''; - print ''; - print ''; - } - - print '
'.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('Stock').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').'
'.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('Stock').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''; + if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0) { - $class=($class=='impair')?'pair':'impair'; - print '
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''; - if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0) - { - print $langs->trans("BuyingPriceMinShort").': '; - if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0); - else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; } - } - print ''; + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); + print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); - print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '')); - if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency); - else print $langs->trans($pricesell); - print ''.$value['stock'].''.$nb_of_subproduct.''.($value['incdec']==1?'x':'' ).'
'; - for ($i=0; $i < $value['level']; $i++) print '     '; // Add indentation - print $productstatic->getNomUrl(1, 'composition').''.$productstatic->label.'    '.$value['nb'].' 
'; + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '')); + if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency); + else print $langs->trans($pricesell); + print ''.$value['stock'].''.$nb_of_subproduct.''.($value['incdec']==1?'x':'' ).'
'; - print $langs->trans("TotalBuyingPriceMinShort"); - print ''; - if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; - print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency)); - print ''; - print $langs->trans("TotalSellingPriceMinShort"); - print ''; - if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; - print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency)); - print ' '; - if ($user->rights->produit->creer || $user->rights->service->creer) + else { - print ''; + $hide=''; + if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand + + print '
'; + for ($i=0; $i < $value['level']; $i++) print '     '; // Add indentation + print $productstatic->getNomUrl(1, 'composition').''.$productstatic->label.'    '.$value['nb'].' 
'; + print $langs->trans("TotalBuyingPriceMinShort"); + print ''; + if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; + print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency)); + print ''; + print $langs->trans("TotalSellingPriceMinShort"); + print ''; + if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; + print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency)); + print ' '; + if ($user->rights->produit->creer || $user->rights->service->creer) { - $colspan=8; - if (! empty($conf->stock->enabled)) $colspan++; - - print '
'.$langs->trans("None").'
'; - - /*if($user->rights->produit->creer || $user->rights->service->creer) { print ''; - }*/ + } + print ''; + print ''."\n"; + } + else + { + $colspan=8; + if (! empty($conf->stock->enabled)) $colspan++; + + print ''; + print ''.$langs->trans("None").''; + print ''; + } + + print ''; + + /*if($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + }*/ + + print '
'; + print '
'; + - print ''; - //} // Form with product to add if ((empty($action) || $action == 'view' || $action == 'edit' || $action == 'search' || $action == 're-edit') && ($user->rights->produit->creer || $user->rights->service->creer)) diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index b102e6ebad4..7d097b6ecac 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -430,7 +430,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index de928a95c50..7f3e3c947c5 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -51,7 +51,8 @@ dol_include_once("/cron/class/cronjob.class.php"); global $langs, $conf; // Language Management -$langs->loadLangs(array("admin", "cron")); +$langs->loadLangs(array("admin", "cron", "dict")); + @@ -59,6 +60,9 @@ $langs->loadLangs(array("admin", "cron")); * View */ +// current date +$now=dol_now(); + // Check the key, avoid that a stranger starts cron $key = GETPOST('securitykey', 'alpha'); if (empty($key)) @@ -84,15 +88,15 @@ $result=$user->fetch('', $userlogin); if ($result < 0) { echo "User Error:".$user->error; - dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_WARNING); + dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); exit; } else { if (empty($user->id)) { - echo " User user login:".$userlogin." do not exists"; - dol_syslog(" User user login:".$userlogin." do not exists", LOG_WARNING); + echo " User login:".$userlogin." do not exists"; + dol_syslog(" User login:".$userlogin." do not exists", LOG_ERR); exit; } } @@ -103,8 +107,7 @@ $id = GETPOST('id', 'alpha'); // We accept non numeric id. We will filter later. $object = new Cronjob($db); $filter=array(); -if (! empty($id)) -{ +if (! empty($id)) { if (! is_numeric($id)) { echo "Error: Bad value for parameter job id"; @@ -118,7 +121,7 @@ $result = $object->fetch_all('ASC,ASC,ASC', 't.priority,t.entity,t.rowid', 0, 0, if ($result<0) { echo "Error: ".$object->error; - dol_syslog("cron_run_jobs.php fetch Error".$object->error, LOG_WARNING); + dol_syslog("cron_run_jobs.php fetch Error".$object->error, LOG_ERR); exit; } @@ -132,37 +135,76 @@ foreach($object->lines as $val) // TODO Duplicate code. This sequence of code must be shared with code into cron_run_jobs.php script. // current date -$now=dol_now(); $nbofjobs=count($qualifiedjobs); $nbofjobslaunchedok=0; $nbofjobslaunchedko=0; if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) { - // Loop over job + $savconf = dol_clone($conf); + + // Loop over job foreach($qualifiedjobs as $line) { - dol_syslog("cron_run_jobs.php cronjobid: ".$line->id, LOG_WARNING); + dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG); + echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label; - //If date_next_jobs is less of current dat, execute the program, and store the execution time of the next execution in database + // Force reload of setup for the current entity + if ($line->entity != $conf->entity) + { + dol_syslog("cron_run_jobs.php we work on another entity so we reload user and conf", LOG_DEBUG); + echo " -> we change entity so we reload user and conf"; + + $conf->entity = (empty($line->entity)?1:$line->entity); + $conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings + + // Force recheck that user is ok for the entity to process and reload permission for entity + if ($conf->entity != $user->entity && $user->entity != 0) + { + $result=$user->fetch('', $userlogin, '', 0, $conf->entity); + if ($result < 0) + { + echo "\nUser Error: ".$user->error."\n"; + dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); + exit(-1); + } + else + { + if ($result == 0) + { + echo "\nUser login: ".$userlogin." does not exists for entity ".$conf->entity."\n"; + dol_syslog("User login:".$userlogin." does not exists", LOG_ERR); + exit(-1); + } + } + $user->getrights(); + } + } + + //If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) { - dol_syslog("cron_run_jobs.php:: torun line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourtext')." line->dateend:".dol_print_date($line->dateend, 'dayhourtext')." now:".dol_print_date($now, 'dayhourtext')); + echo " - qualified"; + + dol_syslog("cron_run_jobs.php line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc')); $cronjob=new Cronjob($db); $result=$cronjob->fetch($line->id); if ($result<0) { - echo "Error cronjob->fetch: ".$cronjob->error."
\n"; + echo "Error cronjobid: ".$line->id." cronjob->fetch: ".$cronjob->error."\n"; + echo "Failed to fetch job ".$line->id."\n"; dol_syslog("cron_run_jobs.php::fetch Error".$cronjob->error, LOG_ERR); exit; } - // Execut job + // Execute job $result=$cronjob->run_jobs($userlogin); if ($result < 0) { - echo "Error cronjob->run_job: ".$cronjob->error."
\n"; - dol_syslog("cron_run_jobs.php::run_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjobid: ".$line->id." cronjob->run_job: ".$cronjob->error."\n"; + echo "At least one job failed. Go on menu Home-Setup-Admin tools to see result for each job.\n"; + echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; + dol_syslog("cron_run_jobs.php::run_jobs Error".$cronjob->error, LOG_ERR); $nbofjobslaunchedko++; } else @@ -170,16 +212,30 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) $nbofjobslaunchedok++; } + echo " - result of run_jobs = ".$result; + // We re-program the next execution and stores the last execution time for this job $result=$cronjob->reprogram_jobs($userlogin, $now); if ($result<0) { - echo "Error cronjob->reprogram_job: ".$cronjob->error."
\n"; - dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjobid: ".$line->id." cronjob->reprogram_job: ".$cronjob->error."\n"; + echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; + dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR); exit; } + + echo " - reprogrammed\n"; + } + else + { + echo " - not qualified\n"; + + dol_syslog("cron_run_jobs.php job not qualified line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc')); } } + + $conf = $savconf; + echo "Result: ".($nbofjobs)." jobs - ".($nbofjobslaunchedok+$nbofjobslaunchedko)." launched = ".$nbofjobslaunchedok." OK + ".$nbofjobslaunchedko." KO"; } else diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 7eea7e45df6..145df4f9e94 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -355,7 +355,7 @@ if ($action == 'dopayment') if ($paymentmethod == 'paybox') { $PRICE=price2num(GETPOST("newamount"), 'MT'); - $email=GETPOST("email", 'alpha'); + $email=$conf->global->ONLINE_PAYMENT_SENDEMAIL; $thirdparty_id=GETPOST('thirdparty_id', 'int'); $origfulltag=GETPOST("fulltag", 'alpha'); @@ -754,7 +754,7 @@ if (! empty($conf->paypal->enabled)) } if (! empty($conf->paybox->enabled)) { - + print ''."\n"; } if (! empty($conf->stripe->enabled)) { diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index a4a3d71a4a9..27aeca883cc 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -131,7 +131,7 @@ class ActionsCardCompany extends ActionsCardCommon if ($conf->use_javascript_ajax) { $s.=''.$langs->trans("VATIntraCheck").''; - $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { @@ -170,7 +170,7 @@ class ActionsCardCompany extends ActionsCardCommon if ($conf->use_javascript_ajax) { $s.=''.$langs->trans("VATIntraCheck").''; - $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index af134dcd354..d55ea537297 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -126,7 +126,7 @@ if (empty($reshook)) { $langs->load('errors'); $langs->load('companies'); - setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors'); + setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv('MergeOriginThirdparty')), null, 'errors'); } else { @@ -1367,10 +1367,13 @@ else if (! empty($conf->use_javascript_ajax)) { + $widthpopup = 600; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; print "\n"; print ''; print "\n"; @@ -2028,15 +2031,18 @@ else if ($conf->use_javascript_ajax) { - print "\n"; + $widthpopup = 600; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; + print "\n"; print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { @@ -2437,15 +2443,18 @@ else if ($conf->use_javascript_ajax) { + $widthpopup = 600; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; print "\n"; print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index f5202d87b96..aaafc334e9e 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -54,6 +54,7 @@ if (! $vatNumber) else { $vatNumber = preg_replace('/\^\w/', '', $vatNumber); + $vatNumber = str_replace(array(' ', '.'), '', $vatNumber); $countryCode=substr($vatNumber, 0, 2); $vatNumber=substr($vatNumber, 2); @@ -162,7 +163,7 @@ else } print '
'; -print $langs->trans("VATIntraManualCheck", $langs->trans("VATIntraCheckURL"), $langs->trans("VATIntraCheckURL")).'
'; +print $langs->trans("VATIntraManualCheck", $langs->trans("VATIntraCheckURL"), $langs->transnoentitiesnoconv("VATIntraCheckURL")).'
'; print '
'; print '
'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4bec5fc6f49..84bda8abd54 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1642,7 +1642,7 @@ class Societe extends CommonObject $note=trim($note); if (! $note) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("NoteReason")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NoteReason")); return -2; } @@ -1705,7 +1705,7 @@ class Societe extends CommonObject $note=trim($note); if (! $note) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->trans("NoteReason")); + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NoteReason")); return -2; } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 13f179b99cc..b0653c83962 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -35,6 +35,7 @@ require_once '../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; @@ -373,7 +374,7 @@ $sql.= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,"; $sql.= " s2.nom as name2,"; $sql.= " typent.code as typent_code,"; $sql.= " staff.code as staff_code,"; -$sql.= " country.code as country_code,"; +$sql.= " country.code as country_code, country.label as country_label,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " region.code_region as region_code, region.nom as region_name"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) @@ -989,6 +990,8 @@ while ($i < min($num, $limit)) $companystatic->fournisseur=$obj->fournisseur; $companystatic->code_client=$obj->code_client; $companystatic->code_fournisseur=$obj->code_fournisseur; + $companystatic->tva_intra=$obj->tva_intra; + $companystatic->country_code=$obj->country_code; $companystatic->code_compta_client=$obj->code_compta; $companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur; @@ -1091,8 +1094,8 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['country.code_iso']['checked'])) { print ''; - $tmparray=getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + $labelcountry=($obj->country_code && ($langs->trans("Country".$obj->country_code)!="Country".$obj->country_code))?$langs->trans("Country".$obj->country_code):$obj->country_label; + print $labelcountry; print ''; if (! $i) $totalarray['nbfield']++; } @@ -1166,7 +1169,13 @@ while ($i < min($num, $limit)) } if (! empty($arrayfields['s.tva_intra']['checked'])) { - print "".$obj->tva_intra."\n"; + print ""; + print $obj->tva_intra; + if ($obj->tva_intra && ! isValidVATID($companystatic)) + { + print img_warning("BadVATNumber", '', ''); + } + print "\n"; if (! $i) $totalarray['nbfield']++; } // Type diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index ef19f266597..fa868de6e42 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -441,7 +441,7 @@ while ($i < min($num, $limit)) $objectwebsiteaccount->id = $obj->rowid; foreach($objectwebsiteaccount->fields as $key => $val) { - if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index dd2d6524f46..c0a37881cf9 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -573,8 +573,12 @@ $( document ).ready(function() { LoadProducts(0); Refresh(); global->TAKEPOS_NUM_TERMINALS!="1" && $_SESSION["takeposterminal"]=="") print "TerminalsDialog();"; + //IF NO TERMINAL SELECTED + if ($_SESSION["takeposterminal"]=="") + { + if ($conf->global->TAKEPOS_NUM_TERMINALS=="1") $_SESSION["takeposterminal"]=1; + else print "TerminalsDialog();"; + } ?> }); diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index f95940a61a0..c0cd029126d 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -59,19 +59,17 @@ span.butAction, span.butActionDelete { display: inline-block; /* text-align: center; New button are on right of screen */ cursor: pointer; - /*color: #fff !important; - background: rgb(); -border: 1px solid rgb(); -border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); -border-top-right-radius: 0 !important; -border-bottom-right-radius: 0 !important; -border-top-left-radius: 0 !important; -border-bottom-left-radius: 0 !important;*/ } -a.butActionNew>span.fa-plus-circle, a.butActionNew>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } -a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } -a.butActionNew>span.fa-list-alt, a.butActionNew>span.fa-list-alt:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } -a.butActionNewRefused>span.fa-list-alt, a.butActionNewRefused>span.fa-list-alt:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } +a.butActionNew>span.fa-plus-circle, a.butActionNew>span.fa-plus-circle:hover, +span.butActionNew>span.fa-plus-circle, span.butActionNew>span.fa-plus-circle:hover, +a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover, +span.butActionNewRefused>span.fa-plus-circle, span.butActionNewRefused>span.fa-plus-circle:hover, +a.butActionNew>span.fa-list-alt, a.butActionNew>span.fa-list-alt:hover, +span.butActionNew>span.fa-list-alt, span.butActionNew>span.fa-list-alt:hover, +a.butActionNewRefused>span.fa-list-alt, a.butActionNewRefused>span.fa-list-alt:hover, +span.butActionNewRefused>span.fa-list-alt, span.butActionNewRefused>span.fa-list-alt:hover { + padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; +} .butAction:hover { -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a0687454ab9..70496d8689a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -313,7 +313,7 @@ hr { border: 0; border-top: 1px solid #ccc; } -webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); } -.button:disabled, .buttonDelete:disabled { +.button:disabled, .buttonDelete:disabled, .button.disabled { opacity: 0.4; box-shadow: none; -webkit-box-shadow: none; @@ -699,7 +699,7 @@ div.fiche { justify-content: flex-start; } .thumbstat { - min-width: 150px; + min-width: 148px; } .thumbstat150 { min-width: 168px; @@ -1172,6 +1172,9 @@ div.secondcolumn div.box { width: auto; padding-bottom: 6px; } + div.fichetwothirdright div.ficheaddleft { + padding-left: 0; + } div.fichehalfleft { float: none; width: auto; @@ -1820,6 +1823,9 @@ if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { .login_table .tdinputlogin input#securitycode { font-size: 1em; } +.login_main_home { + word-break: break-word; +} .login_main_message { text-align: center; max-width: 570px; @@ -3070,7 +3076,8 @@ ul.noborder li:nth-child(even):not(.liste_titre) { } .boxstats, .boxstats130 { display: inline-block; - margin: 8px; + margin-left: 8px; + margin-right: 8px; margin-top: 5px; margin-bottom: 5px; text-align: center; @@ -3087,7 +3094,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { text-overflow: ellipsis; } .boxstats130 { - width: 158px; + width: 100%; height: 59px; /* padding: 3px; */ } @@ -3096,7 +3103,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { padding-right: 3px; padding-top: 2px; padding-bottom: 2px; - width: 121px; + width: 118px; } .tabBar .fichehalfright .boxstats { padding-top: 8px; @@ -3124,8 +3131,6 @@ ul.noborder li:nth-child(even):not(.liste_titre) { { .boxstats, .boxstats130 { margin: 3px; - /*border: 1px solid #ccc; - box-shadow: none; */ } .boxstats130 { text-align: @@ -3133,19 +3138,19 @@ ul.noborder li:nth-child(even):not(.liste_titre) { .thumbstat { flex: 1 1 110px; margin-bottom: 8px; + min-width: px; /* on screen < 320, we guaranty to have 2 columns */ } .thumbstat150 { flex: 1 1 110px; margin-bottom: 8px; - width: 160px; + min-width: px; /* on screen < 320, we guaranty to have 2 columns */ + max-width: px; /* on screen < 320, we guaranty to have 2 columns */ + /* width: ...px; If I use with, there is trouble on size of flex boxes solved with min + (max that is a little bit higer than min) */ } .dashboardlineindicator { float: left; padding-left: 5px; } - .boxstats130 { - width: 148px; - } .boxstats { width: 111px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a8efdc3f3f3..98618800e39 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -540,7 +540,7 @@ hr { border: 0; border-top: 1px solid #ccc; } -webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); } -.button:disabled, .buttonDelete:disabled { +.button:disabled, .buttonDelete:disabled, .button.disabled { opacity: 0.4; box-shadow: none; -webkit-box-shadow: none; @@ -1361,6 +1361,9 @@ div.fichetwothirdright { browser->layout != 'phone') { print "width: 50%;\n"; } ?> browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> } +div.fichetwothirdright div.ficheaddleft { + padding-left: 20px; +} div.fichehalfleft { browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?> @@ -1404,6 +1407,9 @@ div.secondcolumn div.box { width: auto; padding-bottom: 6px; } + div.fichetwothirdright div.ficheaddleft { + padding-left: 0; + } div.fichehalfleft { float: none; width: auto; @@ -1998,6 +2004,9 @@ form#login { width: 14px; } +.login_main_home { + word-break: break-word; +} .login_main_message { text-align: center; max-width: 570px; @@ -3352,7 +3361,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { } .boxstats130 { width: 135px; - height: 48px; + height: 54px; padding: 3px; } @media only screen and (max-width: 767px) diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 2e9f76ff8a3..824b1f1833e 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -259,7 +259,7 @@ print '
'; /* - * Last tickets + * Latest tickets */ $max = 10; @@ -302,13 +302,8 @@ if ($result) { print '
'; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; print ''; if ($num > 0) { diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 78fca5c7212..d6128037a5c 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -608,7 +608,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } $langs->load("ticket"); diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php index b2b2b1bdfc6..39d32094fe4 100644 --- a/htdocs/variants/generator.php +++ b/htdocs/variants/generator.php @@ -331,7 +331,7 @@ if (! empty($id) || ! empty($ref)) { -

trans('TooMuchCombinationsWarning', $langs->trans('DoNotRemovePreviousCombinations')) ?>

+

trans('TooMuchCombinationsWarning', $langs->transnoentitiesnoconv('DoNotRemovePreviousCombinations')) ?>

> diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index ddeaba0e955..a3e09006b87 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -274,7 +274,6 @@ function getActionComm($authentication, $id) $result=$actioncomm->fetch($id); if ($result > 0) { - $actioncomm_result_fields=array( 'id' => $actioncomm->id, 'ref'=> $actioncomm->ref, @@ -299,19 +298,20 @@ function getActionComm($authentication, $id) 'contactid'=> $actioncomm->contactid, 'projectid'=> $actioncomm->fk_project, 'fk_element'=> $actioncomm->fk_element, - 'elementtype'=> $actioncomm->elementtype); + 'elementtype'=> $actioncomm->elementtype + ); - //Retreive all extrafield for actioncomm - // fetch optionals attributes and labels - $extrafields=new ExtraFields($db); - $extralabels=$extrafields->fetch_name_optionals_label('actioncomm', true); - //Get extrafield values - $actioncomm->fetch_optionals(); + // Retreive all extrafield for actioncomm + // fetch optionals attributes and labels + $extrafields=new ExtraFields($db); + $extralabels=$extrafields->fetch_name_optionals_label('actioncomm', true); + //Get extrafield values + $actioncomm->fetch_optionals(); - foreach($extrafields->attribute_label as $key=>$label) - { - $actioncomm_result_fields=array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key])); - } + foreach($extrafields->attribute_label as $key=>$label) + { + $actioncomm_result_fields=array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key])); + } // Create $objectresp = array( diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index a12bb2ebf11..5405f723a0c 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -489,8 +489,7 @@ class Website extends CommonObject if (! $error && ! empty($this->ref)) { - global $dolibarr_main_data_root; - $pathofwebsite=$dolibarr_main_data_root.'/website/'.$this->ref; + $pathofwebsite=DOL_DATA_ROOT.'/website/'.$this->ref; dol_delete_dir_recursive($pathofwebsite); } @@ -519,7 +518,7 @@ class Website extends CommonObject */ public function createFromClone($user, $fromid, $newref, $newlang = '') { - global $conf, $hookmanager; + global $conf; global $dolibarr_main_data_root; $now = dol_now(); @@ -542,8 +541,9 @@ class Website extends CommonObject $object->fetch($fromid); $oldidforhome=$object->fk_default_home; + $oldref=$object->ref; - $pathofwebsiteold=$dolibarr_main_data_root.'/website/'.$object->ref; + $pathofwebsiteold=$dolibarr_main_data_root.'/website/'.$oldref; $pathofwebsitenew=$dolibarr_main_data_root.'/website/'.$newref; dol_delete_dir_recursive($pathofwebsitenew); @@ -575,8 +575,8 @@ class Website extends CommonObject dolCopyDir($pathofwebsiteold, $pathofwebsitenew, $conf->global->MAIN_UMASK, 0); // Check symlink to medias and restore it if ko - $pathtomedias=DOL_DATA_ROOT.'/medias'; - $pathtomediasinwebsite=$pathofwebsitenew.'/medias'; + $pathtomedias=DOL_DATA_ROOT.'/medias'; // Target + $pathtomediasinwebsite=$pathofwebsitenew.'/medias'; // Source / Link name if (! is_link(dol_osencode($pathtomediasinwebsite))) { dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite); @@ -584,6 +584,15 @@ class Website extends CommonObject $result = symlink($pathtomedias, $pathtomediasinwebsite); } + // Copy images and js dir + $pathofmediasjsold=DOL_DATA_ROOT.'/medias/js/'.$oldref; + $pathofmediasjsnew=DOL_DATA_ROOT.'/medias/js/'.$newref; + dolCopyDir($pathofmediasjsold, $pathofmediasjsnew, $conf->global->MAIN_UMASK, 0); + + $pathofmediasimageold=DOL_DATA_ROOT.'/medias/image/'.$oldref; + $pathofmediasimagenew=DOL_DATA_ROOT.'/medias/image/'.$newref; + dolCopyDir($pathofmediasimageold, $pathofmediasimagenew, $conf->global->MAIN_UMASK, 0); + $newidforhome=0; // Duplicate pages diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 2099102cced..76d063393f8 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -56,6 +56,7 @@ $type_container=GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha'); $section_dir = GETPOST('section_dir', 'alpha'); $file_manager = GETPOST('file_manager', 'alpha'); +$replacesite = GETPOST('replacesite', 'alpha'); if (GETPOST('deletesite', 'alpha')) { $action='deletesite'; } if (GETPOST('delete', 'alpha')) { $action='delete'; } @@ -73,6 +74,7 @@ if (GETPOST('importsite', 'alpha')) { $action='importsite'; } if (GETPOST('createfromclone', 'alpha')) { $action='createfromclone'; } if (GETPOST('createpagefromclone', 'alpha')) { $action='createpagefromclone'; } if (empty($action) && $file_manager) $action='file_manager'; +if (empty($action) && $replacesite) $action='replacesite'; // Load variable for pagination $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -797,13 +799,13 @@ if ($action == 'addcontainer') } // Delete site -if ($action == 'deletesite') +if ($action == 'confirm_deletesite' && $confirm == 'yes') { $error = 0; $db->begin(); - $res = $object->fetch(0, $websitekey); + $res = $object->fetch(GETPOST('id', 'int')); $website = $object; if ($res > 0) @@ -815,13 +817,28 @@ if ($action == 'deletesite') setEventMessages($object->error, $object->errors, 'errors'); } } + if (! $error) + { + if (GETPOST('delete_also_js', 'alpha') == 'on') + { + $pathofwebsitejs=DOL_DATA_ROOT.'/medias/js/'.$object->ref; + + dol_delete_dir_recursive($pathofwebsitejs); + } + if (GETPOST('delete_also_medias', 'alpha') == 'on') + { + $pathofwebsitemedias=DOL_DATA_ROOT.'/medias/image/'.$object->ref; + + dol_delete_dir_recursive($pathofwebsitemedias); + } + } if (! $error) { $db->commit(); - setEventMessages($langs->trans("SiteDeleted", $object->ref, $websitekey), null, 'mesgs'); + setEventMessages($langs->trans("SiteDeleted", $object->ref), null, 'mesgs'); - header("Location: ".$_SERVER["PHP_SELF"]); + header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else @@ -1745,6 +1762,10 @@ if ($action == 'file_manager') { print ''; } +if ($action == 'replacesite') +{ + print ''; +} print '
'; @@ -1809,7 +1830,7 @@ if (! GETPOST('hide_websitemenu')) if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors); $atleastonepage=(is_array($array) && count($array) > 0); - if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) + if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite')) { $disabled=''; if (empty($user->rights->website->write)) $disabled=' disabled="disabled"'; @@ -1817,9 +1838,7 @@ if (! GETPOST('hide_websitemenu')) print '   '; print ''; - //print ''; - print ''; - print ''; + if (! $atleastonepage) { print ''; @@ -1829,11 +1848,16 @@ if (! GETPOST('hide_websitemenu')) print ''; } + //print ''; + print ''; + print ''; + print ''; print '   '; - print ''; + print 'ref.'" class="button nobordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("MediaFiles")).'">'; + //print ''; /*print ''.dol_escape_htmltag($langs->trans("MediaFiles")).''; print ''; */ + + //print ''.dol_escape_htmltag($langs->trans("Replace")).'" name="replacesite">'; + print 'ref.'" class="button nobordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">'; } print '
'; @@ -1860,7 +1887,7 @@ if (! GETPOST('hide_websitemenu')) print '
'; - if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone') + if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite') { $urlext=$virtualurl; $urlint=$urlwithroot.'/public/website/index.php?website='.$websitekey; @@ -1900,10 +1927,10 @@ if (! GETPOST('hide_websitemenu')) print '
'; } - if (in_array($action, array('editcss','editmenu','file_manager'))) + if (in_array($action, array('editcss','editmenu','file_manager','replacesite'))) { - if (preg_match('/^create/', $action) && $action != 'file_manager') print ''; - if (preg_match('/^edit/', $action) && $action != 'file_manager') print ''; + if (preg_match('/^create/', $action) && $action != 'file_manager' && $action != 'replacesite') print ''; + if (preg_match('/^edit/', $action) && $action != 'file_manager' && $action != 'replacesite') print ''; if ($action != 'preview') print ''; } @@ -2026,11 +2053,26 @@ if (! GETPOST('hide_websitemenu')) $websitepage->fetch($pageid); } - if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone') + if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite') { $disabled=''; if (empty($user->rights->website->write)) $disabled=' disabled="disabled"'; + // Confirmation delete site + if ($action == 'deletesite') { + // Create an array for form + $formquestion = array( + array('type' => 'checkbox', 'name' => 'delete_also_js', 'label' => $langs->trans("DeleteAlsoJs"), 'value' => 0), + array('type' => 'checkbox', 'name' => 'delete_also_medias', 'label' => $langs->trans("DeleteAlsoMedias"), 'value' => 0), + //array('type' => 'other','name' => 'newlang','label' => $langs->trans("Language"), 'value' => $formadmin->select_language(GETPOST('newlang', 'az09')?GETPOST('newlang', 'az09'):$langs->defaultlang, 'newlang', 0, null, '', 0, 0, 'minwidth200')), + //array('type' => 'other','name' => 'newwebsite','label' => $langs->trans("WebSite"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0)) + ); + + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id='.$object->id, $langs->trans('DeleteWebsite'), '', 'confirm_deletesite', $formquestion, 0, 1, 200); + + print $formconfirm; + } + // Confirmation to clone if ($action == 'createfromclone') { // Create an array for form @@ -2046,7 +2088,7 @@ if (! GETPOST('hide_websitemenu')) print $formconfirm; } - if ($pageid > 0 && $atleastonepage) // pageid can be set without pages, if homepage of site is set and all page were removed + if ($pageid > 0 && $atleastonepage) // pageid can be set without pages, if homepage of site is set and all pages were removed { // Confirmation to clone if ($action == 'createpagefromclone') { @@ -2113,8 +2155,19 @@ if (! GETPOST('hide_websitemenu')) print ''; print ''; - if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print ''; - else print ''; + // @TODO Move this action into a combo list + if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) + { + //$disabled=' disabled="disabled"'; + //print ''; + print ''; + } + else + { + //$disabled=''; + //print 'ref.'" class="button nobordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'">'; + print ''; + } print ''; print ''; } @@ -2124,7 +2177,7 @@ if (! GETPOST('hide_websitemenu')) print '
'; - if (($pageid > 0 && $atleastonepage) && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) + if (($pageid > 0 && $atleastonepage) && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite')) { $realpage=$urlwithroot.'/public/website/index.php?website='.$websitekey.'&pageref='.$websitepage->pageurl; $pagealias = $websitepage->pageurl; @@ -2155,7 +2208,7 @@ if (! GETPOST('hide_websitemenu')) // TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext } - if (! in_array($action, array('editcss','editmenu','file_manager','createsite','createcontainer','createpagefromclone'))) + if (! in_array($action, array('editcss','editmenu','file_manager','replacesite','createsite','createcontainer','createfromclone','createpagefromclone','deletesite'))) { if (preg_match('/^create/', $action)) print ''; if (preg_match('/^edit/', $action)) print ''; @@ -2815,7 +2868,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') if ($action == 'editfile' || $action == 'file_manager') { print ''."\n"; - print '


'; + print '

'; //print '
'.$langs->trans("FeatureNotYetAvailable").''; $module = 'medias'; @@ -2825,6 +2878,18 @@ if ($action == 'editfile' || $action == 'file_manager') print '
'; } +if ($action == 'replacesite') +{ + print ''."\n"; + print '

'; + + print load_fiche_titre($langs->trans("ReplaceWebsiteContent")); + + print '
'.$langs->trans("FeatureNotYetAvailable").''; + + print '
'; +} + if ($action == 'editmenu') { print ''."\n"; diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 0f4f1fecde7..0f20675cbfc 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -24,17 +24,13 @@ * \ingroup cron * \brief Execute pendings jobs */ -if (! defined('NOTOKENRENEWAL')) - define('NOTOKENRENEWAL', '1'); // Disables token renewal -if (! defined('NOREQUIREMENU')) - define('NOREQUIREMENU', '1'); -if (! defined('NOREQUIREHTML')) - define('NOREQUIREHTML', '1'); -if (! defined('NOREQUIREAJAX')) - define('NOREQUIREAJAX', '1'); -if (! defined('NOLOGIN')) - define('NOLOGIN', '1'); -// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); + +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (! defined('NOLOGIN')) define('NOLOGIN', '1'); + $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); @@ -68,12 +64,14 @@ $userlogin = $argv[2]; $version = DOL_VERSION; $error = 0; +// Language Management +$langs->loadLangs(array('main', 'admin', 'cron', 'dict')); + + /* * Main */ -$langs->loadLangs(array('main','dict')); - // current date $now = dol_now(); @@ -148,31 +146,66 @@ if (! empty($id)) { $result = $object->fetch_all('ASC,ASC,ASC', 't.priority,t.entity,t.rowid', 0, 0, 1, $filter, 0); if ($result < 0) { echo "Error: " . $object->error; - dol_syslog("cron_run_jobs.php:: fetch Error " . $object->error, LOG_ERR); + dol_syslog("cron_run_jobs.php fetch Error " . $object->error, LOG_ERR); exit(- 1); } $qualifiedjobs = array(); foreach ($object->lines as $val) { if (! verifCond($val->test)) + { continue; + } $qualifiedjobs[] = $val; } -// TODO Duplicate. This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. +// TODO Duplicate code. This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. $nbofjobs = count($qualifiedjobs); $nbofjobslaunchedok = 0; $nbofjobslaunchedko = 0; if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) { + $savconf = dol_clone($conf); + // Loop over job foreach ($qualifiedjobs as $line) { - dol_syslog("cron_run_jobs.php cronjobid: " . $line->id . " priority=" . $line->priority . " entity=" . $line->entity . " label=" . $line->label, LOG_DEBUG); + dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG); + echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label; - echo "cron_run_jobs.php cronjobid: " . $line->id . " priority=" . $line->priority . " entity=" . $line->entity . " label=" . $line->label; + // Force reload of setup for the current entity + if ($line->entity != $conf->entity) + { + dol_syslog("cron_run_jobs.php we work on another entity so we reload user and conf", LOG_DEBUG); + echo " -> we change entity so we reload user and conf"; - // If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database + $conf->entity = (empty($line->entity)?1:$line->entity); + $conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings + + // Force recheck that user is ok for the entity to process and reload permission for entity + if ($conf->entity != $user->entity && $user->entity != 0) + { + $result=$user->fetch('', $userlogin, '', 0, $conf->entity); + if ($result < 0) + { + echo "\nUser Error: ".$user->error."\n"; + dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); + exit(-1); + } + else + { + if ($result == 0) + { + echo "\nUser login: ".$userlogin." does not exists for entity ".$conf->entity."\n"; + dol_syslog("User login:".$userlogin." does not exists", LOG_ERR); + exit(-1); + } + } + $user->getrights(); + } + } + + //If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) { echo " - qualified"; @@ -200,7 +233,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) { echo " - result of run_jobs = " . $result; - // we re-program the next execution and stores the last execution time for this job + // We re-program the next execution and stores the last execution time for this job $result = $cronjob->reprogram_jobs($userlogin, $now); if ($result < 0) { echo "Error cronjobid: " . $line->id . " cronjob->reprogram_job: " . $cronjob->error . "\n"; @@ -216,7 +249,11 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) { dol_syslog("cron_run_jobs.php job not qualified line->datenextrun:" . dol_print_date($line->datenextrun, 'dayhourrfc') . " line->datestart:" . dol_print_date($line->datestart, 'dayhourrfc') . " line->dateend:" . dol_print_date($line->dateend, 'dayhourrfc') . " now:" . dol_print_date($now, 'dayhourrfc')); } } -} else { + + $conf = $savconf; +} +else +{ echo "cron_run_jobs.php no qualified job found\n"; } diff --git a/test/phpunit/GetUrlLibTest.php b/test/phpunit/GetUrlLibTest.php index 0e0cfb7d767..61d23a8d5d2 100644 --- a/test/phpunit/GetUrlLibTest.php +++ b/test/phpunit/GetUrlLibTest.php @@ -46,7 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class GetUrlLibTest extends PHPUnit_Framework_TestCase +class GetUrlLibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; @@ -167,6 +167,53 @@ class GetUrlLibTest extends PHPUnit_Framework_TestCase return 1; } + /** + * testGetDomainFromURL + * + * @return int + */ + public function testGetDomainFromURL() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $result=getDomainFromURL('http://localhost'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('localhost', $result, 'Test 0a'); + + $result=getDomainFromURL('http://localhost', 1); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('localhost', $result, 'Test 0b'); + + $result=getDomainFromURL('https://dolimed.com'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('dolimed', $result, 'Test 1'); + + $result=getDomainFromURL('http://www.dolimed.com/screenshots/afile'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('dolimed', $result, 'Test 2'); + + $result=getDomainFromURL('http://www.with.dolimed.com/screenshots/afile'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('dolimed', $result, 'Test 3'); + + $result=getDomainFromURL('https://dolimed.com', 1); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('dolimed.com', $result, 'Test 4'); + + $result=getDomainFromURL('http://www.dolimed.com/screenshots/afile', 1); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('dolimed.com', $result, 'Test 5'); + + $result=getDomainFromURL('http://www.with.dolimed.com/screenshots/afile', 1); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('dolimed.com', $result, 'Test 6'); + + return 1; + } /** * testRemoveHtmlComment
' . $transRecordedType . ''.$langs->trans("FullList").'
' . $transRecordedType . ''.$langs->trans("FullList").'