Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/accountancy/admin/productaccount.php
	htdocs/compta/facture/card.php
	htdocs/contrat/class/contrat.class.php
	htdocs/core/actions_addupdatedelete.inc.php
	htdocs/product/class/product.class.php
	htdocs/product/price.php
	htdocs/projet/tasks/time.php
This commit is contained in:
Laurent Destailleur 2020-11-01 17:58:41 +01:00
commit e0ed89c514
24 changed files with 143 additions and 86 deletions

View File

@ -610,7 +610,7 @@ if ($result)
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy; if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy;
$codesell = length_accountg($obj->accountancy_code_buy); $codesell = length_accountg($obj->accountancy_code_buy);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid 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 '</td>'; print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
// Accounting account buy intra (In EEC) // Accounting account buy intra (In EEC)
@ -620,7 +620,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_buy_intra); $codesell = length_accountg($obj->accountancy_code_buy_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid 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 '</td>'; print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
// Accounting account buy export (Out of EEC) // Accounting account buy export (Out of EEC)
@ -630,7 +630,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_buy_export); $codesell = length_accountg($obj->accountancy_code_buy_export);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid 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 '</td>'; print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
// Accounting account sell // Accounting account sell
@ -640,7 +640,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_sell); $codesell = length_accountg($obj->accountancy_code_sell);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid 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 '</td>'; print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
// Accounting account sell intra (In EEC) // Accounting account sell intra (In EEC)
@ -650,7 +650,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_sell_intra); $codesell = length_accountg($obj->accountancy_code_sell_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid 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 '</td>'; print '</td>';
} else { } else {
// Accounting account sell export (Out of EEC) // Accounting account sell export (Out of EEC)
@ -659,13 +659,13 @@ if ($result)
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell; if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_export); $codesell = length_accountg($obj->accountancy_code_sell_export);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid 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 '</td>'; print '</td>';
} }
// Checkbox select // Checkbox select
print '<td class="center">'; print '<td class="center">';
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="'.$obj->rowid.'"/></td>'; print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" value="'.$obj->rowid.'"/></td>';
print "</tr>"; print "</tr>";
$i++; $i++;
} }
@ -689,7 +689,17 @@ if ($result)
if (atleastoneselected) jQuery("#changeaccount").attr(\'class\',\'button\'); if (atleastoneselected) jQuery("#changeaccount").attr(\'class\',\'button\');
else 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(); init_savebutton();
}); });

View File

@ -664,6 +664,7 @@ if (empty($reshook))
$outputlangs->load('products'); $outputlangs->load('products');
} }
$model = $object->model_pdf; $model = $object->model_pdf;
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);

View File

