From ba3ae073d718b2cd2c87d5aba23b004e755c77dd Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 22 Nov 2012 19:59:31 +0100 Subject: [PATCH 01/21] New : go directly into supplier invoice number field after cloning --- htdocs/fourn/facture/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 4e3d60848f6..45f87dbb488 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -82,7 +82,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes') $result=$object->createFromClone($id); if ($result > 0) { - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + header("Location: ".$_SERVER['PHP_SELF'].'?action=editfacnumber&id='.$result); exit; } else From 5c9058e6887393b0bb5c83fae7757097dd6d6ff1 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 22 Nov 2012 21:56:06 +0100 Subject: [PATCH 02/21] Qual : clean unused code --- htdocs/product/fournisseurs.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 4f631358c9f..eda89ef1c5d 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -349,11 +349,8 @@ if ($id || $ref) //print $form->load_tva('tva_tx',$product->tva_tx,$supplier,$mysoc); // Do not use list here as it may be any vat rates for any country if (! empty($socid)) // When update { - $supplierselected=new Societe($db); - $supplierselected->fetch($socid); $default_vat=get_default_tva($supplier, $mysoc, $product->id); } - if ($action == 'add_price' && $socid) $default_vat=$product->tva_tx; // If editing product-fourn print ''; print ''; From 0bb3f766f61045a45dd30c3aa35cb488a61cd2a3 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 22 Nov 2012 23:38:35 +0100 Subject: [PATCH 03/21] New : Add clone function on supplier order + global object fetch instead of each case --- .../class/fournisseur.commande.class.php | 63 +++++++++++++++++ htdocs/fourn/commande/fiche.php | 67 ++++++++++++++----- 2 files changed, 114 insertions(+), 16 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d8eaef777ad..d1ef8b0f17a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -993,6 +993,69 @@ class CommandeFournisseur extends CommonOrder } } + /** + * Load an object from its id and create a new one in database + * + * @param HookManager $hookmanager Hook manager instance + * @return int New id of clone + */ + function createFromClone($hookmanager=false) + { + global $conf,$user,$langs; + + $error=0; + + $this->db->begin(); + + // Load source object + $objFrom = dol_clone($this); + + $this->id=0; + $this->statut=0; + + // Clear fields + $this->user_author_id = $user->id; + $this->user_valid = ''; + $this->date_creation = ''; + $this->date_validation = ''; + $this->ref_supplier = ''; + + // Create clone + $result=$this->create($user); + if ($result < 0) $error++; + + if (! $error) + { + // Hook of thirdparty module + if (is_object($hookmanager)) + { + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; + } + + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('ORDER_SUPPLIER_CLONE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + } + + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } + } + /** * Add order line * diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index c57d9e12bfc..1bdc263c05f 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -78,13 +78,18 @@ $errors=array(); $object = new CommandeFournisseur($db); +// Load object +if ($id > 0 || ! empty($ref)) +{ + $object->fetch($id, $ref); + $object->fetch_thirdparty(); +} /* * Actions */ if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) { - $object->fetch($id); $result=$object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha')); if ($result < 0) dol_print_error($db, $object->error); } @@ -92,14 +97,12 @@ if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) // conditions de reglement if ($action == 'setconditions' && $user->rights->fournisseur->commande->creer) { - $object->fetch($id); $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); } // mode de reglement else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) { - $object->fetch($id); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); } @@ -119,13 +122,11 @@ if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->cree // Set project else if ($action == 'classin' && $user->rights->fournisseur->commande->creer) { - $object->fetch($id); $object->setProject($projectid); } else if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->creer) { - $object->fetch($id); $result = $object->set_remise($user, $_POST['remise_percent']); } @@ -381,7 +382,6 @@ else if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer) { - $object->fetch($id); $result = $object->deleteline(GETPOST('lineid')); if ($result >= 0) @@ -413,7 +413,6 @@ else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->r else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->commande->valider) { - $object->fetch($id); $object->fetch_thirdparty(); $object->date_commande=dol_now(); @@ -448,7 +447,6 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou { $idwarehouse=GETPOST('idwarehouse', 'int'); - $object->fetch($id); $object->fetch_thirdparty(); // Check parameters @@ -479,7 +477,6 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou else if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver) { - $object->fetch($id); $result = $object->refuse($user); if ($result > 0) { @@ -494,7 +491,6 @@ else if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->four else if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) { - $object->fetch($id); $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); if ($result > 0) { @@ -510,7 +506,6 @@ else if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fo else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->commande->supprimer) { - $object->fetch($id); $object->fetch_thirdparty(); $result=$object->delete($user); if ($result > 0) @@ -524,10 +519,35 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->four } } +// Action clone object +else if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer) +{ + if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + $mesg='
'.$langs->trans("NoCloneOptionsSpecified").'
'; + } + else + { + if ($object->id > 0) + { + $result=$object->createFromClone($hookmanager); + if ($result > 0) + { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); + exit; + } + else + { + $mesg='
'.$object->error.'
'; + $action=''; + } + } + } +} + // Receive else if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner) { - $object->fetch($id); if ($_POST["type"]) { @@ -557,7 +577,6 @@ else if ($action == 'livraison' && $user->rights->fournisseur->commande->recepti else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) { - $object->fetch($id); $result = $object->cancel($user); if ($result > 0) { @@ -573,7 +592,6 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->four // Line ordering else if ($action == 'up' && $user->rights->fournisseur->commande->creer) { - $object->fetch($id); $object->line_up($_GET['rowid']); $outputlangs = $langs; @@ -588,7 +606,6 @@ else if ($action == 'up' && $user->rights->fournisseur->commande->creer) } else if ($action == 'down' && $user->rights->fournisseur->commande->creer) { - $object->fetch($id); $object->line_down($_GET['rowid']); $outputlangs = $langs; @@ -607,7 +624,6 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) / // Build document // Sauvegarde le dernier module choisi pour generer un document - $object->fetch($id); $object->fetch_thirdparty(); if ($_REQUEST['model']) @@ -984,6 +1000,18 @@ if ($id > 0 || ! empty($ref)) $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 2); if ($ret == 'html') print '
'; } + + // Clone confirmation + if ($action == 'clone') + { + // Create an array for form + $formquestion=array( + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1) + ); + // Paiement incomplet. On demande si motif = escompte ou autre + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$object->ref),'confirm_clone',$formquestion,'yes',1); + if ($ret == 'html') print '
'; + } /* * Confirmation de la validation @@ -1037,6 +1065,7 @@ if ($id > 0 || ! empty($ref)) $ret=$form->form_confirm("fiche.php?id=$object->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder",$object->ref),"confirm_refuse", '', 0, 1); if ($ret == 'html') print '
'; } + /* * Confirmation de l'annulation */ @@ -1645,6 +1674,12 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("CancelOrder").''; } } + + // Clone + if ($user->rights->fournisseur->commande->creer) + { + print ''.$langs->trans("ToClone").''; + } // Delete if ($user->rights->fournisseur->commande->supprimer) From 3306d91ce11f19ab6614f9764c982542ab764a24 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 23 Nov 2012 09:00:17 +0100 Subject: [PATCH 04/21] Task # 608 : forgot to clone lines... Now lines are also cloned and prices are valid prices at the clone date --- .../class/fournisseur.commande.class.php | 89 +++++++++++++------ 1 file changed, 60 insertions(+), 29 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d1ef8b0f17a..d2e93906bf4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -953,35 +953,68 @@ class CommandeFournisseur extends CommonOrder if ($this->db->query($sql)) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."commande_fournisseur"); + + if ($this->id) { + $num=count($this->lines); - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; - $sql.= " SET ref='(PROV".$this->id.")'"; - $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql); - if ($this->db->query($sql)) - { - // On logue creation pour historique - $this->log($user, 0, time()); + /* + * Insertion du detail des produits dans la base + */ + for ($i=0;$i<$num;$i++) + { + $result = $this->addline( + $this->lines[$i]->desc, + $this->lines[$i]->subprice, + $this->lines[$i]->qty, + $this->lines[$i]->tva_tx, + $this->lines[$i]->localtax1_tx, + $this->lines[$i]->localtax2_tx, + $this->lines[$i]->fk_product, + 0, + $this->lines[$i]->ref_fourn, + $this->lines[$i]->remise_percent, + 'HT', + 0, + $this->lines[$i]->info_bits + ); + if ($result < 0) + { + $this->error=$this->db->lasterror(); + dol_print_error($this->db); + $this->db->rollback(); + return -1; + } + } - if (! $notrigger) - { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - } - - $this->db->commit(); - return $this->id; - } - else - { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::create: Failed -2 - ".$this->error, LOG_ERR); - $this->db->rollback(); - return -2; + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; + $sql.= " SET ref='(PROV".$this->id.")'"; + $sql.= " WHERE rowid=".$this->id; + dol_syslog(get_class($this)."::create sql=".$sql); + if ($this->db->query($sql)) + { + // On logue creation pour historique + $this->log($user, 0, time()); + + if (! $notrigger) + { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('ORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + } + + $this->db->commit(); + return $this->id; + } + else + { + $this->error=$this->db->error(); + dol_syslog(get_class($this)."::create: Failed -2 - ".$this->error, LOG_ERR); + $this->db->rollback(); + return -2; + } } } else @@ -1107,7 +1140,6 @@ class CommandeFournisseur extends CommonOrder } $desc=trim($desc); - // Check parameters if ($qty < 1 && ! $fk_product) { @@ -1116,7 +1148,6 @@ class CommandeFournisseur extends CommonOrder } if ($type < 0) return -1; - if ($this->statut == 0) { $this->db->begin(); From b977ea5d877c32f16a0f1039675cedb30e7891e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Nov 2012 20:38:39 +0100 Subject: [PATCH 05/21] Fix: Regression. Show bad error message when we add a product with no prices defined. --- htdocs/fourn/facture/fiche.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 4e3d60848f6..e4dff4117bd 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -466,10 +466,19 @@ elseif ($action == 'addline') } $ret=$object->fetch_thirdparty(); - if ($_POST['idprodfournprice']) // > 0 or -1 + if (GETPOST('search_idprodfournprice') || GETPOST('idprodfournprice')) // With combolist idprodfournprice is > 0 or -1, with autocomplete, idprodfournprice is > 0 or '' { - $product=new Product($db); - $idprod=$product->get_buyprice($_POST['idprodfournprice'], $_POST['qty']); // Just to see if a price exists for the quantity. Not used to found vat + $idprod=0; + $product=new Product($db); + + if (GETPOST('idprodfournprice') == '') + { + $idprod=-1; + } + if (GETPOST('idprodfournprice') > 0) + { + $idprod=$product->get_buyprice(GETPOST('idprodfournprice'), $_POST['qty']); // Just to see if a price exists for the quantity. Not used to found vat + } if ($idprod > 0) { From 3de396afa6240e3c261ee8f2040ab81ea3245a94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Nov 2012 20:42:53 +0100 Subject: [PATCH 06/21] Fix: Class not found --- htdocs/product/stats/facture_fournisseur.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index b34bfb472ec..c7990224d69 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -165,8 +165,7 @@ if ($id > 0 || ! empty($ref)) print ""; print dol_print_date($db->jdate($objp->datef)).""; print "".price($objp->total_ht)."\n"; - $fac=new Facture($db); - print ''.$fac->LibStatut($objp->paye,$objp->statut,5).''; + print ''.$supplierinvoicestatic->LibStatut($objp->paye,$objp->statut,5).''; print "\n"; $i++; } From 6c8b00b82f61472bd7756ce8cbf3c20ba741deae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Nov 2012 21:00:51 +0100 Subject: [PATCH 07/21] Fix: Removed duplictae key --- htdocs/langs/ar_SA/suppliers.lang | 1 - htdocs/langs/bg_BG/suppliers.lang | 1 - htdocs/langs/ca_ES/bills.lang | 2 +- htdocs/langs/ca_ES/suppliers.lang | 1 - htdocs/langs/da_DK/suppliers.lang | 1 - htdocs/langs/de_AT/suppliers.lang | 1 - htdocs/langs/de_DE/suppliers.lang | 1 - htdocs/langs/el_GR/suppliers.lang | 1 - htdocs/langs/en_US/bills.lang | 4 ++-- htdocs/langs/en_US/suppliers.lang | 1 - htdocs/langs/es_ES/bills.lang | 2 +- htdocs/langs/es_ES/suppliers.lang | 1 - htdocs/langs/et_EE/suppliers.lang | 1 - htdocs/langs/fa_IR/suppliers.lang | 1 - htdocs/langs/fi_FI/suppliers.lang | 1 - htdocs/langs/fr_FR/bills.lang | 1 - htdocs/langs/fr_FR/suppliers.lang | 1 - htdocs/langs/he_IL/suppliers.lang | 1 - htdocs/langs/hu_HU/suppliers.lang | 1 - htdocs/langs/is_IS/suppliers.lang | 1 - htdocs/langs/it_IT/suppliers.lang | 1 - htdocs/langs/ja_JP/suppliers.lang | 1 - htdocs/langs/nb_NO/suppliers.lang | 1 - htdocs/langs/nl_BE/suppliers.lang | 1 - htdocs/langs/nl_NL/suppliers.lang | 1 - htdocs/langs/pl_PL/suppliers.lang | 1 - htdocs/langs/pt_BR/suppliers.lang | 1 - htdocs/langs/pt_PT/suppliers.lang | 1 - htdocs/langs/ro_RO/suppliers.lang | 1 - htdocs/langs/ru_RU/suppliers.lang | 1 - htdocs/langs/sl_SI/suppliers.lang | 1 - htdocs/langs/sv_SE/suppliers.lang | 1 - htdocs/langs/tr_TR/suppliers.lang | 1 - htdocs/langs/zh_CN/suppliers.lang | 1 - htdocs/langs/zh_TW/suppliers.lang | 1 - 35 files changed, 4 insertions(+), 36 deletions(-) diff --git a/htdocs/langs/ar_SA/suppliers.lang b/htdocs/langs/ar_SA/suppliers.lang index 5929a7d55d3..c4ac7827029 100644 --- a/htdocs/langs/ar_SA/suppliers.lang +++ b/htdocs/langs/ar_SA/suppliers.lang @@ -14,7 +14,6 @@ Supplier=المورد AddSupplier=إضافة مورد SupplierRemoved=إزالة المورد SuppliersInvoice=فاتورة الموردين -SuppliersInvoices=فواتير الموردين NewSupplier=مورد جديد History=التاريخ ListOfSuppliers=قائمة الموردين diff --git a/htdocs/langs/bg_BG/suppliers.lang b/htdocs/langs/bg_BG/suppliers.lang index 283ada1c1c5..e279ad69213 100644 --- a/htdocs/langs/bg_BG/suppliers.lang +++ b/htdocs/langs/bg_BG/suppliers.lang @@ -13,7 +13,6 @@ Supplier=Снабдител AddSupplier=Добави доставчик SupplierRemoved=Изтрити доставчик SuppliersInvoice=Фактура -SuppliersInvoices=Фактури NewSupplier=Нов доставчик History=Исторически ListOfSuppliers=Списък на доставчиците diff --git a/htdocs/langs/ca_ES/bills.lang b/htdocs/langs/ca_ES/bills.lang index f6ce99e3c04..d8d87882d13 100644 --- a/htdocs/langs/ca_ES/bills.lang +++ b/htdocs/langs/ca_ES/bills.lang @@ -47,7 +47,7 @@ InvoiceCustomer=Factura a client CustomerInvoice=Factura a client CustomersInvoices=Factures a clientes SupplierInvoice=Factura de proveïdor -SuppliersInvoices=Factures de proveïdors +SuppliersInvoices=Factures proveïdors SupplierBill=Factura de proveïdor SupplierBills=Factures de proveïdors Payment=Pagament diff --git a/htdocs/langs/ca_ES/suppliers.lang b/htdocs/langs/ca_ES/suppliers.lang index be740e4eab1..065d0404862 100644 --- a/htdocs/langs/ca_ES/suppliers.lang +++ b/htdocs/langs/ca_ES/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Proveïdor AddSupplier=Afegir proveïdor SupplierRemoved=Proveïdor eliminat SuppliersInvoice=Factura proveïdor -SuppliersInvoices=Factures proveïdors NewSupplier=Nou proveïdor History=Històric ListOfSuppliers=Llistat de proveïdors diff --git a/htdocs/langs/da_DK/suppliers.lang b/htdocs/langs/da_DK/suppliers.lang index cc435074e79..5b06a4bfdba 100644 --- a/htdocs/langs/da_DK/suppliers.lang +++ b/htdocs/langs/da_DK/suppliers.lang @@ -16,7 +16,6 @@ Supplier=Leverandør AddSupplier=Tilføj en leverandør SupplierRemoved=Leverandør fjernet SuppliersInvoice=Leverandører faktura -SuppliersInvoices=Leverandører fakturaer NewSupplier=Ny leverandør History=Historie ListOfSuppliers=Liste over leverandører diff --git a/htdocs/langs/de_AT/suppliers.lang b/htdocs/langs/de_AT/suppliers.lang index 6a960705d76..5d17837ec06 100644 --- a/htdocs/langs/de_AT/suppliers.lang +++ b/htdocs/langs/de_AT/suppliers.lang @@ -12,7 +12,6 @@ Supplier=Lieferant AddSupplier=Lieferanten hinzufügen SupplierRemoved=Lieferant entfernt SuppliersInvoice=Lieferantenrechnung -SuppliersInvoices=Lieferantenrechnungen NewSupplier=Neuer Lieferant History=Verlauf ListOfSuppliers=Lieferantenliste diff --git a/htdocs/langs/de_DE/suppliers.lang b/htdocs/langs/de_DE/suppliers.lang index 945bea65fcd..e44f7ed7ccb 100644 --- a/htdocs/langs/de_DE/suppliers.lang +++ b/htdocs/langs/de_DE/suppliers.lang @@ -12,7 +12,6 @@ Supplier=Lieferant AddSupplier=Lieferanten hinzufügen SupplierRemoved=Lieferant entfernt SuppliersInvoice=Lieferantenrechnung -SuppliersInvoices=Lieferantenrechnungen NewSupplier=Neuer Lieferant History=Verlauf ListOfSuppliers=Lieferantenliste diff --git a/htdocs/langs/el_GR/suppliers.lang b/htdocs/langs/el_GR/suppliers.lang index 5a42434f340..9db72404188 100644 --- a/htdocs/langs/el_GR/suppliers.lang +++ b/htdocs/langs/el_GR/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Προμηθευτής AddSupplier=Προσθήκη προμηθευτή SupplierRemoved=Ο προμηθευτής αφαιρέθηκε SuppliersInvoice=Τιμολόγιο προμηθευτή -SuppliersInvoices=Τιμολόγια προμηθευτών NewSupplier=Νέος προμηθευτής History=Ιστορικό ListOfSuppliers=Λίστα προμηθευτών diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 6195a5147b9..01cbb6950d4 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -49,9 +49,9 @@ Invoices=Invoices InvoiceLine=Invoice line InvoiceCustomer=Customer invoice CustomerInvoice=Customer invoice -CustomersInvoices=Customer's invoices +CustomersInvoices=Customers invoices SupplierInvoice=Supplier invoice -SuppliersInvoices=Supplier's invoices +SuppliersInvoices=Suppliers invoices SupplierBill=Supplier invoice SupplierBills=suppliers invoices Payment=Payment diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang index fd5a35d3f53..8f05c209b95 100644 --- a/htdocs/langs/en_US/suppliers.lang +++ b/htdocs/langs/en_US/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Supplier AddSupplier=Add a supplier SupplierRemoved=Supplier removed SuppliersInvoice=Suppliers invoice -SuppliersInvoices=Suppliers invoices NewSupplier=New supplier History=History ListOfSuppliers=List of suppliers diff --git a/htdocs/langs/es_ES/bills.lang b/htdocs/langs/es_ES/bills.lang index 63a33d062b0..42e5f4c60ba 100644 --- a/htdocs/langs/es_ES/bills.lang +++ b/htdocs/langs/es_ES/bills.lang @@ -47,7 +47,7 @@ InvoiceCustomer=Factura a cliente CustomerInvoice=Factura a cliente CustomersInvoices=Facturas a clientes SupplierInvoice=Factura de proveedor -SuppliersInvoices=Facturas de proveedores +SuppliersInvoices=Facturas proveedores SupplierBill=Factura de proveedor SupplierBills=Facturas de proveedores Payment=Pago diff --git a/htdocs/langs/es_ES/suppliers.lang b/htdocs/langs/es_ES/suppliers.lang index a03eccb719f..e500aea17bb 100644 --- a/htdocs/langs/es_ES/suppliers.lang +++ b/htdocs/langs/es_ES/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Proveedor AddSupplier=Añadir proveedor SupplierRemoved=Proveedor eliminado SuppliersInvoice=Factura proveedor -SuppliersInvoices=Facturas proveedores NewSupplier=Nuevo proveedor History=Histórico ListOfSuppliers=Listado de proveedores diff --git a/htdocs/langs/et_EE/suppliers.lang b/htdocs/langs/et_EE/suppliers.lang index 57f6ab11194..c9487dad634 100644 --- a/htdocs/langs/et_EE/suppliers.lang +++ b/htdocs/langs/et_EE/suppliers.lang @@ -13,7 +13,6 @@ Supplier=Tarnija AddSupplier=Lisa tarnija SupplierRemoved=Tarnija välja SuppliersInvoice=Tarnijate arve -SuppliersInvoices=Tarnijate arvete NewSupplier=New tarnija History=Ajalugu ListOfSuppliers=Tarnijate diff --git a/htdocs/langs/fa_IR/suppliers.lang b/htdocs/langs/fa_IR/suppliers.lang index 327d6ecc56e..d24ea173e77 100644 --- a/htdocs/langs/fa_IR/suppliers.lang +++ b/htdocs/langs/fa_IR/suppliers.lang @@ -14,7 +14,6 @@ Supplier=المورد AddSupplier=إضافة مورد SupplierRemoved=إزالة المورد SuppliersInvoice=فاتورة الموردين -SuppliersInvoices=فواتير الموردين NewSupplier=مورد جديد History=التاريخ ListOfSuppliers=قائمة الموردين diff --git a/htdocs/langs/fi_FI/suppliers.lang b/htdocs/langs/fi_FI/suppliers.lang index 8d8d8e5fb0d..43e75c7d246 100644 --- a/htdocs/langs/fi_FI/suppliers.lang +++ b/htdocs/langs/fi_FI/suppliers.lang @@ -14,7 +14,6 @@ Supplier=Toimittaja AddSupplier=Lisää toimittaja SupplierRemoved=Toimittaja poistettu SuppliersInvoice=Tavarantoimittajat lasku -SuppliersInvoices=Tavarantoimittajat laskut NewSupplier=Uuden toimittajan History=Historia ListOfSuppliers=Luettelo toimittajat diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 866773ee131..30786b6e542 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -47,7 +47,6 @@ InvoiceCustomer=Facture client CustomerInvoice=Facture client CustomersInvoices=Factures clients SupplierInvoice=Facture fournisseur -SuppliersInvoices=Factures fournisseurs SupplierBill=Facture fournisseur SupplierBills=Factures fournisseurs Payment=Règlement diff --git a/htdocs/langs/fr_FR/suppliers.lang b/htdocs/langs/fr_FR/suppliers.lang index c042b74ea89..932615ff181 100644 --- a/htdocs/langs/fr_FR/suppliers.lang +++ b/htdocs/langs/fr_FR/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Fournisseur AddSupplier=Ajouter un fournisseur SupplierRemoved=Fournisseur supprimé SuppliersInvoice=Facture fournisseur -SuppliersInvoices=Factures fournisseurs NewSupplier=Nouveau fournisseur History=Historique ListOfSuppliers=Liste des fournisseurs diff --git a/htdocs/langs/he_IL/suppliers.lang b/htdocs/langs/he_IL/suppliers.lang index 0949262da42..3706da71c41 100644 --- a/htdocs/langs/he_IL/suppliers.lang +++ b/htdocs/langs/he_IL/suppliers.lang @@ -13,7 +13,6 @@ Supplier=ספק AddSupplier=הוסף הספק SupplierRemoved=הספק הוסר SuppliersInvoice=ספקים חשבונית -SuppliersInvoices=חשבוניות ספקים NewSupplier=חדש הספק History=היסטוריה ListOfSuppliers=רשימת הספקים diff --git a/htdocs/langs/hu_HU/suppliers.lang b/htdocs/langs/hu_HU/suppliers.lang index 9a0c2643fc7..89bdd570292 100644 --- a/htdocs/langs/hu_HU/suppliers.lang +++ b/htdocs/langs/hu_HU/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Beszállító AddSupplier=Beszállító hozzáadása SupplierRemoved=Beszállító eltávolítva SuppliersInvoice=Beszállító számla -SuppliersInvoices=Beszállítók számlái NewSupplier=Új beszállító History=Történet ListOfSuppliers=Beszállító listája diff --git a/htdocs/langs/is_IS/suppliers.lang b/htdocs/langs/is_IS/suppliers.lang index 625ded3432e..a33597212b3 100644 --- a/htdocs/langs/is_IS/suppliers.lang +++ b/htdocs/langs/is_IS/suppliers.lang @@ -13,7 +13,6 @@ Supplier=Birgir AddSupplier=Bæta við birgja SupplierRemoved=Birgir fjarri SuppliersInvoice=Birgjar Reikningar -SuppliersInvoices=Birgjar reikningum NewSupplier=New birgir History=Saga ListOfSuppliers=Listi yfir birgja diff --git a/htdocs/langs/it_IT/suppliers.lang b/htdocs/langs/it_IT/suppliers.lang index 7f21a0f73c3..8771326292b 100644 --- a/htdocs/langs/it_IT/suppliers.lang +++ b/htdocs/langs/it_IT/suppliers.lang @@ -39,4 +39,3 @@ SupplierRemoved =Fornitore rimosso SuppliersArea =Area fornitori Suppliers =Fornitori SuppliersInvoice =Fattura Fornitore -SuppliersInvoices =Fatture fornitori diff --git a/htdocs/langs/ja_JP/suppliers.lang b/htdocs/langs/ja_JP/suppliers.lang index 3cb36fb8a85..70416c864a9 100644 --- a/htdocs/langs/ja_JP/suppliers.lang +++ b/htdocs/langs/ja_JP/suppliers.lang @@ -13,7 +13,6 @@ Supplier=サプライヤー AddSupplier=サプライヤーを追加します。 SupplierRemoved=サプライヤーは、削除 SuppliersInvoice=仕入先の請求書 -SuppliersInvoices=仕入先の請求書 NewSupplier=新しいサプライヤー History=歴史 ListOfSuppliers=サプライヤーのリスト diff --git a/htdocs/langs/nb_NO/suppliers.lang b/htdocs/langs/nb_NO/suppliers.lang index 120b83656a5..9ee3898c986 100644 --- a/htdocs/langs/nb_NO/suppliers.lang +++ b/htdocs/langs/nb_NO/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Leverandør AddSupplier=Legg til en leverandør SupplierRemoved=Leverandør slettet SuppliersInvoice=Leverandørfaktura -SuppliersInvoices=Leverandørfakturaer NewSupplier=Ny leverandør History=Historikk ListOfSuppliers=Leverandøroversikt diff --git a/htdocs/langs/nl_BE/suppliers.lang b/htdocs/langs/nl_BE/suppliers.lang index 2c3a226584f..5326e9b7fe5 100644 --- a/htdocs/langs/nl_BE/suppliers.lang +++ b/htdocs/langs/nl_BE/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Leverancier AddSupplier=Voeg een leverancier toe SupplierRemoved=Leverancier verwijderd SuppliersInvoice=Leveranciers factuur -SuppliersInvoices=Leveranciers facturen NewSupplier=Nieuwe leverancier History=Geschiedenis ListOfSuppliers=Lijst van de leveranciers diff --git a/htdocs/langs/nl_NL/suppliers.lang b/htdocs/langs/nl_NL/suppliers.lang index 6d43ab7831b..1d8f1a032d8 100644 --- a/htdocs/langs/nl_NL/suppliers.lang +++ b/htdocs/langs/nl_NL/suppliers.lang @@ -5,7 +5,6 @@ Supplier = Leverancier AddSupplier = Voeg een leverancier toe SupplierRemoved = Leverancier verwijderd SuppliersInvoice = Leveranciersfactuur -SuppliersInvoices = Leveranciersfacturen NewSupplier = Nieuwe leverancier History = Geschiedenis ListOfSuppliers = Leverancierslijst diff --git a/htdocs/langs/pl_PL/suppliers.lang b/htdocs/langs/pl_PL/suppliers.lang index 88c424f5ab0..ce47c187730 100644 --- a/htdocs/langs/pl_PL/suppliers.lang +++ b/htdocs/langs/pl_PL/suppliers.lang @@ -16,7 +16,6 @@ Supplier=Dostawca AddSupplier=Dodaj dostawcy SupplierRemoved=Dostawca usunięte SuppliersInvoice=Dostawcy faktury -SuppliersInvoices=Dostawcy faktur NewSupplier=Nowy dostawca History=Historia ListOfSuppliers=Lista dostawców diff --git a/htdocs/langs/pt_BR/suppliers.lang b/htdocs/langs/pt_BR/suppliers.lang index acc5ad3d5e6..537a39c03f8 100644 --- a/htdocs/langs/pt_BR/suppliers.lang +++ b/htdocs/langs/pt_BR/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Fornecedor AddSupplier=Adicionar Fornecedor SupplierRemoved=Fornecedor Eliminado SuppliersInvoice=Faturas do Fornecedor -SuppliersInvoices=Faturas de Fornecedores NewSupplier=Novo Fornecedor History=Histórico ListOfSuppliers=Lista de Fornecedores diff --git a/htdocs/langs/pt_PT/suppliers.lang b/htdocs/langs/pt_PT/suppliers.lang index faab981a749..85dfde74227 100644 --- a/htdocs/langs/pt_PT/suppliers.lang +++ b/htdocs/langs/pt_PT/suppliers.lang @@ -5,7 +5,6 @@ Supplier=Fornecedor AddSupplier=Adicionar Fornecedor SupplierRemoved=Fornecedor Eliminado SuppliersInvoice=Facturas do Fornecedor -SuppliersInvoices=Facturas de Fornecedores NewSupplier=Novo Fornecedor History=Histórico ListOfSuppliers=Lista de Fornecedores diff --git a/htdocs/langs/ro_RO/suppliers.lang b/htdocs/langs/ro_RO/suppliers.lang index 9603ceaeb1d..e1a10dc72be 100644 --- a/htdocs/langs/ro_RO/suppliers.lang +++ b/htdocs/langs/ro_RO/suppliers.lang @@ -14,7 +14,6 @@ Supplier=Furnizor AddSupplier=Adauga un furnizor SupplierRemoved=Furnizor eliminat SuppliersInvoice=Furnizori de factură -SuppliersInvoices=Furnizori facturi NewSupplier=New furnizor History=Istorie ListOfSuppliers=Lista de furnizori diff --git a/htdocs/langs/ru_RU/suppliers.lang b/htdocs/langs/ru_RU/suppliers.lang index 252c838ad1e..c118f0af1a9 100644 --- a/htdocs/langs/ru_RU/suppliers.lang +++ b/htdocs/langs/ru_RU/suppliers.lang @@ -14,7 +14,6 @@ Supplier=Поставщик AddSupplier=Добавить поставщиком SupplierRemoved=Поставщик удален SuppliersInvoice=Поставщики счета -SuppliersInvoices=Поставщики счета NewSupplier=Новый поставщик History=История ListOfSuppliers=Список поставщиков diff --git a/htdocs/langs/sl_SI/suppliers.lang b/htdocs/langs/sl_SI/suppliers.lang index 42e73cd433e..4df1bc83641 100644 --- a/htdocs/langs/sl_SI/suppliers.lang +++ b/htdocs/langs/sl_SI/suppliers.lang @@ -5,7 +5,6 @@ Supplier = Dobavitelj AddSupplier = Dodaj dobavitelja SupplierRemoved = Dobavitelj odstranjen SuppliersInvoice = Računi dobavitelja -SuppliersInvoices = Računi dobaviteljev NewSupplier = Nov dobavitelj History = Zgodovina ListOfSuppliers = Seznam dobaviteljev diff --git a/htdocs/langs/sv_SE/suppliers.lang b/htdocs/langs/sv_SE/suppliers.lang index 159fff54da5..3d99a40f5fe 100644 --- a/htdocs/langs/sv_SE/suppliers.lang +++ b/htdocs/langs/sv_SE/suppliers.lang @@ -13,7 +13,6 @@ Supplier=Leverantör AddSupplier=Lägg till en leverantör SupplierRemoved=Leverantör bort SuppliersInvoice=Leverantörer faktura -SuppliersInvoices=Leverantörer fakturor NewSupplier=Ny leverantör History=Historia ListOfSuppliers=Lista över leverantörer diff --git a/htdocs/langs/tr_TR/suppliers.lang b/htdocs/langs/tr_TR/suppliers.lang index f9543986615..fb3f2aa2945 100644 --- a/htdocs/langs/tr_TR/suppliers.lang +++ b/htdocs/langs/tr_TR/suppliers.lang @@ -12,7 +12,6 @@ Supplier=Tedarikçi AddSupplier=Bir tedarikçi ekle SupplierRemoved=Tedarikçi kaldırıldı SuppliersInvoice=Tedarikçi faturası -SuppliersInvoices=Tedarikçi faturaları NewSupplier=Yeni tedarikçi History=Geçmiş ListOfSuppliers=Tedarikçiler listesi diff --git a/htdocs/langs/zh_CN/suppliers.lang b/htdocs/langs/zh_CN/suppliers.lang index be4673ed4e4..49769de806b 100644 --- a/htdocs/langs/zh_CN/suppliers.lang +++ b/htdocs/langs/zh_CN/suppliers.lang @@ -13,7 +13,6 @@ Supplier=供应商 AddSupplier=新增供应商 SupplierRemoved=供应商删除 SuppliersInvoice=供应商发票 -SuppliersInvoices=供应商发票 NewSupplier=新供应商 History=历史 ListOfSuppliers=供应商名单 diff --git a/htdocs/langs/zh_TW/suppliers.lang b/htdocs/langs/zh_TW/suppliers.lang index 8a3e4b5ee2f..24bb921b63c 100644 --- a/htdocs/langs/zh_TW/suppliers.lang +++ b/htdocs/langs/zh_TW/suppliers.lang @@ -13,7 +13,6 @@ Supplier=供應商 AddSupplier=新增供應商 SupplierRemoved=供應商刪除 SuppliersInvoice=供應商的發票 -SuppliersInvoices=供應商的發票 NewSupplier=新供應商 History=歷史 ListOfSuppliers=供應商名單 From b4ebd7e8529721f8f15bf869d518cb9e58fe1f21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Nov 2012 11:36:45 +0100 Subject: [PATCH 08/21] Qual: Uniformize code and fix a regression --- .../tpl/predefinedproductline_create.tpl.php | 63 ++++++++++--------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 601f463682d..4064fb3b585 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -42,17 +42,16 @@ trans('ReductionShort'); ?> margin->enabled)) { +if (! empty($conf->margin->enabled)) +{ + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; ?> trans('BuyingPrice'); ?> -global->DISPLAY_MARGIN_RATES)) - $colspan++; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - $colspan++; -} -?>   +
0) jQuery('#np_desc').focus(); }); }); @@ -97,17 +96,16 @@ jQuery(document).ready(function() { % margin->enabled)) { +if (! empty($conf->margin->enabled)) +{ + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; ?> "> global->DISPLAY_MARGIN_RATES)) - $colspan++; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - $colspan++; } ?> @@ -115,18 +113,17 @@ if (! empty($conf->margin->enabled)) { -service->enabled) && $dateSelector) { -if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) - $colspan = 10; -else - $colspan = 9; -if (! empty($conf->margin->enabled)) { - $colspan++; // For the buying price - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - $colspan++; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - $colspan++; -} +service->enabled) && $dateSelector) +{ + if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10; + else $colspan = 9; + if (! empty($conf->margin->enabled)) + { + $colspan++; // For the buying price + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; + } ?> > @@ -138,11 +135,15 @@ if (! empty($conf->margin->enabled)) { ?> - +
+ margin->enabled)) { +if (! empty($conf->margin->enabled)) +{ ?> - + From 4480af348c90bce718ac3f3bcef9af703afdb912 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Nov 2012 11:57:20 +0100 Subject: [PATCH 09/21] Fix: Cols at wrong place --- htdocs/core/tpl/predefinedproductline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 4064fb3b585..6897a523b56 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -48,10 +48,10 @@ if (! empty($conf->margin->enabled)) if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; ?> trans('BuyingPrice'); ?> -   +  
0 if if want to stop standard actions, <0 means KO. - * For printSearchForm,printLeftBlock,printTopRightMenu,...: Return HTML string. + * For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Must always return an int and things to print into ->resprints. + * Can also return some values into an array ->results. * $this->error or this->errors are also defined by class called by this function if error. */ function executeHooks($method, $parameters=false, &$object='', &$action='') @@ -127,45 +128,58 @@ class HookManager // Loop on each hook to qualify modules that declared context $modulealreadyexecuted=array(); - $resaction=0; $resprint=''; + $resaction=0; $error=0; + $this->resPrint=''; $this->resArray=array(); foreach($this->hooks as $modules) // this->hooks is an array with context as key and value is an array of modules that handle this context { if (! empty($modules)) { foreach($modules as $module => $actionclassinstance) { - // test to avoid to run twice a hook, when a module implements several active contexts + // jump to next class if method does not exists + if (! method_exists($actionclassinstance,$method)) continue; + // test to avoid to run twice a hook, when a module implements several active contexts if (in_array($module,$modulealreadyexecuted)) continue; $modulealreadyexecuted[$module]=$module; // Hooks that return int - if (($method == 'doActions' || $method == 'formObjectOptions') && method_exists($actionclassinstance,$method)) + if (($method == 'doActions' || $method == 'formObjectOptions')) { - $resaction+=$actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) - if ($resaction < 0 || ! empty($actionclassinstance->error) || (! empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0)) - { - $this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors); - if ($method == 'doActions') - { - if ($action=='add') $action='create'; // TODO this change must be inside the doActions - if ($action=='update') $action='edit'; // TODO this change must be inside the doActions - } - } + $resaction+=$actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) + if ($resaction < 0 || ! empty($actionclassinstance->error) || (! empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0)) + { + $error++; + $this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors); + // TODO remove this. Change must be inside the method if required + if ($method == 'doActions') + { + if ($action=='add') $action='create'; + if ($action=='update') $action='edit'; + } + } } - // Generic hooks that return a string (printSearchForm, printLeftBlock, formBuilddocOptions, ...) - else if (method_exists($actionclassinstance,$method)) + // Generic hooks that return a string (printSearchForm, printLeftBlock, printTopRightMenu, formAddObjectLine, formBuilddocOptions, ...) + else { - if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue; + // TODO. this should be done into the method by returning nothing + if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue; + $result = $actionclassinstance->$method($parameters, $object, $action, $this); - if (is_array($result)) $this->resArray = array_merge($this->resArray, $result); - else $resprint.=$result; + + if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); + if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; + + // TODO. remove this. array result must be set into $actionclassinstance->results + if (is_array($result)) $this->resArray = array_merge($this->resArray, $result); + // TODO. remove this. result must not be a string. we must use $actionclassinstance->resprint to return a string + if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result; } } } } - if ($method == 'doActions' || $method == 'formObjectOptions') return $resaction; - return $resprint; + if ($method != 'doActions' && $method != 'formObjectOptions') return $this->resPrint; // TODO remove this. When there is something to print, ->resPrint is filled. + return ($error?-1:$resaction); } } From d9fb0c941bd4afe8f6cb9f01f04dd0d4a18c73e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Nov 2012 13:28:02 +0100 Subject: [PATCH 11/21] Qual: remove select to have id same with combo and ajax --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2cce0fcbdfa..d2afb9a8633 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1447,7 +1447,8 @@ class Form $num = $this->db->num_rows($result); - $outselect.=''; // remove select to have id same with combo and ajax + $outselect.=''; print ''; print ''; + print ''; + $var=true; print ''; print ''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index e4dff4117bd..648df36f946 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1814,10 +1814,20 @@ else print ' '; print ''; + // TODO Use the predefinedproductline_create.tpl.php file print ''; print ''; print ''; print ''; + + print ''; + $var=! $var; print ''; print ''; From 3f64b533f496a664034e29c7a4c818a24ace7371 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Nov 2012 16:06:50 +0100 Subject: [PATCH 14/21] =?UTF-8?q?Fix:=20[=20bug=20#607=20]=20Nom=20de=20so?= =?UTF-8?q?ci=C3=A9t=C3=A9=20avec=20guillemets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/societe/soc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index a916a7377c3..d922ea8f51d 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1121,7 +1121,7 @@ else print ''; // Name - print ''; + print ''; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field @@ -1130,12 +1130,12 @@ else // It does not change the prefix mode using the auto numbering prefix if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) { - print ''; + print ''; print $object->prefix_comm; } else { - print ''; + print ''; } print ''; } From 959e061373a5cb7504268afee9c26e75d2a17d0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Nov 2012 09:34:14 +0100 Subject: [PATCH 15/21] Added english (arabi saudia) --- htdocs/langs/en_SA/main.lang | 17 +++++++++++++++++ htdocs/langs/en_US/languages.lang | 1 + htdocs/langs/fr_FR/languages.lang | 1 + 3 files changed, 19 insertions(+) create mode 100644 htdocs/langs/en_SA/main.lang diff --git a/htdocs/langs/en_SA/main.lang b/htdocs/langs/en_SA/main.lang new file mode 100644 index 00000000000..5ae5fd3a44e --- /dev/null +++ b/htdocs/langs/en_SA/main.lang @@ -0,0 +1,17 @@ +# Dolibarr language file - en_WW - main +CHARSET=UTF-8 +DIRECTION=ltr +FONTFORPDF=DejaVuSans +FONTSIZEFORPDF=9 +SeparatorDecimal=. +SeparatorThousand=, +FormatDateShort=%d/%m/%Y +FormatDateShortJava=dd/MM/yyyy +FormatDateShortJQuery=dd/mm/yy +FormatHourShort=%I:%M %p +FormatHourShortDuration=%H:%M +FormatDateTextShort=%b %d, %Y +FormatDateText=%B %d, %Y +FormatDateHourShort=%d/%m/%Y %I:%M %p +FormatDateHourTextShort=%b %d, %Y, %I:%M %p +FormatDateHourText=%B %d, %Y, %I:%M %p \ No newline at end of file diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index e2f8cd0a510..8f79cd99fe0 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -14,6 +14,7 @@ Language_en_AU=English (Australia) Language_en_GB=English (United Kingdom) Language_en_IN=English (India) Language_en_NZ=English (New Zealand) +Language_en_SA=English (Saudi Arabia) Language_en_US=English (United States) Language_es_ES=Spanish Language_es_AR=Spanish (Argentina) diff --git a/htdocs/langs/fr_FR/languages.lang b/htdocs/langs/fr_FR/languages.lang index 09231867347..40efc72e533 100644 --- a/htdocs/langs/fr_FR/languages.lang +++ b/htdocs/langs/fr_FR/languages.lang @@ -14,6 +14,7 @@ Language_en_AU=Anglais (Australie) Language_en_GB=Anglais (Royaume-Uni) Language_en_IN=Anglais (Inde) Language_en_NZ=Anglais (Nouvelle Zeland) +Language_en_SA=Anglais (Arabie Saoudite) Language_en_US=Anglais (Etats-Unis) Language_es_ES=Espagnol Language_es_AR=Espagnol (Argentine) From 49730ac24f07ab18b72beac7f8cdd4c5cf6fbe92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Nov 2012 13:58:06 +0100 Subject: [PATCH 16/21] Code comments only --- htdocs/core/class/translate.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index d454cc3d005..ae43f9f34e7 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -143,6 +143,9 @@ class Translate * If data for file already loaded, do nothing. * All data in translation array are stored in UTF-8 format. * tab_loaded is completed with $domain key. + * Warning: MAIN_USE_CUSTOM_TRANSLATION is an old deprecated feature. Do not use it. It will revert + * rule "we keep first entry found with we keep last entry found" so it is probably not what you want to do. + * * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache * * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: @@ -198,13 +201,14 @@ class Translate // Directory of translation files $file_lang = $searchdir.($modulename?'/'.$modulename:'')."/langs/".$langofdir."/".$newdomain.".lang"; $file_lang_osencoded=dol_osencode($file_lang); + $filelangexists=is_file($file_lang_osencoded); //dol_syslog('Translate::Load Try to read for alt='.$alt.' langofdir='.$langofdir.' file_lang='.$file_lang." => filelangexists=".$filelangexists); if ($filelangexists) { - // TODO Move cache read out of loop on dirs + // TODO Move cache read out of loop on dirs or at least filelangexists $found=false; // Enable caching of lang file in memory (not by default) From a495bcefaad3bd0855f051792a9da24ebce0ef5d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Nov 2012 14:13:42 +0100 Subject: [PATCH 17/21] Fix: language translation for araby saudia --- htdocs/langs/en_SA/main.lang | 10 +++++----- htdocs/langs/en_SA/propal.lang | 8 ++++++++ htdocs/langs/en_US/propal.lang | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 htdocs/langs/en_SA/propal.lang diff --git a/htdocs/langs/en_SA/main.lang b/htdocs/langs/en_SA/main.lang index 5ae5fd3a44e..146ae3fd85e 100644 --- a/htdocs/langs/en_SA/main.lang +++ b/htdocs/langs/en_SA/main.lang @@ -1,4 +1,4 @@ -# Dolibarr language file - en_WW - main +# Dolibarr language file - en_SA - main CHARSET=UTF-8 DIRECTION=ltr FONTFORPDF=DejaVuSans @@ -10,8 +10,8 @@ FormatDateShortJava=dd/MM/yyyy FormatDateShortJQuery=dd/mm/yy FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M -FormatDateTextShort=%b %d, %Y -FormatDateText=%B %d, %Y +FormatDateTextShort=%d %b %Y +FormatDateText=%d %B %Y FormatDateHourShort=%d/%m/%Y %I:%M %p -FormatDateHourTextShort=%b %d, %Y, %I:%M %p -FormatDateHourText=%B %d, %Y, %I:%M %p \ No newline at end of file +FormatDateHourTextShort=%d %b %Y, %I:%M %p +FormatDateHourText=%d %B %Y, %I:%M %p \ No newline at end of file diff --git a/htdocs/langs/en_SA/propal.lang b/htdocs/langs/en_SA/propal.lang new file mode 100644 index 00000000000..a985b025a19 --- /dev/null +++ b/htdocs/langs/en_SA/propal.lang @@ -0,0 +1,8 @@ +# Dolibarr language file - en_SA - propal +CHARSET=UTF-8 +Proposals=Commercial Proposals +Proposal=Commercial Proposal +Prop=Commercial Proposals +CommercialProposal=Commercial Proposal +CommercialProposals=Commercial Proposals +DateEndPropal=Validity Ending Date \ No newline at end of file diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 78119f38ebb..3f76ca5ecda 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -61,7 +61,7 @@ FileUploaded=The file was successfully uploaded AssociatedDocuments=Documents associated with the proposal: ErrorCantOpenDir=Can't open directory DatePropal=Date of proposal -DateEndPropal=Date end validity +DateEndPropal=Validity ending date DateEndPropalShort=Date end ValidityDuration=Validity duration CloseAs=Close with status From f456a4d0fed79d579626f2a207361da5acc78376 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 27 Nov 2012 15:26:14 +0100 Subject: [PATCH 18/21] Update Common Object update_contact method to allow to change the fk_socppoeple linked --- htdocs/core/class/commonobject.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0cb132d23c6..26d54111098 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -221,14 +221,16 @@ abstract class CommonObject * @param int $rowid Id of line contact-element * @param int $statut New status of link * @param int $type_contact_id Id of contact type (not modified if 0) + * @param int $fk_socpeople Id of soc_people to update (not modified if 0) * @return int <0 if KO, >= 0 if OK */ - function update_contact($rowid, $statut, $type_contact_id=0) + function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0) { // Insertion dans la base $sql = "UPDATE ".MAIN_DB_PREFIX."element_contact set"; $sql.= " statut = ".$statut; if ($type_contact_id) $sql.= ", fk_c_type_contact = '".$type_contact_id ."'"; + if ($fk_socpeople) $sql.= ", fk_socpeople = '".$fk_socpeople ."'"; $sql.= " where rowid = ".$rowid; $resql=$this->db->query($sql); if ($resql) @@ -3035,4 +3037,4 @@ abstract class CommonObject } } -?> +?> \ No newline at end of file From 8dc0aec7546d2b8982513ccf0e5768eb297f1e01 Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 27 Nov 2012 16:52:52 +0100 Subject: [PATCH 19/21] [ task #204 ] Manage canadian, spain and other country double VAT with a generic system. Add spanish tests --- htdocs/core/lib/functions.lib.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d9d8703680c..605797c6422 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2703,9 +2703,8 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") // Some test to guess with no need to make database access if ($mysoc->country_code == 'ES') // For spain, localtaxes are qualified if both supplier and seller use local taxe { - if ($local == 1 && (! $thirdparty_seller->localtax1_assuj || ! $thirdparty_buyer->localtax1_assuj)) return 0; - if ($local == 2 && (! $thirdparty_seller->localtax2_assuj || ! $thirdparty_buyer->localtax2_assuj)) return 0; - + if ($local == 1 && ! $thirdparty_buyer->localtax1_assuj) return 0; + if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0; } else { @@ -2995,18 +2994,27 @@ function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod) */ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $idprod=0) { + global $mysoc; + if (!is_object($thirdparty_seller)) return -1; if (!is_object($thirdparty_buyer)) return -1; - if ($local==1) //RE + if ($local==1) // Localtax 1 { - // Si vendeur non assujeti a RE, localtax1 par default=0 - if (is_numeric($thirdparty_seller->localtax1_assuj) && ! $thirdparty_seller->localtax1_assuj) return 0; - if (! is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj=='localtax1off') return 0; + if ($mysoc->country_code == 'ES') + { + if (is_numeric($thirdparty_buyer->localtax1_assuj) && ! $thirdparty_buyer->localtax1_assuj) return 0; + } + else + { + // Si vendeur non assujeti a Localtax1, localtax1 par default=0 + if (is_numeric($thirdparty_seller->localtax1_assuj) && ! $thirdparty_seller->localtax1_assuj) return 0; + if (! is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj=='localtax1off') return 0; + } } - elseif ($local==2) //IRPF + elseif ($local==2) //I Localtax 2 { - // Si vendeur non assujeti a IRPF, localtax2 par default=0 + // Si vendeur non assujeti a Localtax2, localtax2 par default=0 if (is_numeric($thirdparty_seller->localtax2_assuj) && ! $thirdparty_seller->localtax2_assuj) return 0; if (! is_numeric($thirdparty_seller->localtax2_assuj) && $thirdparty_seller->localtax2_assuj=='localtax2off') return 0; } From 0bed303596c08950f140e9af2f872e33a01bc176 Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 27 Nov 2012 17:54:42 +0100 Subject: [PATCH 20/21] Trad: Added english (arabi saudia) into ca_ES and es_ES --- htdocs/langs/ca_ES/languages.lang | 1 + htdocs/langs/es_ES/languages.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/langs/ca_ES/languages.lang b/htdocs/langs/ca_ES/languages.lang index d9716305d73..97b44e22cbe 100644 --- a/htdocs/langs/ca_ES/languages.lang +++ b/htdocs/langs/ca_ES/languages.lang @@ -12,6 +12,7 @@ Language_en_AU=Anglès (Australia) Language_en_GB=Anglès (Regne Unit) Language_en_IN=Anglès (Índia) Language_en_NZ=Anglais (Nova Zelanda) +Language_en_SA=Inglés (Aràbia Saudita) Language_en_US=Anglès (Estats Units) Language_es_ES=Espanyol Language_es_AR=Espanyol (Argentina) diff --git a/htdocs/langs/es_ES/languages.lang b/htdocs/langs/es_ES/languages.lang index bd9b00231ce..0e537271c37 100644 --- a/htdocs/langs/es_ES/languages.lang +++ b/htdocs/langs/es_ES/languages.lang @@ -14,6 +14,7 @@ Language_en_AU=Inglés (Australia) Language_en_GB=Inglés (Reino Unido) Language_en_IN=Inglés (India) Language_en_NZ=Inglés (Nueva Zelanda) +Language_en_SA=Inglés (Arabia Saudita) Language_en_US=Inglés (Estados Unidos) Language_es_ES=Español Language_es_AR=Español (Argentina) From 5c94912e66392cad97334b82fba80bb58c663159 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 27 Nov 2012 18:35:51 +0100 Subject: [PATCH 21/21] Add datehourpicker in editfieldval method to allow display of hour --- htdocs/core/class/html.form.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2cce0fcbdfa..f5110f53bf6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -165,6 +165,10 @@ class Form { $ret.=$this->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$value,$htmlname); } + else if ($typeofdata == 'datehourpicker') + { + $ret.=$this->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$value,$htmlname,1,1); + } else if (preg_match('/^select;/',$typeofdata)) { $arraydata=explode(',',preg_replace('/^select;/','',$typeofdata)); @@ -183,7 +187,7 @@ class Form $ret.=$doleditor->Create(1); } $ret.=''; - if ($typeofdata != 'day' && $typeofdata != 'datepicker') $ret.=''; + if ($typeofdata != 'day' && $typeofdata != 'datepicker' && $typeofdata != 'datehourpicker') $ret.=''; $ret.='
'.$langs->trans('ThirdPartyName').'
'.$langs->trans('ThirdPartyName').'
'."\n"; $ret.=''."\n"; } @@ -192,6 +196,7 @@ class Form if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1); elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value); elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day'); + elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour'); else if (preg_match('/^select;/',$typeofdata)) { $arraydata=explode(',',preg_replace('/^select;/','',$typeofdata)); @@ -272,7 +277,7 @@ class Form if (! empty($tmp[1])) $inputOption=$tmp[1]; if (! empty($tmp[2])) $savemethod=$tmp[2]; } - else if (preg_match('/^datepicker/',$inputType)) + else if ((preg_match('/^datepicker/',$inputType)) || (preg_match('/^datehourpicker/',$inputType))) { $tmp=explode(':',$inputType); $inputType=$tmp[0]; @@ -2612,9 +2617,11 @@ class Form * @param string $page Page * @param string $selected Date preselected * @param string $htmlname Name of input html field + * @param int $displayhour Display hour selector + * @param int $displaymin Display minutes selector * @return void */ - function form_date($page, $selected, $htmlname) + function form_date($page, $selected, $htmlname,$displayhour=0,$displaymin=0) { global $langs; @@ -2625,7 +2632,7 @@ class Form print ''; print ''; print ''; print ''; print '
'; - print $this->select_date($selected,$htmlname,0,0,1,'form'.$htmlname); + print $this->select_date($selected,$htmlname,$displayhour,$displaymin,1,'form'.$htmlname); print '
';