diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 3c0523ac877..e09f6ec14cf 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -610,7 +610,7 @@ if ($result) if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy; $codesell = length_accountg($obj->accountancy_code_buy); if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid - print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); + print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect'); print ''; } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { // Accounting account buy intra (In EEC) @@ -620,7 +620,7 @@ if ($result) $codesell = length_accountg($obj->accountancy_code_buy_intra); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid - print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); + print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect'); print ''; } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { // Accounting account buy export (Out of EEC) @@ -630,7 +630,7 @@ if ($result) $codesell = length_accountg($obj->accountancy_code_buy_export); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid - print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); + print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect'); print ''; } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') { // Accounting account sell @@ -640,7 +640,7 @@ if ($result) $codesell = length_accountg($obj->accountancy_code_sell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid - print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); + print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect'); print ''; } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { // Accounting account sell intra (In EEC) @@ -650,7 +650,7 @@ if ($result) $codesell = length_accountg($obj->accountancy_code_sell_intra); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid - print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); + print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect'); print ''; } else { // Accounting account sell export (Out of EEC) @@ -659,13 +659,13 @@ if ($result) if (empty($defaultvalue)) $defaultvalue = $compta_prodsell; $codesell = length_accountg($obj->accountancy_code_sell_export); if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid - print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); + print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect'); print ''; } // Checkbox select print ''; - print ''; + print ''; print ""; $i++; } @@ -689,7 +689,17 @@ if ($result) if (atleastoneselected) jQuery("#changeaccount").attr(\'class\',\'button\'); else jQuery("#changeaccount").attr(\'class\',\'button\'); } - jQuery(".checkforselect, #checkallactions").click(function() { + + jQuery(".checkforselect").change(function() { + init_savebutton(); + }); + jQuery(".productforselect").change(function() { + console.log($(this).attr("id")+" "+$(this).val()); + if ($(this).val() && $(this).val() != -1) { + $(".productforselect"+$(this).attr("id")).prop(\'checked\', true); + } else { + $(".productforselect"+$(this).attr("id")).prop(\'checked\', false); + } init_savebutton(); }); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index bd06f9b0967..4ff1975b1f3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -664,6 +664,7 @@ if (empty($reshook)) $outputlangs->load('products'); } $model = $object->model_pdf; + $ret = $object->fetch($id); // Reload to get new records $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6946891795e..78f91d0796f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2487,7 +2487,7 @@ class Facture extends CommonInvoice $this->db->begin(); // Check parameters - if ($this->type == self::TYPE_REPLACEMENT) // si facture de remplacement + if ($this->type == self::TYPE_REPLACEMENT) // if this is a replacement invoice { // Controle que facture source connue if ($this->fk_facture_source <= 0) @@ -2497,7 +2497,7 @@ class Facture extends CommonInvoice return -10; } - // Charge la facture source a remplacer + // Load source invoice that has been replaced $facreplaced = new Facture($this->db); $result = $facreplaced->fetch($this->fk_facture_source); if ($result <= 0) @@ -2507,7 +2507,7 @@ class Facture extends CommonInvoice return -11; } - // Controle que facture source non deja remplacee par une autre + // Check that source invoice not already replaced by another one. $idreplacement = $facreplaced->getIdReplacingInvoice('validated'); if ($idreplacement && $idreplacement != $this->id) { @@ -4319,15 +4319,14 @@ class Facture extends CommonInvoice * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param null|array $moreparams Array to provide more information * @return int <0 if KO, >0 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf, $langs; - $langs->load("bills"); - $outputlangs->load("products"); + $outputlangs->loadLangs(array("bills", "products")); if (!dol_strlen($modele)) { diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index e04f63142d3..2e46e306030 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -231,6 +231,9 @@ if ($socid) $sql .= " AND f.fk_soc = ".$socid; $sql .= " GROUP BY u.rowid, u.lastname, u.firstname"; $sql .= " ORDER BY u.rowid"; +$amount = array(); + +dol_syslog("cabyuser", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 72cb09c3791..8fa06046076 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -287,6 +287,8 @@ $sql .= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays"; $sql .= " ORDER BY s.rowid"; //echo $sql; +$amount = array(); + dol_syslog("casoc", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index acc4c8323dd..6c8024be4db 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1224,8 +1224,8 @@ class Contrat extends CommonObject } } - if (!$error) - { + // Delete lines + if (!$error) { // Delete contratdet extrafields $main = MAIN_DB_PREFIX.'contratdet'; $ef = $main."_extrafields"; @@ -1255,9 +1255,21 @@ class Contrat extends CommonObject } } + // Delete llx_ecm_files + if (!$error) { + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id; + $resql = $this->db->query($sql); + if (!$resql) + { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + $error++; + } + } + + // Delete contract if (!$error) { - // Delete contrat $sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat"; $sql .= " WHERE rowid=".$this->id; diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 45f0fb8613e..80228628c61 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -310,6 +310,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) $outputlangs->setDefaultLang($newlang); } $model = $object->model_pdf; + $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index cb8416276bc..5c457a2a28c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7723,7 +7723,7 @@ class Form $(document).ready(function() { $("#' . $cssclass.'s").click(function() { if($(this).is(\':checked\')){ - console.log("We check all '.$cssclass.'"); + console.log("We check all '.$cssclass.' and trigger the change method"); $(".'.$cssclass.'").prop(\'checked\', true).trigger(\'change\'); } else diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index de6f312b783..750f1a7ab39 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -236,6 +236,8 @@ class doc_generic_bom_odt extends ModelePDFBom } } + $object->fetch_thirdparty(); + $dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 0519e4ec16c..eb2c8121397 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -248,6 +248,8 @@ class doc_generic_order_odt extends ModelePDFCommandes } } + $object->fetch_thirdparty(); + $dir = $conf->commande->multidir_output[$object->entity]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 6fc5b6cb310..7a0b1f91109 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -234,6 +234,8 @@ class doc_generic_contract_odt extends ModelePDFContract } } + $object->fetch_thirdparty(); + $dir = $conf->contrat->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index f1c37091ffc..039ef128cd7 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -248,6 +248,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } } + $object->fetch_thirdparty(); + $dir = $conf->expedition->dir_output."/sending"; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 6ea0f3a7a29..1d4b65fdb32 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -247,6 +247,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures } } + $object->fetch_thirdparty(); + $dir = $conf->facture->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 7886fc312a1..84f225dfb6e 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -243,6 +243,8 @@ class doc_generic_mo_odt extends ModelePDFMo } } + $object->fetch_thirdparty(); + $dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index e9d510fad09..c6e07911ff7 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -512,6 +512,8 @@ class doc_generic_project_odt extends ModelePDFProjects } } + $object->fetch_thirdparty(); + $dir = $conf->projet->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index cd7fcf3f01a..59df720269b 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -276,6 +276,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales } } + $object->fetch_thirdparty(); + $dir = $conf->propal->multidir_output[$object->entity]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 279ffca4d95..45bfabe4b62 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -240,6 +240,8 @@ class doc_generic_reception_odt extends ModelePdfReception } } + $object->fetch_thirdparty(); + $dir = $conf->reception->dir_output."/reception"; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 105495fe8a4..b5efe6801ff 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -274,6 +274,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } } + $object->fetch_thirdparty(); + $dir = $conf->supplier_proposal->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 611ace7cd66..2f534f86813 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -256,6 +256,8 @@ class doc_generic_user_odt extends ModelePDFUser } } + $object->fetch_thirdparty(); + $dir = $conf->user->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 73e64fa1c6a..3b1ea86cc0e 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -36,7 +36,7 @@ create table llx_facturedet localtax1_type varchar(10) NULL, -- localtax1 type localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate localtax2_type varchar(10) NULL, -- localtax2 type - qty real, -- Quantity (exemple 2) + qty real, -- Quantity (exemple 2). Note: for credit note, the price is negative, not the quantity. Like for discount, price is negative, not quantity. remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%) remise real DEFAULT 0, -- Montant calcule de la remise % sur PU HT (exemple 20) fk_remise_except integer NULL, -- Lien vers table des remises fixes diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 3077021aad6..97db059594f 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -287,6 +287,7 @@ PriceExpressionEditorHelp5=Available global values: PriceMode=Price mode PriceNumeric=Number DefaultPrice=Default price +DefaultPriceLog=Log of previous default prices ComposedProductIncDecStock=Increase/Decrease stock on parent change ComposedProduct=Child products MinSupplierPrice=Minimum buying price diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index da9bf4e1ebd..c3c07504a99 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1590,7 +1590,7 @@ class Product extends CommonObject * * @param Societe $thirdparty_seller Seller * @param Societe $thirdparty_buyer Buyer - * @param int $pqp Id of product per price if a selection was done of such a price + * @param int $pqp Id of product price per quantity if a selection was done of such a price * @return array Array of price information array('pu_ht'=> , 'pu_ttc'=> , 'tva_tx'=>'X.Y (code)', ...), 'tva_npr'=>0, ...) * @see get_buyprice(), find_min_price_product_fournisseur() */ diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 325fce0ead0..9c9fa653a60 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1443,16 +1443,13 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul $num = $db->num_rows($result); } - if ($num > 0) - { + if ($num > 0) { // Default prices or // Log of previous customer prices - $backbutton = ''.$langs->trans("Back").''; + $backbutton = ''.$langs->trans("Back").''; - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"), 0, $_SERVER["PHP_SELF"], '', '', '', $backbutton, 0, $num, 'title_accountancy.png'); + if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPriceLog"), 0, $_SERVER["PHP_SELF"], '', '', '', $backbutton, 0, $num, 'title_accountancy.png'); else print_barre_liste($langs->trans("PriceByCustomerLog"), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, $num, 'title_accountancy.png'); - //if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png'); - //else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png'); print '
'; print ''; @@ -2062,7 +2059,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print img_info($langs->trans('PriceByCustomerLog')); print ''; print ' '; - print 'id.'">'; + print 'id.'">'; print img_edit('default', 0, 'style="vertical-align: middle;"'); print ''; print '   '; @@ -2144,11 +2141,11 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print img_info($langs->trans('PriceByCustomerLog')); print ''; print ' '; - print 'id.'&lineid='.$line->id.'">'; + print 'id.'&lineid='.$line->id.'">'; print img_edit('default', 0, 'style="vertical-align: middle;"'); print ''; print ' '; - print 'id.'&lineid='.$line->id.'">'; + print 'id.'&lineid='.$line->id.'">'; print img_delete('default', 'style="vertical-align: middle;"'); print ''; print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3ed6db6a105..28bb941c687 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -333,9 +333,7 @@ if ($action == 'confirm_generateinvoice') { if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); - - if (!($projectstatic->thirdparty->id > 0)) - { + if (!($projectstatic->thirdparty->id > 0)) { setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors'); } else { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -371,6 +369,7 @@ if ($action == 'confirm_generateinvoice') $prodDurationHours *= $tmpproduct->duration_value; $dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0); + $pu_ht = empty($dataforprice['pu_ht']) ? 0 : $dataforprice['pu_ht']; $txtva = $dataforprice['tva_tx']; $localtax1 = $dataforprice['localtax1']; @@ -916,69 +915,79 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; print ''; + // Form to convert time spent into invoice if ($massaction == 'generateinvoice') { - //var_dump($_REQUEST); print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($conf->service->enabled) - { + if ($projectstatic->thirdparty->id > 0) { + print '
'; - print $langs->trans('DateInvoice'); - print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); - print '
'; - print $langs->trans('Mode'); - print ''; - $tmparray = array( - 'onelineperuser'=>'OneLinePerUser', - 'onelinepertask'=>'OneLinePerTask', - 'onelineperperiod'=>'OneLinePerPeriod', - ); - print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); - print '
'; print ''; - print ''; print ''; print ''; - } - print ''; - print ''; - print ''; - print ''; - /*print ''; - print ''; - print ''; - print '';*/ - print '
'; - print $langs->trans('ServiceToUseOnLines'); + print ''; + print $langs->trans('DateInvoice'); print ''; - $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500'); + print $form->selectDate('', '', '', '', '', '', 1, 1); print '
'; - print $langs->trans('InvoiceToUse'); - print ''; - $form->selectInvoice('invoice', '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), - 1, 0, 0, 'maxwidth500', '', 'all'); - print '
'; - print $langs->trans('ValidateInvoices'); - print ''; - print $form->selectyesno('validate_invoices', 0, 1); - print '
'; - print '
'; - print '
'; - print ' '; - print ''; - print '
'; - print '
'; + print ''; + print ''; + print $langs->trans('Mode'); + print ''; + print ''; + $tmparray = array( + 'onelineperuser'=>'OneLinePerUser', + 'onelinepertask'=>'OneLinePerTask', + 'onelineperperiod'=>'OneLinePerPeriod', + ); + print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); + print ''; + print ''; + + if ($conf->service->enabled) + { + print ''; + print ''; + print $langs->trans('ServiceToUseOnLines'); + print ''; + print ''; + $form->select_produits('', 'productid', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 0, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500'); + print ''; + print ''; + } + + print ''; + print ''; + print $langs->trans('InvoiceToUse'); + print ''; + print ''; + $form->selectInvoice('invoice', '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), 1, 0, 0, 'maxwidth500', '', 'all'); + print ''; + print ''; + /*print ''; + print ''; + print $langs->trans('ValidateInvoices'); + print ''; + print ''; + print $form->selectyesno('validate_invoices', 0, 1); + print ''; + print '';*/ + print ''; + + print '
'; + print '
'; + print ' '; + print ''; + print '
'; + print '
'; + } else { + print '
'.$langs->trans("ThirdPartyRequiredToGenerateInvoice").'
'; + print '
'; + print ''; + print '
'; + $massaction = ''; + } } /* @@ -1065,7 +1074,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } /* - * Form to add time spent + * Form to add a new line of time spent */ if ($action == 'createtime' && $user->rights->projet->lire) {