@ -2487,7 +2487,7 @@ class Facture extends CommonInvoice
$this->db->begin(); $this->db->begin();
// Check parameters // 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 // Controle que facture source connue
if ($this->fk_facture_source <= 0) if ($this->fk_facture_source <= 0)
@ -2497,7 +2497,7 @@ class Facture extends CommonInvoice
return -10; return -10;
} }
// Charge la facture source a remplacer // Load source invoice that has been replaced
$facreplaced = new Facture($this->db); $facreplaced = new Facture($this->db);
$result = $facreplaced->fetch($this->fk_facture_source); $result = $facreplaced->fetch($this->fk_facture_source);
if ($result <= 0) if ($result <= 0)
@ -2507,7 +2507,7 @@ class Facture extends CommonInvoice
return -11; 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'); $idreplacement = $facreplaced->getIdReplacingInvoice('validated');
if ($idreplacement && $idreplacement != $this->id) if ($idreplacement && $idreplacement != $this->id)
{ {
@ -4319,15 +4319,14 @@ class Facture extends CommonInvoice
* @param int $hidedetails Hide details of lines * @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description * @param int $hidedesc Hide description
* @param int $hideref Hide ref * @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 * @return int <0 if KO, >0 if OK
*/ */
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{ {
global $conf, $langs; global $conf, $langs;
$langs->load("bills"); $outputlangs->loadLangs(array("bills", "products"));
$outputlangs->load("products");
if (!dol_strlen($modele)) if (!dol_strlen($modele))
{ {

View File

@ -231,6 +231,9 @@ if ($socid) $sql .= " AND f.fk_soc = ".$socid;
$sql .= " GROUP BY u.rowid, u.lastname, u.firstname"; $sql .= " GROUP BY u.rowid, u.lastname, u.firstname";
$sql .= " ORDER BY u.rowid"; $sql .= " ORDER BY u.rowid";
$amount = array();
dol_syslog("cabyuser", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);

View File

@ -287,6 +287,8 @@ $sql .= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays";
$sql .= " ORDER BY s.rowid"; $sql .= " ORDER BY s.rowid";
//echo $sql; //echo $sql;
$amount = array();
dol_syslog("casoc", LOG_DEBUG); dol_syslog("casoc", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {

View File

@ -1224,8 +1224,8 @@ class Contrat extends CommonObject
} }
} }
if (!$error) // Delete lines
{ if (!$error) {
// Delete contratdet extrafields // Delete contratdet extrafields
$main = MAIN_DB_PREFIX.'contratdet'; $main = MAIN_DB_PREFIX.'contratdet';
$ef = $main."_extrafields"; $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) if (!$error)
{ {
// Delete contrat
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat";
$sql .= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;

View File

@ -310,6 +310,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$model = $object->model_pdf; $model = $object->model_pdf;
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);

View File

@ -7723,7 +7723,7 @@ class Form
$(document).ready(function() { $(document).ready(function() {
$("#' . $cssclass.'s").click(function() { $("#' . $cssclass.'s").click(function() {
if($(this).is(\':checked\')){ 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\'); $(".'.$cssclass.'").prop(\'checked\', true).trigger(\'change\');
} }
else else

View File

@ -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]; $dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -248,6 +248,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
} }
} }
$object->fetch_thirdparty();
$dir = $conf->commande->multidir_output[$object->entity]; $dir = $conf->commande->multidir_output[$object->entity];
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -234,6 +234,8 @@ class doc_generic_contract_odt extends ModelePDFContract
} }
} }
$object->fetch_thirdparty();
$dir = $conf->contrat->dir_output; $dir = $conf->contrat->dir_output;
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -248,6 +248,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
} }
} }
$object->fetch_thirdparty();
$dir = $conf->expedition->dir_output."/sending"; $dir = $conf->expedition->dir_output."/sending";
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -247,6 +247,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
} }
} }
$object->fetch_thirdparty();
$dir = $conf->facture->dir_output; $dir = $conf->facture->dir_output;
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -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]; $dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1];
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -512,6 +512,8 @@ class doc_generic_project_odt extends ModelePDFProjects
} }
} }
$object->fetch_thirdparty();
$dir = $conf->projet->dir_output; $dir = $conf->projet->dir_output;
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -276,6 +276,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales
} }
} }
$object->fetch_thirdparty();
$dir = $conf->propal->multidir_output[$object->entity]; $dir = $conf->propal->multidir_output[$object->entity];
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -240,6 +240,8 @@ class doc_generic_reception_odt extends ModelePdfReception
} }
} }
$object->fetch_thirdparty();
$dir = $conf->reception->dir_output."/reception"; $dir = $conf->reception->dir_output."/reception";
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -274,6 +274,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
} }
} }
$object->fetch_thirdparty();
$dir = $conf->supplier_proposal->dir_output; $dir = $conf->supplier_proposal->dir_output;
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -256,6 +256,8 @@ class doc_generic_user_odt extends ModelePDFUser
} }
} }
$object->fetch_thirdparty();
$dir = $conf->user->dir_output; $dir = $conf->user->dir_output;
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;

View File

