From b17c44c6653a49256640742364934e27b7b96ed1 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Sun, 16 Sep 2018 16:53:35 +0100 Subject: [PATCH 01/76] Update html.form.class.php Add the ability to sort products by category --- htdocs/core/class/html.form.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index df485ea0ede..dce2192d10d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2013,6 +2013,7 @@ class Form $selectFields = " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; (count($warehouseStatusArray)) ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock"; + $selectFields .= ", pcat.fk_categorie as categorie_product_id"; $sql = "SELECT "; $sql.= $selectFields . $selectFieldsGrouped; @@ -2063,6 +2064,8 @@ class Form if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; } + //Product category + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as pcat ON pcat.fk_product=p.rowid"; $sql.= ' WHERE p.entity IN ('.getEntity('product').')'; if (count($warehouseStatusArray)) @@ -2113,9 +2116,10 @@ class Form { $sql.= ' GROUP BY'.$selectFields; } - $sql.= $db->order("p.ref"); - $sql.= $db->plimit($limit, 0); - + + (! empty($conf->global->PRODUIT_SORT_BY_CATEGORY)) ? $sql.= $db->order("pcat.fk_categorie") : $sql.= $db->order("p.ref"); + $sql.= $db->plimit($limit, 0) + // Build output string dol_syslog(get_class($this)."::select_produits_list search product", LOG_DEBUG); $result=$this->db->query($sql); From 7d25311ce57a9835c8b1577a393acb603a539fab Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Mon, 8 Oct 2018 10:53:36 +0100 Subject: [PATCH 02/76] New : Link to create new element on linked fields --- htdocs/core/class/commonobject.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a11cd3dd49e..0f07feda680 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5799,6 +5799,10 @@ abstract class CommonObject $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath' $showempty=(($required && $default != '')?0:1); $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty); + list($class,$classfile)=explode(':',$param_list[0]); + if(file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php')))$url_path=dol_buildpath(dirname(dirname($classfile)).'/card.php',1); + else $url_path=dol_buildpath(dirname(dirname($classfile)).'/'.$class.'_card.php',1); + $out.=''; } elseif ($type == 'password') { From f0d8a5da9aaae861136c541cc0fb73a7e694063a Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Mon, 8 Oct 2018 12:39:14 +0100 Subject: [PATCH 03/76] Fix: Reminder : TODO Add Javascript code to add input fields contents to new elements urls --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0f07feda680..3c4b19e1c22 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5803,6 +5803,7 @@ abstract class CommonObject if(file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php')))$url_path=dol_buildpath(dirname(dirname($classfile)).'/card.php',1); else $url_path=dol_buildpath(dirname(dirname($classfile)).'/'.$class.'_card.php',1); $out.=''; + //TODO Add Javascript code to add input fields contents to new elements urls } elseif ($type == 'password') { From 9be8c579d0aea997b03701beaedd8975971a5265 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 4 Oct 2018 13:30:37 +0200 Subject: [PATCH 04/76] New massaction to generate PDF --- htdocs/compta/facture/list.php | 1 + htdocs/core/actions_massactions.inc.php | 61 +++++++++++++++++++++++++ htdocs/langs/en_US/main.lang | 2 + 3 files changed, 64 insertions(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 78576e4c00d..7a708e412c7 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -587,6 +587,7 @@ if ($resql) $arrayofmassactions=array( 'validate'=>$langs->trans("Validate"), + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 2bb55264cf9..91ff96a6b00 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1130,6 +1130,67 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == //var_dump($listofobjectthirdparties);exit; } +// Generate document foreach object according to model linked to object +// @TODO : propose model selection +if (! $error && $massaction == 'generate_doc' && $permtoread) +{ + $db->begin(); + + $objecttmp=new $objectclass($db); + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $outputlangs = $langs; + $newlang=''; + + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->thirdparty->default_lang)) $newlang=$objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ... + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) $newlang=$objecttmp->default_lang; // for thirdparty + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + // To be sure vars is defined + if (empty($hidedetails)) $hidedetails=0; + if (empty($hidedesc)) $hidedesc=0; + if (empty($hideref)) $hideref=0; + if (empty($moreparams)) $moreparams=null; + + $result= $objecttmp->generateDocument($objecttmp->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + + if ($result <= 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsGenerated", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordGenerated", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } +} + $parameters['toselect']=$toselect; $parameters['uploaddir']=$uploaddir; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fb2f2a8e9fb..2846434f460 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -86,6 +86,7 @@ GoToWikiHelpPage=Read online help (Internet access needed) GoToHelpPage=Read help RecordSaved=Record saved RecordDeleted=Record deleted +RecordGenerated=Record generated LevelOfFeature=Level of features NotDefined=Not defined DolibarrInHttpAuthenticationSoPasswordUseless=Dolibarr authentication mode is set to %s in configuration file conf.php.
This means that the password database is external to Dolibarr, so changing this field may have no effect. @@ -649,6 +650,7 @@ RecordCreatedSuccessfully=Record created successfully RecordModifiedSuccessfully=Record modified successfully RecordsModified=%s record modified RecordsDeleted=%s record deleted +RecordsGenerated=%s record generated AutomaticCode=Automatic code FeatureDisabled=Feature disabled MoveBox=Move widget From d4d921b1ccc522c1447c240b411e1480d3f513c6 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 7 Oct 2018 20:42:45 +0200 Subject: [PATCH 05/76] Add massaction generate on main lists --- htdocs/comm/propal/list.php | 1 + htdocs/commande/list.php | 1 + htdocs/contrat/list.php | 1 + htdocs/expensereport/list.php | 1 + htdocs/fichinter/list.php | 1 + htdocs/fourn/commande/list.php | 1 + htdocs/fourn/facture/list.php | 1 + htdocs/fourn/product/list.php | 1 + htdocs/product/list.php | 1 + htdocs/projet/list.php | 1 + htdocs/supplier_proposal/list.php | 1 + 11 files changed, 11 insertions(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index dc6e4aff17b..e5995244302 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -453,6 +453,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 558d8186a86..faba02b511d 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -438,6 +438,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), 'cancelorders'=>$langs->trans("Cancel"), diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 96f20fdaf67..815c0f10567 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -364,6 +364,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index d328cd21de2..f820ca8eea1 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -359,6 +359,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 96a1199255c..8acf580ac78 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -269,6 +269,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), //'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 06857526731..b947840c91c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -636,6 +636,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 3fa525415bb..e8a35e62804 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -466,6 +466,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( 'validate'=>$langs->trans("Validate"), + 'generate_doc'=>$langs->trans("Generate"), //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 9927b6b2b5d..56cb4cc2b01 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -117,6 +117,7 @@ if ($fourn_id) $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 28f08035198..3452efddd72 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -403,6 +403,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index a93fac0edbd..c0bdf351c4d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -438,6 +438,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), // 'presend'=>$langs->trans("SendByMail"), // 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 2fcb296b433..4a65a3b6b65 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -381,6 +381,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), //'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); From ff92572d5645c61964e1502180bf6cb9357c6b15 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Thu, 18 Oct 2018 17:03:49 +0200 Subject: [PATCH 06/76] add insurance amount on loan --- .../install/mysql/migration/8.0.0-9.0.0.sql | 3 ++ htdocs/install/mysql/tables/llx_loan.sql | 1 + htdocs/loan/card.php | 18 ++++++++- htdocs/loan/class/loan.class.php | 16 +++++--- htdocs/loan/createschedule.php | 37 ++++++++++++++----- htdocs/loan/payment/payment.php | 6 +-- 6 files changed, 62 insertions(+), 19 deletions(-) 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 09908ac86f5..dd2b55e17ca 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 @@ -129,3 +129,6 @@ CREATE TABLE llx_takepos_floor_tables( UPDATE llx_c_payment_term SET decalage = nbjour, nbjour = 0 where decalage IS NULL AND type_cdr = 2; + +ALTER TABLE llx_loan ADD COLUMN insurance_amount double(24,8) DEFAULT 0; + diff --git a/htdocs/install/mysql/tables/llx_loan.sql b/htdocs/install/mysql/tables/llx_loan.sql index 7277fa85d47..1fca2af50ba 100644 --- a/htdocs/install/mysql/tables/llx_loan.sql +++ b/htdocs/install/mysql/tables/llx_loan.sql @@ -28,6 +28,7 @@ create table llx_loan fk_bank integer, capital double(24,8) default 0 NOT NULL, + insurance_amount double(24,8) default 0, datestart date, dateend date, nbterm real, diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 25651ac842a..2a6708655a8 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -135,6 +135,7 @@ if (empty($reshook)) $object->note_private = GETPOST('note_private','none'); $object->note_public = GETPOST('note_public','none'); $object->fk_project = GETPOST('projectid','int'); + $object->insurance_amount = GETPOST('insurance_amount', 'int'); $accountancy_account_capital = GETPOST('accountancy_account_capital'); $accountancy_account_insurance = GETPOST('accountancy_account_insurance'); @@ -148,7 +149,7 @@ if (empty($reshook)) if ($id <= 0) { $error++; - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($object->db->lastqueryerror, $object->errors, 'errors'); $action = 'create'; } } @@ -301,6 +302,9 @@ if ($action == 'create') // Rate print ''.$langs->trans("Rate").' %'; + // insurance amount + print ''.$langs->trans("Insurance").''; + // Project if (! empty($conf->projet->enabled)) { @@ -495,6 +499,18 @@ if ($id > 0) { print ''.$langs->trans("LoanCapital").''.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).''; } + + // Insurance + if ($action == 'edit') + { + print ''.$langs->trans("Insurance").''; + print ''; + print ''; + } + else + { + print ''.$langs->trans("Insurance").''.price($object->insurance_amount,0,$outputlangs,1,-1,-1,$conf->currency).''; + } // Date start print ''.$langs->trans("DateStart").""; diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 0e4542b1d20..3805704fbb9 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -66,6 +66,8 @@ class Loan extends CommonObject public $date_creation; public $date_modification; public $date_validation; + + public $insurance_amount; /** * @var int Bank ID @@ -106,7 +108,7 @@ class Loan extends CommonObject */ function fetch($id) { - $sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public,"; + $sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public, l.insurance_amount,"; $sql.= " l.paid, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest, l.fk_projet as fk_project"; $sql.= " FROM ".MAIN_DB_PREFIX."loan as l"; $sql.= " WHERE l.rowid = ".$id; @@ -129,6 +131,7 @@ class Loan extends CommonObject $this->rate = $obj->rate; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; + $this->insurance_amount = $obj->insurance_amount; $this->paid = $obj->paid; $this->account_capital = $obj->accountancy_account_capital; @@ -169,6 +172,8 @@ class Loan extends CommonObject // clean parameters $newcapital=price2num($this->capital,'MT'); + if (empty($this->insurance_amount)) $this->insurance_amount = 0; + $newinsuranceamount=price2num($this->insurance_amount, 'MT'); if (isset($this->note_private)) $this->note_private = trim($this->note_private); if (isset($this->note_public)) $this->note_public = trim($this->note_public); if (isset($this->account_capital)) $this->account_capital = trim($this->account_capital); @@ -205,7 +210,7 @@ class Loan extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."loan (label, fk_bank, capital, datestart, dateend, nbterm, rate, note_private, note_public,"; $sql.= " accountancy_account_capital, accountancy_account_insurance, accountancy_account_interest, entity,"; - $sql.= " datec, fk_projet, fk_user_author)"; + $sql.= " datec, fk_projet, fk_user_author, insurance_amount)"; $sql.= " VALUES ('".$this->db->escape($this->label)."',"; $sql.= " '".$this->db->escape($this->fk_bank)."',"; $sql.= " '".price2num($newcapital)."',"; @@ -221,7 +226,8 @@ class Loan extends CommonObject $sql.= " ".$conf->entity.","; $sql.= " '".$this->db->idate($now)."',"; $sql.= " ".(empty($this->fk_project)?'NULL':$this->fk_project).","; - $sql.= " ".$user->id; + $sql.= " ".$user->id.","; + $sql.= " '".price2num($newinsuranceamount)."'"; $sql.= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -339,7 +345,8 @@ class Loan extends CommonObject $sql.= " accountancy_account_insurance = '".$this->db->escape($this->account_insurance)."',"; $sql.= " accountancy_account_interest = '".$this->db->escape($this->account_interest)."',"; $sql.= " fk_projet=".(empty($this->fk_project)?'NULL':$this->fk_project).","; - $sql.= " fk_user_modif = ".$user->id; + $sql.= " fk_user_modif = ".$user->id.","; + $sql.= " insurance_amount = '".price2num($this->db->escape($this->insurance_amount))."'"; $sql.= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -549,7 +556,6 @@ class Loan extends CommonObject { $sql = 'SELECT l.rowid, l.datec, l.fk_user_author, l.fk_user_modif,'; $sql.= ' l.tms'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'loan as l'; $sql.= ' WHERE l.rowid = '.$id; dol_syslog(get_class($this).'::info', LOG_DEBUG); diff --git a/htdocs/loan/createschedule.php b/htdocs/loan/createschedule.php index 7cfd54ab998..7a68d3e38a8 100644 --- a/htdocs/loan/createschedule.php +++ b/htdocs/loan/createschedule.php @@ -35,7 +35,7 @@ $object = new Loan($db); $object->fetch($loanid); // Load translation files required by the page -$langs->loadLangs(array("loan")); +$langs->loadLangs(array("compta","bills","loan")); if ($action == 'createecheancier') { @@ -45,6 +45,7 @@ if ($action == 'createecheancier') { $date = GETPOST('hi_date'.$i,'int'); $mens = GETPOST('mens'.$i); $int = GETPOST('hi_interets'.$i); + $insurance = GETPOST('hi_insurance'.$i); $echeance = new LoanSchedule($db); @@ -53,10 +54,10 @@ if ($action == 'createecheancier') { $echeance->tms = dol_now(); $echeance->datep = $date; $echeance->amount_capital = $mens-$int; - $echeance->amount_insurance = 0; + $echeance->amount_insurance = $insurance; $echeance->amount_interest = $int; $echeance->fk_typepayment = 3; - $echeance->fk_bank = 1; + $echeance->fk_bank = 0; $echeance->fk_user_creat = $user->id; $echeance->fk_user_modif = $user->id; $result=$echeance->create($user); @@ -75,11 +76,13 @@ if ($action == 'updateecheancier') { $mens = GETPOST('mens'.$i); $int = GETPOST('hi_interets'.$i); $id = GETPOST('hi_rowid'.$i); + $insurance = GETPOST('hi_insurance'.$i); + $echeance = new LoanSchedule($db); $echeance->fetch($id); $echeance->tms = dol_now(); $echeance->amount_capital = $mens-$int; - $echeance->amount_insurance = 0; + $echeance->amount_insurance = $insurance; $echeance->amount_interest = $int; $echeance->fk_user_modif = $user->id; $result= $echeance->update($user,0); @@ -143,26 +146,33 @@ if(count($echeance->lines)>0) } print ''; print ''; -print ''; print ''; print ''; -Print ''; -Print ''; +Print ''; +Print ''; +print ''; Print ''; -Print ''; Print ''; +if (count($echeance->lines)>0) print ''; print ''."\n"; if ($object->nbterm > 0 && count($echeance->lines)==0) { $i=1; $capital = $object->capital; + $insurance = $object->insurance_amount/$object->nbterm; + $insurance = price2num($insurance, 'MT'); + $regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm)); while($i <$object->nbterm+1) { $mens = price2num($echeance->calcMonthlyPayments($capital, $object->rate/100, $object->nbterm-$i+1), 'MT'); @@ -172,8 +182,9 @@ if ($object->nbterm > 0 && count($echeance->lines)==0) print ''; print ''; print ''; - print ''; + print ''; print ''; + print ''; print ''; print ''."\n"; $i++; @@ -184,6 +195,9 @@ elseif(count($echeance->lines)>0) { $i=1; $capital = $object->capital; + $insurance = $object->insurance_amount/$object->nbterm; + $insurance = price2num($insurance, 'MT'); + $regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm)); foreach ($echeance->lines as $line){ $mens = $line->amount_capital+$line->amount_insurance+$line->amount_interest; $int = $line->amount_interest; @@ -191,13 +205,16 @@ elseif(count($echeance->lines)>0) print ''; print ''; print ''; + print ''; + print ''; if($line->datep > dol_now()){ print ''; }else{ print ''; } - print ''; + print ''; + print ''; print ''."\n"; $i++; $capital = $cap_rest; diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 08937c1f389..ba6650c9c03 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -264,7 +264,7 @@ if ($action == 'create') print ''; print ''; print ''; - print ''; + print ''; print ''; if($line->datep > dol_now()){ print ''; @@ -221,7 +222,7 @@ elseif(count($echeance->lines)>0) print ''; print ''; print ''."\n"; $i++; From 582608cc572a982deb02a3969d8765898793dbe5 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Fri, 19 Oct 2018 15:36:13 +0200 Subject: [PATCH 09/76] manage fk_bank on loanschedule --- htdocs/loan/class/paymentloan.class.php | 1 + htdocs/loan/payment/card.php | 3 +++ htdocs/loan/payment/payment.php | 26 ++++++++++++++++++++++--- htdocs/loan/schedule.php | 14 ++++++++++--- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index c4c29c99dce..7bed069cec2 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -530,6 +530,7 @@ class PaymentLoan extends CommonObject $result = $this->db->query($sql); if ($result) { + $this->fk_bank = $id_bank; return 1; } else diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 919139bd6e3..110ad8d891c 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -54,6 +54,9 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->loan->del { $db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."loan_schedule SET fk_bank = 0 WHERE fk_bank = ".$payment->fk_bank; + $db->query($sql); + $result = $payment->delete($user); if ($result > 0) { diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index ba6650c9c03..2d81f95d034 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -24,6 +24,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; +require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; @@ -32,6 +33,7 @@ $langs->loadLangs(array("bills","loan")); $chid=GETPOST('id','int'); $action=GETPOST('action','aZ09'); $cancel=GETPOST('cancel','alpha'); +$line_id = GETPOST('line_id', 'int'); // Security check $socid=0; @@ -43,6 +45,17 @@ if ($user->societe_id > 0) $loan = new Loan($db); $loan->fetch($chid); +if (!empty($line_id)) +{ + $line = new LoanSchedule($db); + $res = $line->fetch($line_id); + if ($res > 0){ + $amount_capital = price($line->amount_capital); + $amount_insurance = price($line->amount_insurance); + $amount_interest = price($line->amount_interest); + } +} + /* * Actions */ @@ -121,6 +134,12 @@ if ($action == 'add_payment') setEventMessages($payment->error, $payment->errors, 'errors'); $error++; } + elseif(isset($line)) + { + $line->fk_bank = $payment->fk_bank; + $line->update($user); + } + } if (! $error) @@ -161,6 +180,7 @@ if ($action == 'create') print ''; print ''; print ''; + print ''; print ''; dol_fiche_head(); @@ -264,7 +284,7 @@ if ($action == 'create') print ''; print ''; @@ -204,17 +205,19 @@ elseif(count($echeance->lines)>0) $insurance = $object->insurance_amount/$object->nbterm; $insurance = price2num($insurance, 'MT'); $regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm)); + $printed = false; foreach ($echeance->lines as $line){ $mens = $line->amount_capital+$line->amount_insurance+$line->amount_interest; $int = $line->amount_interest; - $cap_rest = price2num($capital - ($mens-$int), 'MT'); $insu = ($insurance+(($i == 1) ? $regulInsurance : 0)); + $cap_rest = price2num($capital - ($mens-$int-$insu), 'MT'); + print ''; print ''; print ''; print ''; print ''; - if($line->datep > dol_now()){ + if($line->datep > dol_now() && empty($line->fk_bank)){ print ''; }else{ print ''; @@ -222,7 +225,12 @@ elseif(count($echeance->lines)>0) print ''; print ''; print ''."\n"; $i++; From 6a3661586ffdf9d6b3aa7b7d1ff471ea0d3b0644 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Fri, 19 Oct 2018 16:12:21 +0200 Subject: [PATCH 10/76] create payment for the last loanschedule --- htdocs/loan/card.php | 2 +- htdocs/loan/payment/payment.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 8fef98075b1..c8da0262f38 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -795,7 +795,7 @@ if ($id > 0) // Emit payment if ($object->paid == 0 && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write) { - print ''.$langs->trans("DoPayment").''; + print ''.$langs->trans("DoPayment").''; } // Classify 'paid' diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 2d81f95d034..b38a058126f 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -34,6 +34,7 @@ $chid=GETPOST('id','int'); $action=GETPOST('action','aZ09'); $cancel=GETPOST('cancel','alpha'); $line_id = GETPOST('line_id', 'int'); +$last=GETPOST('last'); // Security check $socid=0; @@ -45,6 +46,26 @@ if ($user->societe_id > 0) $loan = new Loan($db); $loan->fetch($chid); +if($last) +{ + $ls = new LoanSchedule($db); + // grab all loanschedule + $res = $ls->fetchAll($chid); + if ($res > 0) + { + foreach ($ls->lines as $l) + { + // get the last unpaid loanschedule + if (empty($l->fk_bank)) + { + $line_id = $l->id; + break; + } + } + } + +} + if (!empty($line_id)) { $line = new LoanSchedule($db); From 44b317e03e9dd9b4b87945904627ec66021915f0 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Fri, 19 Oct 2018 16:49:32 +0200 Subject: [PATCH 11/76] fix display --- htdocs/loan/schedule.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index 9fb5a4397ee..30ba126aefb 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -207,10 +207,10 @@ elseif(count($echeance->lines)>0) $regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm)); $printed = false; foreach ($echeance->lines as $line){ - $mens = $line->amount_capital+$line->amount_insurance+$line->amount_interest; + $mens = $line->amount_capital+$line->amount_interest; $int = $line->amount_interest; $insu = ($insurance+(($i == 1) ? $regulInsurance : 0)); - $cap_rest = price2num($capital - ($mens-$int-$insu), 'MT'); + $cap_rest = price2num($capital - ($mens-$int), 'MT'); print ''; print ''; From bfadd39e8cda84dd477e8812829c177e71a19154 Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Fri, 19 Oct 2018 12:46:54 +0100 Subject: [PATCH 12/76] Fix: Grant right to child classes to use Category methods --- htdocs/categories/class/categorie.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index a9432234793..97bceaf082c 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -65,7 +65,7 @@ class Categorie extends CommonObject * * @note This array should be remove in future, once previous constants are moved to the string value. Deprecated */ - private $MAP_ID = array( + protected $MAP_ID = array( 'product' => 0, 'supplier' => 1, 'customer' => 2, @@ -93,7 +93,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - private $MAP_CAT_FK = array( + protected $MAP_CAT_FK = array( 'product' => 'product', 'customer' => 'soc', 'supplier' => 'soc', @@ -109,7 +109,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - private $MAP_CAT_TABLE = array( + protected $MAP_CAT_TABLE = array( 'product' => 'product', 'customer' => 'societe', 'supplier' => 'fournisseur', @@ -125,7 +125,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - private $MAP_OBJ_CLASS = array( + protected $MAP_OBJ_CLASS = array( 'product' => 'Product', 'customer' => 'Societe', 'supplier' => 'Fournisseur', @@ -141,7 +141,7 @@ class Categorie extends CommonObject * * @note Move to const array when PHP 5.6 will be our minimum target */ - private $MAP_OBJ_TABLE = array( + protected $MAP_OBJ_TABLE = array( 'product' => 'product', 'customer' => 'societe', 'supplier' => 'societe', @@ -931,7 +931,7 @@ class Categorie extends CommonObject * * @return int <0 if KO, >0 if OK */ - private function load_motherof() + protected function load_motherof() { // phpcs:enable global $conf; From 759b2b6ccff6100edbfb11259bc9d17a8c1878d6 Mon Sep 17 00:00:00 2001 From: atm-john Date: Thu, 25 Oct 2018 21:39:22 +0200 Subject: [PATCH 13/76] Extend import option to Order's card and Propal's card --- htdocs/comm/propal/card.php | 90 +++++++++++++++++- htdocs/commande/card.php | 91 ++++++++++++++++++- .../tpl/ajax/objectlinked_lineimport.tpl.php | 8 +- 3 files changed, 186 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 1e6df0b014f..a0aa864ebc6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -695,6 +695,88 @@ if (empty($reshook)) } } } + + // add lines from objectlinked + elseif($action == 'import_lines_from_object' + && $user->rights->propal->creer + && $object->statut == Propal::STATUS_DRAFT + ) + { + $fromElement = GETPOST('fromelement'); + $fromElementid = GETPOST('fromelementid'); + $importLines = GETPOST('line_checkbox'); + + if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid)) + { + if($fromElement == 'commande') + { + dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); + $lineClassName = 'OrderLine'; + } + elseif($fromElement == 'propal') + { + dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); + $lineClassName = 'PropaleLigne'; + } + $nextRang = count($object->lines) + 1; + $importCount = 0; + $error = 0; + foreach($importLines as $lineId) + { + $lineId = intval($lineId); + $originLine = new $lineClassName($db); + if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0) + { + $originLine->fetch_optionals($lineId); + $desc = $originLine->desc; + $pu_ht = $originLine->subprice; + $qty = $originLine->qty; + $txtva = $originLine->tva_tx; + $txlocaltax1 = $originLine->localtax1_tx; + $txlocaltax2 = $originLine->localtax2_tx; + $fk_product = $originLine->fk_product; + $remise_percent = $originLine->remise_percent; + $date_start = $originLine->date_start; + $date_end = $originLine->date_end; + $ventil = 0; + $info_bits = $originLine->info_bits; + $fk_remise_except = $originLine->fk_remise_except; + $price_base_type='HT'; + $pu_ttc=0; + $type = $originLine->product_type; + $rang=$nextRang++; + $special_code = $originLine->special_code; + $origin = $originLine->element; + $origin_id = $originLine->id; + $fk_parent_line=0; + $fk_fournprice=$originLine->fk_fournprice; + $pa_ht = $originLine->pa_ht; + $label = $originLine->label; + $array_options = $originLine->array_options; + $situation_percent = 100; + $fk_prev_id = ''; + $fk_unit = $originLine->fk_unit; + $pu_ht_devise = $originLine->multicurrency_subprice; + + $res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label,$date_start, $date_end,$array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise, $fk_remise_except); + + if($res > 0){ + $importCount++; + }else{ + $error++; + } + } + else{ + $error++; + } + } + + if($error) + { + setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors'); + } + } + } include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; @@ -2490,7 +2572,13 @@ if ($action == 'create') // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('propal')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + $compatibleImportElementsList = false; + if($user->rights->propal->creer && $object->statut == Propal::STATUS_DRAFT) + { + $compatibleImportElementsList = array('commande','propal'); // import from linked elements + } + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList); // Show online signature link $useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 75b949ff203..4e12c32e65b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1319,6 +1319,88 @@ if (empty($reshook)) exit(); } + // add lines from objectlinked + if($action == 'import_lines_from_object' + && $user->rights->commande->creer + && $object->statut == Commande::STATUS_DRAFT + ) + { + $fromElement = GETPOST('fromelement'); + $fromElementid = GETPOST('fromelementid'); + $importLines = GETPOST('line_checkbox'); + + if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid)) + { + if($fromElement == 'commande') + { + dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); + $lineClassName = 'OrderLine'; + } + elseif($fromElement == 'propal') + { + dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); + $lineClassName = 'PropaleLigne'; + } + $nextRang = count($object->lines) + 1; + $importCount = 0; + $error = 0; + foreach($importLines as $lineId) + { + $lineId = intval($lineId); + $originLine = new $lineClassName($db); + if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0) + { + $originLine->fetch_optionals($lineId); + $desc = $originLine->desc; + $pu_ht = $originLine->subprice; + $qty = $originLine->qty; + $txtva = $originLine->tva_tx; + $txlocaltax1 = $originLine->localtax1_tx; + $txlocaltax2 = $originLine->localtax2_tx; + $fk_product = $originLine->fk_product; + $remise_percent = $originLine->remise_percent; + $date_start = $originLine->date_start; + $date_end = $originLine->date_end; + $ventil = 0; + $info_bits = $originLine->info_bits; + $fk_remise_except = $originLine->fk_remise_except; + $price_base_type='HT'; + $pu_ttc=0; + $type = $originLine->product_type; + $rang=$nextRang++; + $special_code = $originLine->special_code; + $origin = $originLine->element; + $origin_id = $originLine->id; + $fk_parent_line=0; + $fk_fournprice=$originLine->fk_fournprice; + $pa_ht = $originLine->pa_ht; + $label = $originLine->label; + $array_options = $originLine->array_options; + $situation_percent = 100; + $fk_prev_id = ''; + $fk_unit = $originLine->fk_unit; + $pu_ht_devise = $originLine->multicurrency_subprice; + + $res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $date_start, $date_end, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label,$array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise); + + if($res > 0){ + $importCount++; + }else{ + $error++; + } + } + else{ + $error++; + } + } + + if($error) + { + setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors'); + } + } + } + // Actions when printing a doc from card include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; @@ -2639,7 +2721,14 @@ if ($action == 'create' && $user->rights->commande->creer) // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + $compatibleImportElementsList = false; + if($user->rights->commande->creer + && $object->statut == Commande::STATUS_DRAFT) + { + $compatibleImportElementsList = array('commande','propal'); // import from linked elements + } + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList); // Show online payment link $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)); diff --git a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php index ad32f1b9aa8..73981ed017c 100644 --- a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php +++ b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php @@ -22,6 +22,12 @@ if (empty($conf) || ! is_object($conf)) exit; } +$objectUrl = $object->getNomUrl(0,'',0,1); +if($object->element == 'propal') +{ + $objectUrl = DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id; +} + ?> @@ -47,7 +53,7 @@ $(document).ready(function(){ }); - var $dialog = $('
') + var $dialog = $('
') .load( page + " #tablelines", function() { $("#" + formId + " #tablelines").prop("id", "ajaxloaded_tablelines"); // change id attribute From f29ee25ea751400a84c80a6f519052a3aa587a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 11:06:45 +0200 Subject: [PATCH 14/76] remove fieldlabel and add fieldeditkey --- htdocs/commande/card.php | 142 ++++++++++------------------------ htdocs/core/tpl/notes.tpl.php | 3 +- 2 files changed, 44 insertions(+), 101 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f468bd4b146..3036722c3aa 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1687,7 +1687,7 @@ if ($action == 'create' && $user->rights->commande->creer) if (! empty($conf->multicurrency->enabled)) { print '
'; - print ''; + print ''; print ''; @@ -2074,13 +2074,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Date print ''; print ''; print ''; // Source reason (why we have an ordrer) - print ''; print ''; } - if ($totalVolume) - { + if ($totalVolume) { print ''; print ''; print '"; @@ -1140,7 +1140,7 @@ else print ''; } - // Password + // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''; @@ -1267,7 +1267,7 @@ else // Categories if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) { - print ''; + print ''; print '
'; +$colspan = 6; +if (count($echeance->lines)>0) $colspan++; +print ''; print $langs->trans("FinancialCommitment"); print '
'.$langs->trans("Term").''.$langs->trans("Date").''.$langs->trans("Term").''.$langs->trans("Date").''.$langs->trans("Insurance"); +Print ''.$langs->trans("InterestAmount").''.$langs->trans("Amount").''.$langs->trans("InterestAmount").''.$langs->trans("CapitalRemain"); print ' ('.price2num($object->capital).')'; print ''; print ''.$langs->trans('DoPayment').'
' . $i .'' . dol_print_date(dol_time_plus_duree($object->datestart, $i-1, 'm'),'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0),0,'',1).' €'.price($int,0,'',1).' €'.price($cap_rest).' €
' . $i .'' . dol_print_date($line->datep,'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0),0,'',1).' €'.price($int,0,'',1).' €' . price($mens) . ' €'.price($int,0,'',1).' €'.price($cap_rest).' €'.$langs->trans('DoPayment').'
'; if ($sumpaid < $loan->capital) { - print $langs->trans("LoanCapital") .': '; + print $langs->trans("LoanCapital") .': '; } else { @@ -273,7 +273,7 @@ if ($action == 'create') print '
'; if ($sumpaid < $loan->capital) { - print $langs->trans("Insurance") .': '; + print $langs->trans("Insurance") .': '; } else { @@ -282,7 +282,7 @@ if ($action == 'create') print '
'; if ($sumpaid < $loan->capital) { - print $langs->trans("Interest") .': '; + print $langs->trans("Interest") .': '; } else { From f0849aaf81e42b2725dc1403008d108191ee0216 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Thu, 18 Oct 2018 17:16:38 +0200 Subject: [PATCH 07/76] schedule as a tab --- htdocs/core/lib/loan.lib.php | 5 + htdocs/loan/card.php | 2 +- htdocs/loan/schedule.php | 242 +++++++++++++++++++++++++++++++++++ 3 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 htdocs/loan/schedule.php diff --git a/htdocs/core/lib/loan.lib.php b/htdocs/core/lib/loan.lib.php index b61c57b4bc3..0b617bb0d5c 100644 --- a/htdocs/core/lib/loan.lib.php +++ b/htdocs/core/lib/loan.lib.php @@ -40,6 +40,11 @@ function loan_prepare_head($object) $head[$tab][1] = $langs->trans('Card'); $head[$tab][2] = 'card'; $tab++; + + $head[$tab][0] = DOL_URL_ROOT.'/loan/schedule.php?loanid='.$object->id; + $head[$tab][1] = $langs->trans('FinancialCommitment'); + $head[$tab][2] = 'FinancialCommitment'; + $tab++; // Show more tabs from modules // Entries must be declared in modules descriptor with line diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 2a6708655a8..8fef98075b1 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -787,7 +787,7 @@ if ($id > 0) // Edit if ($object->paid == 0 && $user->rights->loan->write) { - print ''.$langs->trans('CreateCalcSchedule').''; + // print ''.$langs->trans('CreateCalcSchedule').''; print ''.$langs->trans("Modify").''; } diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php new file mode 100644 index 00000000000..58130c2c26a --- /dev/null +++ b/htdocs/loan/schedule.php @@ -0,0 +1,242 @@ + + * Copyright (C) 2018 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 . + */ + +/** + * \file htdocs/loan/createschedule.php + * \ingroup loan + * \brief Schedule card + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php'; + +$loanid = GETPOST('loanid', 'int'); +$action = GETPOST('action','aZ09'); + +$object = new Loan($db); +$object->fetch($loanid); + +// Load translation files required by the page +$langs->loadLangs(array("compta","bills","loan")); + +$title = $langs->trans("Loan") . ' - ' . $langs->trans("Card"); +$help_url = 'EN:Module_Loan|FR:Module_Emprunt'; +llxHeader("",$title,$help_url); + +$head=loan_prepare_head($object); +dol_fiche_head($head, 'FinancialCommitment', $langs->trans("Loan"), -1, 'bill'); + +if ($action == 'createecheancier') { + + $i=1; + while($i <$object->nbterm+1){ + + $date = GETPOST('hi_date'.$i,'int'); + $mens = GETPOST('mens'.$i); + $int = GETPOST('hi_interets'.$i); + $insurance = GETPOST('hi_insurance'.$i); + + $echeance = new LoanSchedule($db); + + $echeance->fk_loan = $object->id; + $echeance->datec = dol_now(); + $echeance->tms = dol_now(); + $echeance->datep = $date; + $echeance->amount_capital = $mens-$int; + $echeance->amount_insurance = $insurance; + $echeance->amount_interest = $int; + $echeance->fk_typepayment = 3; + $echeance->fk_bank = 0; + $echeance->fk_user_creat = $user->id; + $echeance->fk_user_modif = $user->id; + $result=$echeance->create($user); + if ($result<0) { + setEventMessages($echeance->error, $echeance->errors,'errors'); + } + $i++; + } +} + +if ($action == 'updateecheancier') { + + $i=1; + while($i <$object->nbterm+1){ + + $mens = GETPOST('mens'.$i); + $int = GETPOST('hi_interets'.$i); + $id = GETPOST('hi_rowid'.$i); + $insurance = GETPOST('hi_insurance'.$i); + + $echeance = new LoanSchedule($db); + $echeance->fetch($id); + $echeance->tms = dol_now(); + $echeance->amount_capital = $mens-$int; + $echeance->amount_insurance = $insurance; + $echeance->amount_interest = $int; + $echeance->fk_user_modif = $user->id; + $result= $echeance->update($user,0); + if ($result<0) { + setEventMessages(null, $echeance->errors,'errors'); + } + $i++; + } +} + +$echeance = new LoanSchedule($db); +$echeance->fetchAll($object->id); + +$var = ! $var; + + +?> + +'; +print ''; +print ''; +if(count($echeance->lines)>0) +{ + print ''; +}else{ + print ''; +} +print ''; +print ''; +$colspan = 6; +if (count($echeance->lines)>0) $colspan++; +print ''; +print ''; + +print ''; +Print ''; +Print ''; +print ''; +Print ''; +Print ''; +if (count($echeance->lines)>0) print ''; +print ''."\n"; + +if ($object->nbterm > 0 && count($echeance->lines)==0) +{ + $i=1; + $capital = $object->capital; + $insurance = $object->insurance_amount/$object->nbterm; + $insurance = price2num($insurance, 'MT'); + $regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm)); + while($i <$object->nbterm+1) + { + $mens = price2num($echeance->calcMonthlyPayments($capital, $object->rate/100, $object->nbterm-$i+1), 'MT'); + $int = ($capital*($object->rate/12))/100; + $int = price2num($int, 'MT'); + $cap_rest = price2num($capital - ($mens-$int), 'MT'); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''."\n"; + $i++; + $capital = $cap_rest; + } +} +elseif(count($echeance->lines)>0) +{ + $i=1; + $capital = $object->capital; + $insurance = $object->insurance_amount/$object->nbterm; + $insurance = price2num($insurance, 'MT'); + $regulInsurance = price2num($object->insurance_amount - ($insurance * $object->nbterm)); + foreach ($echeance->lines as $line){ + $mens = $line->amount_capital+$line->amount_insurance+$line->amount_interest; + $int = $line->amount_interest; + $cap_rest = price2num($capital - ($mens-$int), 'MT'); + print ''; + print ''; + print ''; + print ''; + print ''; + if($line->datep > dol_now()){ + print ''; + }else{ + print ''; + } + + print ''; + print ''; + print ''."\n"; + $i++; + $capital = $cap_rest; + } +} + +print '
'; +print $langs->trans("FinancialCommitment"); +print '
'.$langs->trans("Term").''.$langs->trans("Date").''.$langs->trans("Insurance"); +Print ''.$langs->trans("InterestAmount").''.$langs->trans("Amount").''.$langs->trans("CapitalRemain"); +print ' ('.price2num($object->capital).')'; +print ''; +print ''.$langs->trans('DoPayment').'
' . $i .'' . dol_print_date(dol_time_plus_duree($object->datestart, $i-1, 'm'),'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0),0,'',1).' €'.price($int,0,'',1).' €'.price($cap_rest).' €
' . $i .'' . dol_print_date($line->datep,'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0),0,'',1).' €'.price($int,0,'',1).' €' . price($mens) . ' €'.price($cap_rest).' €'; + print ''.$langs->trans('DoPayment').''; + print '
'; +print '
'; +print '
'; +if (count($echeance->lines)==0) $label = $langs->trans("Create"); +else $label = $langs->trans("Save"); +print '
'; +print ''; + +// End of page +llxFooter(); +$db->close(); From db2937715df40c1177567a03906482b760e059e3 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Thu, 18 Oct 2018 17:27:08 +0200 Subject: [PATCH 08/76] create payment from loan schedule --- htdocs/loan/schedule.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index 58130c2c26a..d775ebaca84 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -208,10 +208,11 @@ elseif(count($echeance->lines)>0) $mens = $line->amount_capital+$line->amount_insurance+$line->amount_interest; $int = $line->amount_interest; $cap_rest = price2num($capital - ($mens-$int), 'MT'); + $insu = ($insurance+(($i == 1) ? $regulInsurance : 0)); print '
' . $i .'' . dol_print_date($line->datep,'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0),0,'',1).' €'.price($insu,0,'',1).' €'.price($int,0,'',1).' €'.price($cap_rest).' €'; - print ''.$langs->trans('DoPayment').''; + print ''.$langs->trans('DoPayment').''; print '
'; if ($sumpaid < $loan->capital) { - print $langs->trans("LoanCapital") .': '; + print $langs->trans("LoanCapital") .': '; } else { @@ -273,7 +293,7 @@ if ($action == 'create') print '
'; if ($sumpaid < $loan->capital) { - print $langs->trans("Insurance") .': '; + print $langs->trans("Insurance") .': '; } else { @@ -282,7 +302,7 @@ if ($action == 'create') print '
'; if ($sumpaid < $loan->capital) { - print $langs->trans("Interest") .': '; + print $langs->trans("Interest") .': '; } else { diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index d775ebaca84..9fb5a4397ee 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -184,6 +184,7 @@ if ($object->nbterm > 0 && count($echeance->lines)==0) $mens = price2num($echeance->calcMonthlyPayments($capital, $object->rate/100, $object->nbterm-$i+1), 'MT'); $int = ($capital*($object->rate/12))/100; $int = price2num($int, 'MT'); + $insu = ($insurance+(($i == 1) ? $regulInsurance : 0)); $cap_rest = price2num($capital - ($mens-$int), 'MT'); print '
' . $i .'
' . $i .'' . dol_print_date($line->datep,'day') . ''.price($insu,0,'',1).' €'.price($int,0,'',1).' €' . price($mens) . ' €'.price($cap_rest).' €'; - print ''.$langs->trans('DoPayment').''; + if (!empty($line->fk_bank)) print $langs->trans('Paid'); + elseif (!$printed) + { + print ''.$langs->trans('DoPayment').''; + $printed = true; + } print '
' . $i .'
'.fieldLabel('Currency','multicurrency_code').''.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).''; print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print '
'; - print ''; - - if ($action != 'editdate' && $object->brouillon) - print ''; - print '
'; - print $langs->trans('Date'); - print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; + $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("Date", 'date', '', $object, $editenable); print '
'; if ($action == 'editdate') { print '
'; @@ -2100,12 +2095,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Delivery date planed print '
'; - print ''; - if ($action != 'editdate_livraison') - print ''; - print '
'; - print $langs->trans('DateDeliveryPlanned'); - print 'id . '">' . img_edit($langs->trans('SetDeliveryDate'), 1) . '
'; + $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable); print '
'; if ($action == 'editdate_livraison') { print ''; @@ -2125,13 +2116,9 @@ if ($action == 'create' && $user->rights->commande->creer) // Shipping Method if (! empty($conf->expedition->enabled)) { - print '
'; - print ''; - if ($action != 'editshippingmethod' && $user->rights->commande->creer) - print ''; - print '
'; - print $langs->trans('SendingMethod'); - print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
'; + print '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable); print ''; if ($action == 'editshippingmethod') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); @@ -2144,15 +2131,12 @@ if ($action == 'create' && $user->rights->commande->creer) // Warehouse if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + $langs->load('stocks'); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct=new FormProduct($db); print '
'; - print ''; - if ($action != 'editwarehouse' && $user->rights->commande->creer) - print ''; - print '
'; - print $langs->trans('Warehouse'); - print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).'
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); print '
'; if ($action == 'editwarehouse') { $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); @@ -2165,12 +2149,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Terms of payment print '
'; - print ''; - if ($action != 'editconditions') - print ''; - print '
'; - print $langs->trans('PaymentConditionsShort'); - print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable); print '
'; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id', 1); @@ -2183,12 +2163,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Mode of payment print '
'; - print ''; - if ($action != 'editmode') - print ''; - print '
'; - print $langs->trans('PaymentMode'); - print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable); print '
'; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); @@ -2203,12 +2179,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Multicurrency code print '
'; - print ''; - if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) - print ''; - print '
'; - print fieldLabel('Currency','multicurrency_code'); - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; + $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable); print '
'; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); @@ -2220,12 +2192,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Multicurrency rate print '
'; - print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) - print ''; - print '
'; - print fieldLabel('CurrencyRate','multicurrency_tx'); - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; + $editenable = $user->rights->commande->creer && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable); print '
'; if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { if($action == 'actualizemulticurrencyrate') { @@ -2244,13 +2212,9 @@ if ($action == 'create' && $user->rights->commande->creer) } // Delivery delay - print '
'; - print ''; - if ($action != 'editavailability') - print ''; - print '
'; - print $langs->trans('AvailabilityPeriod'); - print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '
'; + print '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable); print ''; if ($action == 'editavailability') { $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); @@ -2260,13 +2224,9 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'; - print ''; - if ($action != 'editdemandreason') - print ''; - print '
'; - print $langs->trans('Channel'); - print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '
'; + print '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable); print ''; if ($action == 'editdemandreason') { $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); @@ -2277,13 +2237,9 @@ if ($action == 'create' && $user->rights->commande->creer) // TODO Order mode (how we receive order). Not yet implemented /* - print '
'; - print ''; - if ($action != 'editinputmode') - print ''; - print '
'; - print $langs->trans('SourceMode'); - print 'id . '">' . img_edit($langs->trans('SetInputMode'), 1) . '
'; + print '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable); print ''; if ($action == 'editinputmode') { $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1); @@ -2296,15 +2252,13 @@ if ($action == 'create' && $user->rights->commande->creer) $tmparray=$object->getTotalWeightVolume(); $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; - if ($totalWeight) - { + if ($totalWeight) { print '
'.$langs->trans("CalculatedWeight").''; print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); print '
'.$langs->trans("CalculatedVolume").''; print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); @@ -2314,15 +2268,10 @@ if ($action == 'create' && $user->rights->commande->creer) // TODO How record was recorded OrderMode (llx_c_input_method) // Incoterms - if (!empty($conf->incoterm->enabled)) - { + if (!empty($conf->incoterm->enabled)) { print '
'; - print '
'; - print $langs->trans('IncotermLabel'); - print ''; - if ($user->rights->commande->creer) print ''.img_edit().''; - else print ' '; - print '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable); print '
'; if ($action != 'editincoterm') @@ -2337,15 +2286,10 @@ if ($action == 'create' && $user->rights->commande->creer) } // Bank Account - if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) - { - print '
'; - print ''; - print '
'; - print $langs->trans('BankAccount'); - print ''; - if ($action != 'editbankaccount' && $user->rights->commande->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) { + print '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable); print ''; if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); @@ -2446,12 +2390,11 @@ if ($action == 'create' && $user->rights->commande->creer) */ $result = $object->getLinesArray(); - print ' + print ' - - '; + '; if (! empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) { include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; @@ -2518,10 +2461,11 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } // Create event - /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a - // "workflow" action so should appears somewhere else on - // page. + /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) { + // Add hidden condition because this is not a + // "workflow" action so should appears somewhere else on + // page. print '' . $langs->trans("AddAction") . ''; }*/ diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 39132dd1af7..0d2151ab62d 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -18,8 +18,7 @@ */ // Protection to avoid direct call of template -if (empty($object) || ! is_object($object)) -{ +if (empty($object) || ! is_object($object)) { print "Error, template page can't be called as URL"; exit; } From d67c40dffe3cb637d1d51335d430fad9fa652585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 13:01:01 +0200 Subject: [PATCH 15/76] remove fieldlabel and add fieldeditkey --- htdocs/adherents/card.php | 28 +++++++--------------------- htdocs/commande/card.php | 25 +++++++++++++++---------- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index e7b36b77ad9..84667d9032e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1017,7 +1017,7 @@ else // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - print '
' . fieldLabel('Categories', 'memcars') . ''; + print '
' .$form->editfieldkey("Categories", 'memcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1); print $form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%'); print "
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Password").'pass).'">
' . fieldLabel('Categories', 'memcats') . '
' . $form->editfieldkey("Categories", 'memcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); $c = new Categorie($db); @@ -1620,11 +1620,8 @@ else if (! empty($conf->societe->enabled)) { print '
'; - print ''; - if ($action != 'editthirdparty' && $user->rights->adherent->creer) print ''; - print '
'; - print $langs->trans("LinkedToDolibarrThirdParty"); - print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; + $editenable = $user->rights->adherent->creer; + print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable); print '
'; if ($action == 'editthirdparty') { @@ -1658,19 +1655,8 @@ else // Login Dolibarr print '
'; - print ''; - if ($action != 'editlogin' && $user->rights->adherent->creer) - { - print ''; - } - print '
'; - print $langs->trans("LinkedToDolibarrUser"); - print ''; - if ($user->rights->user->user->creer) - { - print 'id.'">'.img_edit($langs->trans('SetLinkToUser'),1).''; - } - print '
'; + $editenable = $user->rights->adherent->creer && $user->rights->user->user->creer; + print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable); print '
'; if ($action == 'editlogin') { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3036722c3aa..d02e5c28858 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -106,7 +106,8 @@ $permissionedit = $user->rights->commande->creer; // Used by the include of ac */ $parameters = array('socid' => $socid); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +// Note that $action and $object may be modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) @@ -419,10 +420,11 @@ if (empty($reshook)) // Hooks $parameters = array('objFrom' => $srcobject); - $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been - // modified by hook - if ($reshook < 0) + // Note that $action and $object may have be modified by hook + $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); + if ($reshook < 0) { $error++; + } } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -1669,7 +1671,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Other attributes $parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); print $hookmanager->resPrint; if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); @@ -1969,7 +1972,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Call Hook formConfirm $parameters = array('lineid' => $lineid); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; @@ -2095,7 +2099,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Delivery date planed print '
'; - $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + $editenable = $user->rights->commande->creer; print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable); print ''; if ($action == 'editdate_livraison') { @@ -2420,7 +2424,8 @@ if ($action == 'create' && $user->rights->commande->creer) $object->formAddObjectLine(1, $mysoc, $soc); $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); } } print '
'; @@ -2437,8 +2442,8 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'; $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been - // modified by hook + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); if (empty($reshook)) { // Send if ($object->statut > Commande::STATUS_DRAFT) { From 9c7ec434b74398862336246527e20817f99b1ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 13:48:30 +0200 Subject: [PATCH 16/76] remove fieldlabel and add fieldeditkey --- htdocs/admin/holiday.php | 1 - htdocs/commande/card.php | 6 +-- htdocs/societe/card.php | 84 +++++++++++++++++++++------------------- 3 files changed, 48 insertions(+), 43 deletions(-) diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index c02c9bd480d..81becbaa37c 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -513,7 +513,6 @@ print ''; print '
'; print ''; - } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d02e5c28858..026e7ac2c3f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2319,17 +2319,17 @@ if ($action == 'create' && $user->rights->commande->creer) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT - print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; + print '' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . ''; print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; // Multicurrency Amount VAT - print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; + print '' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . ''; print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; // Multicurrency Amount TTC - print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; + print '' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . ''; print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 5935a1d01a1..941bd263b73 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1148,7 +1148,7 @@ else } else { - print ''.fieldLabel('ThirdPartyName','name').''; + print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; } print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; print ''; @@ -1161,11 +1161,11 @@ else // If javascript on, we show option individual if ($conf->use_javascript_ajax) { - print ''.fieldLabel('FirstName','firstname').''; + print ''.$form->editfieldkey('FirstName', 'firstname', '', $object, 0).''; print ''; print ''; // Title - print ''.fieldLabel('UserTitle','civility_id').''; + print ''.$form->editfieldkey('UserTitle', 'civility_id', '', $object, 0).''; print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').''; print ''; } @@ -1175,7 +1175,7 @@ else print ''; // Prospect/Customer - print ''.fieldLabel('ProspectCustomer','customerprospect',1).''; + print ''.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; print ''; $selected=GETPOST('client','int')!=''?GETPOST('client','int'):$object->client; print ''; - print ''.fieldLabel('CustomerCode','customer_code').''; + print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print ''; - print ''; // Barcode if (! empty($conf->barcode->enabled)) { - print ''; + print ''; print ''; } // Address - print ''; + print ''; print ''; // Zip / Town - print ''; // Country - print ''; @@ -1264,11 +1264,11 @@ else { if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { - print ''; + print ''; print ''; - print ''; + print ''; print ''; if (! empty($conf->socialnetworks->enabled)) @@ -1287,27 +1287,33 @@ else // Skype if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) { - print ''; - print ''; + print ''; + print ''; } // Twitter if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) { - print ''; - print ''; + print ''; + print ''; } // Facebook if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) { - print ''; - print ''; + print ''; + print ''; } } // Phone / Fax - print ''; + print ''; print ''; - print ''; + print ''; print ''; // Prof ids @@ -1322,7 +1328,7 @@ else if (($j % 2) == 0) print ''; $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - print ''; @@ -1334,11 +1340,11 @@ else if ($j % 2 == 1) print ''; // Vat is used - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; // Legal Form - print ''; + print ''; print ''; // Capital - print ''; + print ''; print ''; if (! empty($conf->global->MAIN_MULTILANGS)) { - print ''; print ''; @@ -1429,7 +1435,7 @@ else // Assign a sale representative print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; @@ -1453,7 +1459,7 @@ else // Customer //if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { - print '"; @@ -1461,7 +1467,7 @@ else // Supplier //if ($object->fournisseur) { - print '"; @@ -1472,7 +1478,7 @@ else if (! empty($conf->multicurrency->enabled)) { print ''; - print ''; + print ''; print ''; @@ -1489,7 +1495,7 @@ else // Ajout du logo print ''; - print ''; + print ''; print ''; From c92a2084f1e5a14ec80e9567e6c7bbddbb7edcec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 14:50:27 +0200 Subject: [PATCH 17/76] remove fieldlabel and add fieldeditkey --- htdocs/commande/card.php | 2 +- htdocs/societe/card.php | 91 +++++++++++++++++++--------------------- 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 026e7ac2c3f..6ea34c1c619 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -420,7 +420,7 @@ if (empty($reshook)) // Hooks $parameters = array('objFrom' => $srcobject); - // Note that $action and $object may have be modified by hook + // Note that $action and $object may be modified by hook $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); if ($reshook < 0) { $error++; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 941bd263b73..4530b5a61c1 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -12,6 +12,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Ferran Marcet + * 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 @@ -1742,7 +1743,7 @@ else } // Name - print ''; + print ''; print ''; // Alias names (commercial, trademark or alias names) @@ -1752,7 +1753,7 @@ else // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; print ''; - print '
'; $tmpcode=$object->code_client; if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); @@ -1202,7 +1202,7 @@ else { // Supplier print '
'.fieldLabel('Supplier','fournisseur',1).''; + print ''.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; $default = -1; if (! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default=1; print $form->selectyesno("fournisseur", (GETPOST('fournisseur','int')!=''?GETPOST('fournisseur','int'):(GETPOST("type",'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type",'alpha') == '' ? 1 : 0)); @@ -1210,7 +1210,7 @@ else print ''; if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) { - print fieldLabel('SupplierCode','supplier_code'); + print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); } print ''; if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) @@ -1228,33 +1228,33 @@ else } // Status - print '
'.fieldLabel('Status','status').''; + print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),1); print '
'.fieldLabel('Gencod','barcode').'
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; print '
'.fieldLabel('Address','address').'
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.fieldLabel('Zip','zipcode').''; + print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); - print ''.fieldLabel('Town','town').''; + print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); print '
'.fieldLabel('Country','selectcountry_id').''; + print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('Region-State','state_id').''; + print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; } else { - print '
'.fieldLabel('State','state_id').''; + print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; } if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code); @@ -1277,9 +1277,9 @@ else } // Email / Web - print '
'.fieldLabel('EMail','email',$conf->global->SOCIETE_EMAIL_MANDATORY).'
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).'
'.fieldLabel('Web','url').'
'.$form->editfieldkey('Web', 'url', '', $object, 0).'
'.fieldLabel('Skype','skype').'skype).'">
'.$form->editfieldkey('Skype', 'skype', '', $object, 0).''; + print 'skype).'">'; + print '
'.fieldLabel('Twitter','twitter').'twitter).'">
'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).''; + print 'twitter).'">'; + print '
'.fieldLabel('Facebook','facebook').'facebook).'">
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).''; + print 'facebook).'">'; + print '
'.fieldLabel('Phone','phone').'
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.fieldLabel('Fax','fax').''.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.fieldLabel($idprof,$key, (empty($conf->global->$idprof_mandatory)?0:1)).''; + print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', (empty($conf->global->$idprof_mandatory)?0:1)).''; print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); print '
'.fieldLabel('VATIsUsed','assujtva_value').'
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; print $form->selectyesno('assujtva_value', GETPOSTISSET('assujtva_value')?GETPOST('assujtva_value','int'):1, 1); // Assujeti par defaut en creation print ''.fieldLabel('VATIntra','intra_vat').''.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; $s = ''; @@ -1391,18 +1397,18 @@ else } // Type - Size - print '
'.fieldLabel('ThirdPartyType','typent_id').''."\n"; + print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''."\n"; $sortparam=(empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''.fieldLabel('Staff','effectif_id').''; + print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('JuridicalStatus','forme_juridique_code').'
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; if ($object->country_id) { @@ -1415,13 +1421,13 @@ else print '
'.fieldLabel('Capital','capital').'
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '; print ''.$langs->trans("Currency".$conf->currency).'
'.fieldLabel('DefaultLang','default_lang').''."\n"; + print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1,0,0,'maxwidth200onsmartphone'); print '
'.fieldLabel('AllocateCommercial','commercial_id').''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); // Note: If user has no right to "see all thirdparties", we for selection of sale representative to him, so after creation he can see the record. @@ -1440,7 +1446,7 @@ else if (!empty($conf->incoterm->enabled)) { print '
'.fieldLabel('IncotermLabel','incoterm_id').''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print '
' . fieldLabel('CustomersCategoriesShort', 'custcats') . ''; + print '
' . $form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%"); print "
' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . ''; + print '
' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%"); print "
'.fieldLabel('Currency','multicurrency_code').''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1); print '
'.fieldLabel('Logo','photoinput').''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; print ''; print '
'.fieldLabel('ThirdPartyName','name',1).'
'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0, 'string', '', 1).'
'.fieldLabel('Prefix','prefix').''; + print '
'.$form->editfieldkey('Prefix', 'prefix', '', $object, 0).''; // It does not change the prefix mode using the auto numbering prefix if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) { @@ -1767,14 +1768,14 @@ else } // Prospect/Customer - print '
'.fieldLabel('ProspectCustomer','customerprospect',1).'
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''.fieldLabel('CustomerCode','customer_code').''; + print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print ''; - print ''; print ''; + print ''; print ''; } // Status - print ''; // Address - print ''; + print ''; print ''; // Zip / Town - print ''; // Country - print ''; @@ -1878,11 +1879,11 @@ else { if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { - print ''; + print ''; print ''; - print ''; + print ''; print ''; if (! empty($conf->socialnetworks->enabled)) @@ -1900,27 +1901,27 @@ else // Skype if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) { - print ''; + print ''; print ''; } // Twitter if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) { - print ''; + print ''; print ''; } // Facebook if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) { - print ''; + print ''; print ''; } } // Phone / Fax - print ''; + print ''; print ''; - print ''; + print ''; print ''; // Prof ids @@ -1935,12 +1936,8 @@ else if (($j % 2) == 0) print ''; $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - if (empty($conf->global->$idprof_mandatory) || ! $object->isACompany()) - print ''; if (($j % 2) == 1) print ''; $j++; @@ -1950,7 +1947,7 @@ else if ($j % 2 == 1) print ''; // VAT is used - print ''; @@ -1958,7 +1955,7 @@ else //TODO: Place into a function to control showing by country or study better option if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - print ''; - print ''; + print ''; print ''; // Type - Size - print ''; - print ''; // Juridical type - print ''; // Capital - print ''; + print ''; print ''; // Assign a Name print ''; - print ''; + print ''; print ''; print ''; @@ -2077,7 +2074,7 @@ else if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { // Customer - print ''; + print ''; print '"; // Supplier - print ''; + print ''; print ''; - print ''; + print ''; print ''; @@ -2124,9 +2121,9 @@ else // Webservices url/key if (!empty($conf->syncsupplierwebservices->enabled)) { - print ''; + print ''; print ''; - print ''; + print ''; print ''; } @@ -2134,7 +2131,7 @@ else if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; @@ -2142,7 +2139,7 @@ else // Logo print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; From 546a353e58145c04454e29b17198f64fcfbdf646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 15:16:01 +0200 Subject: [PATCH 18/76] remove fieldlabel and add fieldeditkey --- htdocs/expedition/shipment.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 920b5508e59..bd520f5f9d2 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -551,17 +551,17 @@ if ($id > 0 || ! empty($ref)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT - print ''; + print ''; print ''; print ''; // Multicurrency Amount VAT - print ''; + print ''; print ''; print ''; // Multicurrency Amount TTC - print ''; + print ''; print ''; print ''; } From 42a9abad56635612efc84e9cdbfef9f445a8ae4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 17:45:29 +0200 Subject: [PATCH 19/76] remove fieldlabel and add fieldeditkey --- htdocs/compta/bank/ligne.php | 2 +- htdocs/compta/facture/card.php | 12 +++---- htdocs/compta/facture/prelevement.php | 7 ++-- htdocs/compta/salaries/card.php | 26 +++++++-------- htdocs/contact/card.php | 47 +++++++++++++-------------- htdocs/datapolicy/admin/setupmail.php | 5 +-- htdocs/hrm/establishment/card.php | 36 ++++++++++++-------- htdocs/supplier_proposal/card.php | 15 ++++----- htdocs/user/card.php | 26 +++++++-------- 9 files changed, 90 insertions(+), 86 deletions(-) diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 1587c5c10e8..2d4ac69c288 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -596,7 +596,7 @@ if ($result) $langs->load('categories'); // Bank line - print '"; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 050f8786c3a..ab654ad2e7c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3196,7 +3196,7 @@ if ($action == 'create') if (! empty($conf->multicurrency->enabled)) { print ''; - print ''; + print ''; print ''; @@ -3899,7 +3899,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print '
'; if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) @@ -1805,13 +1806,13 @@ else || (! empty($conf->supplier_proposal->enabled) && ! empty($user->rights->supplier_proposal->lire))) { print '
'.fieldLabel('Supplier','fournisseur',1).''; + print ''.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; print $form->selectyesno("fournisseur",$object->fournisseur,1); print ''; if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) { - print fieldLabel('SupplierCode','supplier_code'); + print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); } print ''; if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) @@ -1844,31 +1845,31 @@ else // Barcode if (! empty($conf->barcode->enabled)) { - print '
'.fieldLabel('Gencod','barcode').'
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; print '
'.fieldLabel('Status','status').''; + print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$object->status); print '
'.fieldLabel('Address','address').'
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.fieldLabel('Zip','zipcode').''; + print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth50onsmartphone'); - print ''.fieldLabel('Town','town').''; + print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); print '
'.fieldLabel('Country','selectcounty_id').''; + print '
'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('Region-State','state_id').''; + print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; } else { - print '
'.fieldLabel('State','state_id').''; + print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; } print $formcompany->select_state($object->state_id,$object->country_code); @@ -1890,9 +1891,9 @@ else } // EMail / Web - print '
'.fieldLabel('EMail','email',(! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'
'.fieldLabel('Web','url').'
'.$form->editfieldkey('Web', 'url', '', $object, 0).'
'.fieldLabel('Skype','skype').'
'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'
'.fieldLabel('Twitter','twitter').'
'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'
'.fieldLabel('Facebook','facebook').'
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'
'.fieldLabel('Phone','phone').'
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.fieldLabel('Fax','fax').''.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.fieldLabel($idprof,$key).''; - else - print ''.fieldLabel($idprof,$key).''; - - print $formcompany->get_input_id_prof($i,$key,$object->$key,$object->country_code); + print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', ! (empty($conf->global->$idprof_mandatory) || ! $object->isACompany())).''; + print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); print '
'.fieldLabel('VATIsUsed','assujtva_value').''; + print '
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; print $form->selectyesno('assujtva_value',$object->tva_assuj,1); print '
'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; + print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); if(! isOnlyOneLocalTax(1)) { @@ -1968,7 +1965,7 @@ else } print ''.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; + print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); if (! isOnlyOneLocalTax(2)) { @@ -1980,7 +1977,7 @@ else } elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") { - print '
'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; + print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); if(! isOnlyOneLocalTax(1)) { @@ -1992,7 +1989,7 @@ else } elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") { - print '
'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; + print '
'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); if(! isOnlyOneLocalTax(2)) { @@ -2004,7 +2001,7 @@ else } // VAT Code - print '
'.fieldLabel('VATIntra','intra_vat').'
'.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; $s =''; @@ -2034,29 +2031,29 @@ else print '
'.fieldLabel('ThirdPartyType','typent_id').''; + print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''; print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''.fieldLabel('Staff','effectif_id').''; + print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('JuridicalStatus','forme_juridique_code').''; + print '
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); print '
'.fieldLabel('Capital','capital').'
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '.$langs->trans("Currency".$conf->currency).'
'.fieldLabel('AllocateCommercial','commercial_id').''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); $arrayselected = GETPOST('commercial', 'array'); @@ -2067,7 +2064,7 @@ else // Default language if (! empty($conf->global->MAIN_MULTILANGS)) { - print '
'.fieldLabel('DefaultLang','default_lang').''."\n"; + print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; print $formadmin->select_language($object->default_lang,'default_lang',0,0,1); print '
' . fieldLabel('CustomersCategoriesShort', 'custcats') . '
' . $form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); $c = new Categorie($db); @@ -2090,7 +2087,7 @@ else print "
' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . '
' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); $c = new Categorie($db); @@ -2107,7 +2104,7 @@ else if (! empty($conf->multicurrency->enabled)) { print '
'.fieldLabel('Currency','multicurrency_code').''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1); print '
'.fieldLabel('WebServiceURL','webservices_url').'
'.$form->editfieldkey('WebServiceURL', 'webservices_url', '', $object, 0).''.fieldLabel('WebServiceKey','webservices_key').''.$form->editfieldkey('WebServiceKey', 'webservices_key', '', $object, 0).'
'.fieldLabel('IncotermLabel','incoterm_id').''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print '
'.fieldLabel('Logo','photoinput').''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; if ($object->logo) print $form->showphoto('societe',$object); $caneditfield=1; @@ -2530,7 +2527,7 @@ else if (! empty($conf->multicurrency->enabled)) { print '
'.fieldLabel('Currency','multicurrency_code').''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code,1) : ''; print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '
' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '
' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '
' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('RubriquesTransactions', 'custcats') . ''; + print '
' . $form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1); print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%"); print "
'.fieldLabel('Currency','multicurrency_code').''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print '
'; print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print ''; @@ -3915,7 +3915,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print '
'; - print fieldLabel('Currency','multicurrency_code'); + print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; @@ -4001,17 +4001,17 @@ else if ($id > 0 || ! empty($ref)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT - print ''; + print ''; print ''; print ''; // Multicurrency Amount VAT - print ''; + print ''; print ''; print ''; // Multicurrency Amount TTC - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index d7766268989..7c8ffb7d417 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet + * 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 @@ -402,17 +403,17 @@ if ($object->id > 0) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT - print ''; + print ''; print ''; print ''; // Multicurrency Amount VAT - print ''; + print ''; print ''; print ''; // Multicurrency Amount TTC - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index f50d940a51a..c67982ed9c5 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -1,8 +1,8 @@ - * Copyright (C) 2014 Laurent Destailleur - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Charlie BENKE +/* Copyright (C) 2011-2018 Alexandre Spangaro + * Copyright (C) 2014 Laurent Destailleur + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Charlie BENKE * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -255,44 +255,44 @@ if ($action == 'create') // Date payment print ''; // Date value for bank print ''; // Employee print ''; // Label print ''; // Date start period print ''; // Date end period print ''; // Amount print ''; @@ -312,14 +312,14 @@ if ($action == 'create') if (! empty($conf->banque->enabled)) { print ''; } // Type payment print ''; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index a43127c9a32..e995352c38d 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -227,7 +227,7 @@ if (empty($reshook)) $action = 'create'; } else { // Categories association - $contcats = GETPOST( 'contcats', 'array'); + $contcats = GETPOST('contcats', 'array'); $object->setCategories($contcats); } } @@ -383,10 +383,10 @@ if (empty($reshook)) // First we delete all categories association $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_contact'; $sql .= ' WHERE fk_socpeople = ' . $object->id; - $db->query( $sql ); + $db->query($sql); // Then we add the associated categories - $categories = GETPOST( 'contcats', 'array'); + $categories = GETPOST('contcats', 'array'); $object->setCategories($categories); $object->old_lastname=''; @@ -669,19 +669,19 @@ else // Skype if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) { - print ''; + print ''; print ''; } // Twitter if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) { - print ''; + print ''; print ''; } // Facebook if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) { - print ''; + print ''; print ''; } } @@ -694,10 +694,9 @@ else // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - print '"; } @@ -938,19 +937,19 @@ else // Skype if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) { - print ''; + print ''; print ''; } // Twitter if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) { - print ''; + print ''; print ''; } // Facebook if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) { - print ''; + print ''; print ''; } } @@ -980,16 +979,16 @@ else print ''; // Categories - if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) { - print ''; + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + print ''; print '"; } @@ -1101,10 +1100,10 @@ else $password=$generated_password; // Create a form array - $formquestion=array( - array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), - array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password), - //array('label' => $form->textwithpicto($langs->trans("Type"),$langs->trans("InternalExternalDesc")), 'type' => 'select', 'name' => 'intern', 'default' => 1, 'values' => array(0=>$langs->trans('Internal'),1=>$langs->trans('External'))) + $formquestion = array( + array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), + array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password), + //array('label' => $form->textwithpicto($langs->trans("Type"),$langs->trans("InternalExternalDesc")), 'type' => 'select', 'name' => 'intern', 'default' => 1, 'values' => array(0=>$langs->trans('Internal'),1=>$langs->trans('External'))) ); $text=$langs->trans("ConfirmCreateContact").'
'; if (! empty($conf->societe->enabled)) @@ -1176,7 +1175,7 @@ else if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { print ''; print ''; } diff --git a/htdocs/datapolicy/admin/setupmail.php b/htdocs/datapolicy/admin/setupmail.php index 214f673a15f..f50fa08d31c 100644 --- a/htdocs/datapolicy/admin/setupmail.php +++ b/htdocs/datapolicy/admin/setupmail.php @@ -91,9 +91,6 @@ $head = datapolicyAdminPrepareHead(); dol_fiche_head($head, 'settings', '', -1, "datapolicy@datapolicy"); - - - print "
'; - print fieldLabel('CurrencyRate','multicurrency_tx'); + print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '
' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '
' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '
' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '
' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '
' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '
' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'; - print fieldLabel('DatePayment','datep',1).''; + print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).''; print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1); print '
'; - print fieldLabel('DateValue','datev',0).''; + print $form->editfieldkey('DateValue', 'datev', '', $object, 0).''; print $form->selectDate((empty($datev)?-1:$datev), "datev", '', '', '', 'add', 1, 1); print '
'; - print fieldLabel('Employee','fk_user',1).''; + print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).''; $noactive=0; // We keep active and unactive users print $form->select_dolusers(GETPOST('fk_user','int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive); print '
'; - print fieldLabel('Label','label',1).''; + print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).''; print 'trans("SalaryPayment")).'">'; print '
'; - print fieldLabel('DateStartPeriod','datesp',1).''; + print $form->editfieldkey('DateStartPeriod', 'datesp', '', $object, 0, 'string', '', 1).''; print $form->selectDate($datesp, "datesp", '', '', '', 'add'); print '
'; - print fieldLabel('DateEndPeriod','dateep',1).''; + print $form->editfieldkey('DateEndPeriod', 'dateep', '', $object, 0, 'string', '', 1).''; print $form->selectDate($dateep, "dateep", '', '', '', 'add'); print '
'; - print fieldLabel('Amount','amount',1).''; + print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).''; print ''; print '
'; - print fieldLabel('BankAccount','selectaccountid',1).''; + print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).''; $form->select_comptes($_POST["accountid"],"accountid",0,'',1); // Affiche liste des comptes courant print '
'; - print fieldLabel('PaymentMode','selectpaymenttype',1).''; + print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).''; $form->select_types_paiements(GETPOST("paymenttype"), "paymenttype", '', 2); print '
skype).'">
twitter).'">
facebook).'">
' . fieldLabel( 'Categories', 'contcats' ) . ''; - $cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, 'parent', null, null, 1 ); - print $form->multiselectarray( 'contcats', $cate_arbo, GETPOST( 'contcats', 'array' ), null, null, null, - null, '90%' ); + print '
' . $form->editfieldkey('Categories', 'contcats', '', $object, 0) . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1); + print $form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%'); print "
skype).'">
twitter).'">
facebook).'">
' . fieldLabel( 'Categories', 'contcats' ) . '
' . $form->editfieldkey('Categories', 'contcats', '', $object, 0) . ''; - $cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 ); - $c = new Categorie( $db ); - $cats = $c->containing( $object->id, 'contact' ); + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, 'contact'); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } - print $form->multiselectarray( 'contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%' ); + print $form->multiselectarray('contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); print "
' . $langs->trans("Categories") . ''; - print $form->showCategories( $object->id, 'contact', 1 ); + print $form->showCategories($object->id, 'contact', 1); print '