@ -36,7 +36,7 @@ create table llx_facturedet
localtax1_type varchar(10) NULL, -- localtax1 type localtax1_type varchar(10) NULL, -- localtax1 type
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
localtax2_type varchar(10) NULL, -- localtax2 type 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_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
remise real DEFAULT 0, -- Montant calcule de la remise % sur PU HT (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 fk_remise_except integer NULL, -- Lien vers table des remises fixes

View File

@ -287,6 +287,7 @@ PriceExpressionEditorHelp5=Available global values:
PriceMode=Price mode PriceMode=Price mode
PriceNumeric=Number PriceNumeric=Number
DefaultPrice=Default price DefaultPrice=Default price
DefaultPriceLog=Log of previous default prices
ComposedProductIncDecStock=Increase/Decrease stock on parent change ComposedProductIncDecStock=Increase/Decrease stock on parent change
ComposedProduct=Child products ComposedProduct=Child products
MinSupplierPrice=Minimum buying price MinSupplierPrice=Minimum buying price

View File

@ -1590,7 +1590,7 @@ class Product extends CommonObject
* *
* @param Societe $thirdparty_seller Seller * @param Societe $thirdparty_seller Seller
* @param Societe $thirdparty_buyer Buyer * @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, ...) * @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() * @see get_buyprice(), find_min_price_product_fournisseur()
*/ */

View File

@ -1443,16 +1443,13 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
$num = $db->num_rows($result); $num = $db->num_rows($result);
} }
if ($num > 0) if ($num > 0) {
{
// Default prices or // Default prices or
// Log of previous customer prices // Log of previous customer prices
$backbutton = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'.$langs->trans("Back").'</a>'; $backbutton = '<a class="justalink" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'.$langs->trans("Back").'</a>';
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'); 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 '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -2062,7 +2059,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print img_info($langs->trans('PriceByCustomerLog')); print img_info($langs->trans('PriceByCustomerLog'));
print '</a>'; print '</a>';
print ' '; print ' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=edit_price&amp;id='.$object->id.'">'; print '<a class="marginleftonly editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit_price&amp;id='.$object->id.'">';
print img_edit('default', 0, 'style="vertical-align: middle;"'); print img_edit('default', 0, 'style="vertical-align: middle;"');
print '</a>'; print '</a>';
print ' &nbsp; '; print ' &nbsp; ';
@ -2144,11 +2141,11 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print img_info($langs->trans('PriceByCustomerLog')); print img_info($langs->trans('PriceByCustomerLog'));
print '</a>'; print '</a>';
print ' '; print ' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=edit_customer_price&amp;id='.$object->id.'&amp;lineid='.$line->id.'">'; print '<a class="marginleftonly editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit_customer_price&amp;id='.$object->id.'&amp;lineid='.$line->id.'">';
print img_edit('default', 0, 'style="vertical-align: middle;"'); print img_edit('default', 0, 'style="vertical-align: middle;"');
print '</a>'; print '</a>';
print ' '; print ' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete_customer_price&amp;token='.newToken().'&amp;id='.$object->id.'&amp;lineid='.$line->id.'">'; print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?action=delete_customer_price&amp;token='.newToken().'&amp;id='.$object->id.'&amp;lineid='.$line->id.'">';
print img_delete('default', 'style="vertical-align: middle;"'); print img_delete('default', 'style="vertical-align: middle;"');
print '</a>'; print '</a>';
print '</td>'; print '</td>';

View File

@ -333,9 +333,7 @@ if ($action == 'confirm_generateinvoice')
{ {
if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
if (!($projectstatic->thirdparty->id > 0)) {
if (!($projectstatic->thirdparty->id > 0))
{
setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors'); setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors');
} else { } else {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -371,6 +369,7 @@ if ($action == 'confirm_generateinvoice')
$prodDurationHours *= $tmpproduct->duration_value; $prodDurationHours *= $tmpproduct->duration_value;
$dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0); $dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0);
$pu_ht = empty($dataforprice['pu_ht']) ? 0 : $dataforprice['pu_ht']; $pu_ht = empty($dataforprice['pu_ht']) ? 0 : $dataforprice['pu_ht'];
$txtva = $dataforprice['tva_tx']; $txtva = $dataforprice['tva_tx'];
$localtax1 = $dataforprice['localtax1']; $localtax1 = $dataforprice['localtax1'];
@ -916,69 +915,79 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print '<input type="hidden" name="withproject" value="'.$withproject.'">'; print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="tab" value="'.$tab.'">'; print '<input type="hidden" name="tab" value="'.$tab.'">';
// Form to convert time spent into invoice
if ($massaction == 'generateinvoice') if ($massaction == 'generateinvoice')
{ {
//var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">'; print '<input type="hidden" name="massaction" value="confirm_createbills">';
print '<table class="noborder" width="100%" >'; if ($projectstatic->thirdparty->id > 0) {
print '<tr>'; print '<table class="noborder" width="100%" >';
print '<td class="titlefield">';
print $langs->trans('DateInvoice');
print '</td>';
print '<td>';
print $form->selectDate('', '', '', '', '', '', 1, 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print $langs->trans('Mode');
print '</td>';
print '<td>';
$tmparray = array(
'onelineperuser'=>'OneLinePerUser',
'onelinepertask'=>'OneLinePerTask',
'onelineperperiod'=>'OneLinePerPeriod',
);
print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1);
print '</td>';
print '</tr>';
if ($conf->service->enabled)
{
print '<tr>'; print '<tr>';
print '<td>'; print '<td class="titlefield">';
print $langs->trans('ServiceToUseOnLines'); print $langs->trans('DateInvoice');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500'); print $form->selectDate('', '', '', '', '', '', 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
}
print '<tr>';
print '<td class="titlefield">';
print $langs->trans('InvoiceToUse');
print '</td>';
print '<td>';
$form->selectInvoice('invoice', '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'),
1, 0, 0, 'maxwidth500', '', 'all');
print '</td>';
print '</tr>';
/*print '<tr>';
print '<td>';
print $langs->trans('ValidateInvoices');
print '</td>';
print '<td>';
print $form->selectyesno('validate_invoices', 0, 1);
print '</td>';
print '</tr>';*/
print '</table>';
print '<br>'; print '<tr>';
print '<div class="center">'; print '<td>';
print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('GenerateBill').'"> '; print $langs->trans('Mode');
print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">'; print '</td>';
print '</div>'; print '<td>';
print '<br>'; $tmparray = array(
'onelineperuser'=>'OneLinePerUser',
'onelinepertask'=>'OneLinePerTask',
'onelineperperiod'=>'OneLinePerPeriod',
);
print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1);
print '</td>';
print '</tr>';
if ($conf->service->enabled)
{
print '<tr>';
print '<td>';
print $langs->trans('ServiceToUseOnLines');
print '</td>';
print '<td>';
$form->select_produits('', 'productid', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 0, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500');
print '</td>';
print '</tr>';
}
print '<tr>';
print '<td class="titlefield">';
print $langs->trans('InvoiceToUse');
print '</td>';
print '<td>';
$form->selectInvoice('invoice', '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), 1, 0, 0, 'maxwidth500', '', 'all');
print '</td>';
print '</tr>';
/*print '<tr>';
print '<td>';
print $langs->trans('ValidateInvoices');
print '</td>';
print '<td>';
print $form->selectyesno('validate_invoices', 0, 1);
print '</td>';
print '</tr>';*/
print '</table>';
print '<br>';
print '<div class="center">';
print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('GenerateBill').'"> ';
print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</div>';
print '<br>';
} else {
print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateInvoice").'</div>';
print '<div class="center">';
print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</div>';
$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) if ($action == 'createtime' && $user->rights->projet->lire)
{ {