Merge pull request #13145 from atm-john/12.0_new_extend_retained_warranty

NEW : Extend retained warranty to be  available for all invoices
This commit is contained in:
Laurent Destailleur 2020-04-18 15:32:33 +02:00 committed by GitHub
commit 2f2e3d5057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 633 additions and 595 deletions

View File

@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
if (!$user->admin) accessforbidden();
if (! $user->admin) accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'invoice';
$type='invoice';
/*
@ -57,17 +57,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
* View
*/
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader(
"", $langs->trans("BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
);
$form = new Form($db);
$form=new Form($db);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
$head = invoice_admin_prepare_head();
@ -96,7 +96,26 @@ print "</tr>\n";
_printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices'));
_printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote'));
_printOnOff('INVOICE_USE_SITUATION_RETAINED_WARRANTY', $langs->trans('Retainedwarranty'));
//_printOnOff('INVOICE_USE_RETAINED_WARRANTY', $langs->trans('Retainedwarranty'));
$confkey = 'INVOICE_USE_RETAINED_WARRANTY';
$arrayAvailableType = array(
Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation"),
Facture::TYPE_STANDARD.'+'.Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation").' + '.$langs->trans("InvoiceStandard"),
);
$selected = array();
$implodeglue = '+';
if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){
$selected = explode('+', $conf->global->{$confkey});
}
$curentInput = (empty($inputCount)?1:($inputCount+1));
$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1);
_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType);
//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituationFinal'));
$metas = array(
'type' => 'number',
@ -107,7 +126,7 @@ $metas = array(
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
// Conditions paiements
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
$inputCount = empty($inputCount)?1:($inputCount+1);
print '<tr class="oddeven">';
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
print '<td class="center" width="20">&nbsp;</td>';
@ -159,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '')
global $langs;
print '<tr class="oddeven">';
print '<td>'.($title ? $title : $langs->trans($confkey));
print '<td>'.($title?$title:$langs->trans($confkey));
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
@ -187,14 +206,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
{
global $langs, $conf, $db, $inputCount;
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
$form = new Form($db);
$inputCount = empty($inputCount)?1:($inputCount+1);
$form=new Form($db);
$defaultMetas = array(
'name' => 'value'.$inputCount
);
if ($type != 'textarea') {
if ($type!='textarea') {
$defaultMetas['type'] = 'text';
$defaultMetas['value'] = $conf->global->{$confkey};
}
@ -210,9 +229,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<td>';
if (!empty($help)) {
print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
} else {
print $title ? $title : $langs->trans($confkey);
print $title?$title:$langs->trans($confkey);
}
if (!empty($desc)) {
@ -225,10 +244,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
print '<input type="hidden" name="action" value="setModuleOptions">';
if ($type == 'textarea') {
if ($type=='textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
} else {
}elseif($type=='input'){
print '<input '.$metascompil.' />';
}
else{
// custom
print $type;
}
print '</td></tr>';
}

View File

@ -139,6 +139,11 @@ if ($user->socid) $socid = $user->socid;
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
// retained warranty invoice available type
$retainedWarrantyInvoiceAvailableType=array();
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
}
/*
@ -947,7 +952,7 @@ if (empty($reshook))
}
$discount->tva_tx = abs($tva_tx);
$discount->vat_src_code = $vat_src_code;
$discount->vat_src_code =$vat_src_code;
$result = $discount->create($user);
if ($result < 0)
@ -1355,17 +1360,22 @@ if (empty($reshook))
$object->situation_counter = 1;
$object->situation_final = 0;
$object->situation_cycle_ref = $object->newCycle();
}
if(in_array($object->type, $retainedWarrantyInvoiceAvailableType)){
$object->retained_warranty = GETPOST('retained_warranty', 'int');
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) {
$object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
}
$object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
}
else{
$object->retained_warranty = 0;
$object->retained_warranty_fk_cond_reglement = 0;
}
$retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) {
$object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
}
$object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
$object->fetch_thirdparty();
@ -1756,21 +1766,32 @@ if (empty($reshook))
$object->fk_facture_source = $_POST['situations'];
$object->type = Facture::TYPE_SITUATION;
$object->retained_warranty = GETPOST('retained_warranty', 'int');
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) {
$object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
}
$object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
if (!empty($origin) && !empty($originid))
if (!empty($origin) && !empty($originid))
{
$object->origin = $origin;
$object->origin_id = $originid;
// retained warranty
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
{
$retained_warranty = GETPOST('retained_warranty', 'int');
if(price2num($retained_warranty) > 0)
{
$object->retained_warranty = price2num($retained_warranty);
}
if(GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
{
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
}
$retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) {
$object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
}
$object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
}
foreach ($object->lines as $i => &$line)
{
$line->origin = $object->origin;
@ -2608,10 +2629,10 @@ if (empty($reshook))
$pa_ht = $originLine->pa_ht;
$label = $originLine->label;
$array_options = $originLine->array_options;
if ($object->type == Facture::TYPE_SITUATION) {
if($object->type == Facture::TYPE_SITUATION){
$situation_percent = 0;
}
else {
else{
$situation_percent = 100;
}
$fk_prev_id = '';
@ -3371,54 +3392,55 @@ if ($action == 'create')
$form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
print '</td></tr>';
if (!empty($conf->global->INVOICE_USE_SITUATION))
{
if ($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) {
$rwStyle = 'display:none;';
if (GETPOST('type', 'int') == Facture::TYPE_SITUATION) {
$rwStyle = '';
}
$retained_warranty = GETPOST('retained_warranty', 'int');
if (empty($retained_warranty)) {
if (!empty($objectsrc->retained_warranty)) { // use previous situation value
$retained_warranty = $objectsrc->retained_warranty;
} else {
$retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
}
}
if($conf->global->INVOICE_USE_RETAINED_WARRANTY){
$rwStyle = 'display:none;';
if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){
$rwStyle = '';
}
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
$retained_warranty = GETPOST('retained_warranty', 'int');
if(empty($retained_warranty)){
if(!empty($objectsrc->retained_warranty)){ // use previous situation value
$retained_warranty = $objectsrc->retained_warranty;
}
}
$retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
// Retained warranty payment term
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
if (empty($retained_warranty_fk_cond_reglement)) {
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
} else {
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
}
}
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '</td></tr>';
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
print '<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("[name=\'type\'").change(function() {
if($( this ).prop("checked") && $( this ).val() == '.Facture::TYPE_SITUATION.')
{
$(".retained-warranty-line").show();
}
else{
$(".retained-warranty-line").hide();
}
});
});
</script>';
}
// Retained warranty payment term
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
if(empty($retained_warranty_fk_cond_reglement)){
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
}else{
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
}
}
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '</td></tr>';
print '<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("[name=\'type\']").change(function() {
if($( this ).prop("checked") && $.inArray($( this ).val(), '.json_encode($retainedWarrantyInvoiceAvailableType).' ) !== -1)
{
$(".retained-warranty-line").show();
$("#new-situation-invoice-retained-warranty").val("'.doubleval($retained_warranty_js_default).'");
}
else{
$(".retained-warranty-line").hide();
$("#new-situation-invoice-retained-warranty").val("");
}
});
$("[name=\'type\']").trigger("change");
});
</script>';
}
// Payment mode
@ -4333,89 +4355,82 @@ elseif ($id > 0 || !empty($ref))
print '</td></tr>';
}
$displayWarranty = false;
if (($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY))))
{
// Check if this situation invoice is 100% for real
if (!empty($object->situation_final) && !empty($object->lines)) {
$displayWarranty = true;
foreach ($object->lines as $i => $line) {
if ($line->product_type < 2 && $line->situation_percent < 100) {
$displayWarranty = false;
break;
}
}
}
if(!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
// Retained Warranty
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RetainedWarranty');
print '</td>';
if ($action != 'editretainedwarranty' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarranty&amp;facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'</a></td>';
}
$displayWarranty = true;
if(!in_array($object->type, $retainedWarrantyInvoiceAvailableType) && empty($object->retained_warranty)){
$displayWarranty = false;
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editretainedwarranty')
{
print '<form id="retained-warranty-form" method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarranty">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input name="retained_warranty" type="number" step="0.01" min="0" max="100" value="'.$object->retained_warranty.'" >';
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
print price($object->retained_warranty).'%';
}
print '</td></tr>';
if($displayWarranty)
{
// Retained warranty payment term
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShortRetainedWarranty');
print '</td>';
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantypaymentterms&amp;facid='.$object->id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'</a></td>';
}
// Retained Warranty
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RetainedWarranty');
print '</td>';
if ($action != 'editretainedwarranty' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarranty&amp;facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
$defaultDate = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : strtotime('-1 years', $object->date_lim_reglement);
if ($object->date > $defaultDate) {
$defaultDate = $object->date;
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editretainedwarranty')
{
print '<form id="retained-warranty-form" method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarranty">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input name="retained_warranty" type="number" step="0.01" min="0" max="100" value="'.$object->retained_warranty.'" >';
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
print price($object->retained_warranty).'%';
}
print '</td></tr>';
if ($action == 'editretainedwarrantypaymentterms')
{
//date('Y-m-d',$object->date_lim_reglement)
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarrantyconditions">';
print '<input type="hidden" name="token" value="'.newToken().'">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement;
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
if (!$displayWarranty) {
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
}
}
print '</td></tr>';
// Retained warranty payment term
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShortRetainedWarranty');
print '</td>';
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantypaymentterms&amp;facid='.$object->id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
$defaultDate = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : strtotime('-1 years', $object->date_lim_reglement);
if ($object->date > $defaultDate) {
$defaultDate = $object->date;
}
if ($action == 'editretainedwarrantypaymentterms')
{
//date('Y-m-d',$object->date_lim_reglement)
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
print '<input type="hidden" name="action" value="setretainedwarrantyconditions">';
print '<input type="hidden" name="token" value="'.newToken().'">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement;
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
if (!$displayWarranty) {
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
}
}
print '</td></tr>';
if ($displayWarranty)
{
// Retained Warranty payment date limit
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-date-limit-table" class="nobordernopadding" width="100%"><tr><td>';

View File

@ -302,9 +302,9 @@ class Facture extends CommonInvoice
'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230),
'situation_counter' =>array('type'=>'smallint(6)', 'label'=>'Situation counter', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>235),
'situation_final' =>array('type'=>'smallint(6)', 'label'=>'Situation final', 'enabled'=>'empty($conf->global->INVOICE_USE_SITUATION) ? 0 : 1', 'visible'=>-1, 'position'=>240),
'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245),
'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250),
'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255),
'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245),
'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250),
'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255),
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260),
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265),
'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270),
@ -813,12 +813,12 @@ class Facture extends CommonInvoice
$vatrate = $line->tva_tx;
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
if (!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
$originid = $line->origin_id;
$origintype = $line->origin;
if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
$originid=$line->origin_id;
$origintype=$line->origin;
} else {
$originid = $line->id;
$origintype = $this->element;
$originid=$line->id;
$origintype=$this->element;
}
$result = $this->addline(
@ -3733,44 +3733,44 @@ class Facture extends CommonInvoice
}
if (!empty($addon)) {
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG);
dol_syslog("Call getNextNumRef with " . $addonConstName . " = " . $conf->global->FACTURE_ADDON . ", thirdparty=" . $soc->nom . ", type=" . $soc->typent_code, LOG_DEBUG);
$mybool = false;
$file = $addon.'.php';
$file = $addon . '.php';
$classname = $addon;
// Include file with class
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir.'core/modules/'.$moduleName.'/');
$dir = dol_buildpath($reldir . 'core/modules/' . $moduleName . '/');
// Load file with numbering class (if found)
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir . $file;
}
}
// For compatibility
if (!$mybool) {
$file = $addon.'/'.$addon.'.modules.php';
$classname = 'mod_'.$moduleName.'_'.$addon;
$file = $addon . '/' . $addon . '.modules.php';
$classname = 'mod_' . $moduleName . '_' . $addon;
$classname = preg_replace('/\-.*$/', '', $classname);
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot) {
$dir = $dirroot.'/core/modules/'.$moduleName.'/';
$dir = $dirroot . '/core/modules/' . $moduleName . '/';
// Load file with numbering class (if found)
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir . $file;
}
}
}
if (!$mybool) {
dol_print_error('', 'Failed to include file '.$file);
dol_print_error('', 'Failed to include file ' . $file);
return '';
}
@ -3789,7 +3789,7 @@ class Facture extends CommonInvoice
return $numref;
} else {
$langs->load('errors');
print $langs->trans('Error').' '.$langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
print $langs->trans('Error') . ' ' . $langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
return '';
}
}
@ -4742,6 +4742,43 @@ class Facture extends CommonInvoice
return $hasDelay;
}
/**
* Currently used for documents generation : to know if retained warranty need to be displayed
* @return bool
*/
public function displayRetainedWarranty()
{
global $conf;
// TODO : add a flag on invoices to store this conf : INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
$displayWarranty = false;
if(!empty($this->retained_warranty)) {
$displayWarranty = true;
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) {
// Check if this situation invoice is 100% for real
$displayWarranty = false;
if (!empty($this->situation_final)) {
$displayWarranty = true;
} elseif (!empty($this->lines) && $this->status == Facture::STATUS_DRAFT) {
// $object->situation_final need validation to be done so this test is need for draft
$displayWarranty = true;
foreach ($this->lines as $i => $line) {
if ($line->product_type < 2 && $line->situation_percent < 100) {
$displayWarranty = false;
break;
}
}
}
}
}
return $displayWarranty;
}
/**
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT)
@ -4757,7 +4794,7 @@ class Facture extends CommonInvoice
$retainedWarrantyAmount = 0;
// Billed - retained warranty
if ($this->type == Facture::TYPE_SITUATION)
if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
{
$displayWarranty = true;
// Check if this situation invoice is 100% for real
@ -4795,7 +4832,10 @@ class Facture extends CommonInvoice
if ($rounding < 0) {
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
return round($retainedWarrantyAmount, 2);
}
if($rounding>0){
return round($retainedWarrantyAmount, $rounding);
}
return $retainedWarrantyAmount;

View File

@ -208,7 +208,7 @@ $arrayfields = array(
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY)
{
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86);
}
@ -1137,7 +1137,7 @@ if ($resql)
$facturestatic->note_public = $obj->note_public;
$facturestatic->note_private = $obj->note_private;
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY)
{
$facturestatic->retained_warranty = $obj->retained_warranty;
$facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;

View File

@ -1393,47 +1393,33 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
// Retained warranty
if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty))))
if ($object->displayRetainedWarranty())
{
$displayWarranty = false;
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
// Check if this situation invoice is 100% for real
if (!empty($object->lines)) {
$displayWarranty = true;
foreach ($object->lines as $i => $line) {
if ($line->product_type < 2 && $line->situation_percent < 100) {
$displayWarranty = false;
break;
}
}
}
$retainedWarranty = $object->getRetainedWarrantyAmount();
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
if ($displayWarranty) {
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
}
}
}
}

View File

@ -43,82 +43,82 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
*/
class pdf_sponge extends ModelePDFFactures
{
/**
* @var DoliDb Database handler
*/
public $db;
/**
* @var DoliDb Database handler
*/
public $db;
/**
* @var string model name
*/
public $name;
* @var string model name
*/
public $name;
/**
* @var string model description (short text)
*/
public $description;
* @var string model description (short text)
*/
public $description;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
* @var string document type
*/
public $type;
/**
* @var string document type
*/
public $type;
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.5 = array(5, 5)
*/
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.5 = array(5, 5)
*/
public $phpmin = array(5, 5);
/**
* Dolibarr version of the loaded document
* @var string
*/
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'dolibarr';
/**
* @var int page_largeur
*/
public $page_largeur;
/**
* @var int page_largeur
*/
public $page_largeur;
/**
* @var int page_hauteur
*/
public $page_hauteur;
* @var int page_hauteur
*/
public $page_hauteur;
/**
* @var array format
*/
public $format;
* @var array format
*/
public $format;
/**
* @var int marge_gauche
*/
* @var int marge_gauche
*/
public $marge_gauche;
/**
* @var int marge_droite
*/
* @var int marge_droite
*/
public $marge_droite;
/**
* @var int marge_haute
*/
* @var int marge_haute
*/
public $marge_haute;
/**
* @var int marge_basse
*/
* @var int marge_basse
*/
public $marge_basse;
/**
* Issuer
* @var Societe Object that emits
*/
/**
* Issuer
* @var Societe Object that emits
*/
public $emetteur;
/**
@ -776,9 +776,9 @@ class pdf_sponge extends ModelePDFFactures
$parameters = array(
'object' => $object,
'i' => $i,
'pdf' => &$pdf,
'curY' => &$curY,
'nexY' => &$nexY,
'pdf' =>& $pdf,
'curY' =>& $curY,
'nexY' =>& $nexY,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails
);
@ -1204,13 +1204,13 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0);
$posy = $pdf->GetY() + 1;
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
$posy = $pdf->GetY() + 2;
}
}
}
if ($conf->global->FACTURE_CHQ_NUMBER == -1)
{
@ -1219,13 +1219,13 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
$posy = $pdf->GetY() + 1;
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
$posy = $pdf->GetY() + 2;
}
}
}
}
}
@ -1267,10 +1267,10 @@ class pdf_sponge extends ModelePDFFactures
{
global $conf, $mysoc, $hookmanager;
$sign = 1;
if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1;
$sign = 1;
if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$default_font_size = pdf_getPDFFontSize($outputlangs);
$tab2_top = $posy;
$tab2_hl = 4;
@ -1311,10 +1311,10 @@ class pdf_sponge extends ModelePDFFactures
}
if (!empty($i)) {
$avancementGlobal = $percent / $i;
$avancementGlobal = $percent / $i;
}
else {
$avancementGlobal = 0;
$avancementGlobal = 0;
}
$object->fetchPreviousNextSituationInvoice();
@ -1323,98 +1323,98 @@ class pdf_sponge extends ModelePDFFactures
$total_a_payer = 0;
$total_a_payer_ttc = 0;
foreach ($TPreviousIncoice as &$fac) {
$total_a_payer += $fac->total_ht;
$total_a_payer_ttc += $fac->total_ttc;
$total_a_payer += $fac->total_ht;
$total_a_payer_ttc += $fac->total_ttc;
}
$total_a_payer += $object->total_ht;
$total_a_payer_ttc += $object->total_ttc;
if (!empty($avancementGlobal)) {
$total_a_payer = $total_a_payer * 100 / $avancementGlobal;
$total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal;
$total_a_payer = $total_a_payer * 100 / $avancementGlobal;
$total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal;
}
else {
$total_a_payer = 0;
$total_a_payer_ttc = 0;
$total_a_payer = 0;
$total_a_payer_ttc = 0;
}
$i = 1;
if (!empty($TPreviousIncoice)) {
$pdf->setY($tab2_top);
$posy = $pdf->GetY();
$pdf->setY($tab2_top);
$posy = $pdf->GetY();
foreach ($TPreviousIncoice as &$fac) {
if ($posy > $this->page_hauteur - 4) {
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
foreach ($TPreviousIncoice as &$fac) {
if ($posy > $this->page_hauteur - 4) {
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
// cumul TVA précédent
$index++;
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
// cumul TVA précédent
$index++;
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $posy);
$pdf->SetXY($col2x, $posy);
$facSign = '';
if ($i > 1) {
$facSign = $fac->total_ht >= 0 ? '+' : '';
}
$facSign = '';
if ($i > 1) {
$facSign = $fac->total_ht >= 0 ? '+' : '';
}
$displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs);
$displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$i++;
$posy += $tab2_hl;
$i++;
$posy += $tab2_hl;
$pdf->setY($posy);
}
$pdf->setY($posy);
}
// Display current total
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
// Display current total
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $posy);
$facSign = '';
if ($i > 1) {
$facSign = $object->total_ht >= 0 ? '+' : ''; // management of a particular customer case
}
$pdf->SetXY($col2x, $posy);
$facSign = '';
if ($i > 1) {
$facSign = $object->total_ht >= 0 ? '+' : ''; // management of a particular customer case
}
if ($fac->type === facture::TYPE_CREDIT_NOTE) {
$facSign = '-'; // les avoirs
}
if ($fac->type === facture::TYPE_CREDIT_NOTE) {
$facSign = '-'; // les avoirs
}
$displayAmount = ' '.$facSign.' '.price($object->total_ht, 0, $outputlangs);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$displayAmount = ' '.$facSign.' '.price($object->total_ht, 0, $outputlangs);
$pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
$posy += $tab2_hl;
$posy += $tab2_hl;
// Display all total
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1);
// Display all total
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1);
$pdf->SetXY($col2x, $posy);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer * $avancementGlobal / 100, 0, $outputlangs), 0, 'R', 1);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($col2x, $posy);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer * $avancementGlobal / 100, 0, $outputlangs), 0, 'R', 1);
$pdf->SetFont('', '', $default_font_size - 2);
$posy += $tab2_hl;
$posy += $tab2_hl;
if ($posy > $this->page_hauteur - 4) {
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
if ($posy > $this->page_hauteur - 4) {
$pdf->addPage();
$pdf->setY($this->marge_haute);
$posy = $pdf->GetY();
}
$tab2_top = $posy;
$index = 0;
$tab2_top = $posy;
$index = 0;
}
$tab2_top += 3;
@ -1425,30 +1425,30 @@ class pdf_sponge extends ModelePDFFactures
// Total remise
$total_line_remise = 0;
foreach ($object->lines as $i => $line) {
$total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib
// Gestion remise sous forme de ligne négative
if ($line->total_ht < 0) $total_line_remise += -$line->total_ht;
$total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib
// Gestion remise sous forme de ligne négative
if ($line->total_ht < 0) $total_line_remise += -$line->total_ht;
}
if ($total_line_remise > 0) {
if (!empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
if (!empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Show total NET before discount
if (!empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
// Show total NET before discount
if (!empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
$index++;
}
$index++;
}
}
// Total HT
@ -1475,7 +1475,7 @@ class pdf_sponge extends ModelePDFFactures
}
else
{
// FIXME amount of vat not supported with multicurrency
// FIXME amount of vat not supported with multicurrency
//Local tax 1 before VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
@ -1510,7 +1510,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
}
//}
//}
//Local tax 2 before VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
//{
@ -1543,7 +1543,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
}
//}
//}
// VAT
// Situations totals migth be wrong on huge amounts
@ -1554,13 +1554,13 @@ class pdf_sponge extends ModelePDFFactures
}
if ($sum_pdf_tva != $object->total_tva) { // apply coef to recover the VAT object amount (the good one)
if (!empty($sum_pdf_tva))
{
if (!empty($sum_pdf_tva))
{
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
}
else {
$coef_fix_tva = 1;
}
}
else {
$coef_fix_tva = 1;
}
foreach ($this->tva as $tvakey => $tvaval) {
@ -1626,7 +1626,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
}
//}
//}
//Local tax 2 after VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
//{
@ -1636,7 +1636,7 @@ class pdf_sponge extends ModelePDFFactures
foreach ($localtax_rate as $tvakey => $tvaval)
{
// retrieve global local tax
// retrieve global local tax
if ($tvakey != 0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
@ -1685,66 +1685,35 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
/*if($object->type == Facture::TYPE_SITUATION)
{
// reste à payer total
$index++;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetFillColor(255,255,255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities('SituationTotalRayToRest'), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer_ttc-$deja_regle, 0, $outputlangs), 0, 'R', 1);
}*/
// Retained warranty
if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty))))
if ($object->displayRetainedWarranty())
{
$displayWarranty = false;
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
// Check if this situation invoice is 100% for real
if (!empty($object->situation_final)) {
$displayWarranty = true;
}
elseif (!empty($object->lines) && $object->status == Facture::STATUS_DRAFT) {
// $object->situation_final need validation to be done so this test is need for draft
$displayWarranty = true;
foreach ($object->lines as $i => $line) {
if ($line->product_type < 2 && $line->situation_percent < 100) {
$displayWarranty = false;
break;
}
}
}
$retainedWarranty = $object->getRetainedWarrantyAmount();
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
if ($displayWarranty) {
$pdf->SetTextColor(40, 40, 40);
$pdf->SetFillColor(255, 255, 255);
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
$retainedWarranty = $total_a_payer_ttc * $object->retained_warranty / 100;
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
// retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty").' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
}
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
}
}
}
@ -1878,7 +1847,7 @@ class pdf_sponge extends ModelePDFFactures
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
if (empty($hidetop)) {
$pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter
$pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter
}
}
@ -1906,9 +1875,9 @@ class pdf_sponge extends ModelePDFFactures
// Show Draft Watermark
if ($object->statut == Facture::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK)))
{
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
}
{
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
}
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
@ -1916,7 +1885,7 @@ class pdf_sponge extends ModelePDFFactures
$w = 110;
$posy = $this->marge_haute;
$posx = $this->page_largeur - $this->marge_droite - $w;
$posx = $this->page_largeur - $this->marge_droite - $w;
$pdf->SetXY($this->marge_gauche, $posy);
@ -1936,7 +1905,7 @@ class pdf_sponge extends ModelePDFFactures
}
if (is_readable($logo))
{
$height = pdf_getHeightForLogo($logo);
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
}
else
@ -2088,16 +2057,16 @@ class pdf_sponge extends ModelePDFFactures
// Get contact
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))
{
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
if (count($arrayidcontact) > 0)
{
$usertmp = new User($this->db);
$usertmp->fetch($arrayidcontact[0]);
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
}
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
if (count($arrayidcontact) > 0)
{
$usertmp = new User($this->db);
$usertmp->fetch($arrayidcontact[0]);
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
}
}
$posy += 1;
@ -2203,7 +2172,7 @@ class pdf_sponge extends ModelePDFFactures
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
*
* @param PDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
@ -2222,28 +2191,28 @@ class pdf_sponge extends ModelePDFFactures
*
* @param object $object common object
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return null
*/
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager;
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return null
*/
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $conf, $hookmanager;
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
$this->defaultTitlesFieldsStyle = array(
'align' => 'C', // R,C,L
'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
$this->defaultTitlesFieldsStyle = array(
'align' => 'C', // R,C,L
'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
/*
/*
* For exemple
$this->cols['theColKey'] = array(
'rank' => $rank, // int : use for ordering columns
@ -2261,165 +2230,165 @@ class pdf_sponge extends ModelePDFFactures
);
*/
$rank = 0; // do not use negative rank
$this->cols['desc'] = array(
'rank' => $rank,
'width' => false, // only for desc
'status' => true,
'title' => array(
'textkey' => 'Designation', // use lang key is usefull in somme case with module
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
$rank = 0; // do not use negative rank
$this->cols['desc'] = array(
'rank' => $rank,
'width' => false, // only for desc
'status' => true,
'title' => array(
'textkey' => 'Designation', // use lang key is usefull in somme case with module
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
// PHOTO
$rank = $rank + 10;
$this->cols['photo'] = array(
'rank' => $rank,
'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm
'status' => false,
'title' => array(
'textkey' => 'Photo',
'label' => ' '
),
'content' => array(
'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'border-left' => false, // remove left line separator
);
// PHOTO
$rank = $rank + 10;
$this->cols['photo'] = array(
'rank' => $rank,
'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm
'status' => false,
'title' => array(
'textkey' => 'Photo',
'label' => ' '
),
'content' => array(
'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'border-left' => false, // remove left line separator
);
if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto))
{
$this->cols['photo']['status'] = true;
}
if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto))
{
$this->cols['photo']['status'] = true;
}
$rank = $rank + 10;
$this->cols['vat'] = array(
'rank' => $rank,
'status' => false,
'width' => 16, // in mm
'title' => array(
'textkey' => 'VAT'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['vat'] = array(
'rank' => $rank,
'status' => false,
'width' => 16, // in mm
'title' => array(
'textkey' => 'VAT'
),
'border-left' => true, // add left line separator
);
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$this->cols['vat']['status'] = true;
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$this->cols['vat']['status'] = true;
}
$rank = $rank + 10;
$this->cols['subprice'] = array(
'rank' => $rank,
'width' => 19, // in mm
'status' => true,
'title' => array(
'textkey' => 'PriceUHT'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['subprice'] = array(
'rank' => $rank,
'width' => 19, // in mm
'status' => true,
'title' => array(
'textkey' => 'PriceUHT'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['qty'] = array(
'rank' => $rank,
'width' => 16, // in mm
'status' => true,
'title' => array(
'textkey' => 'Qty'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['qty'] = array(
'rank' => $rank,
'width' => 16, // in mm
'status' => true,
'title' => array(
'textkey' => 'Qty'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['progress'] = array(
'rank' => $rank,
'width' => 19, // in mm
'status' => false,
'title' => array(
'textkey' => 'Progress'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 10;
$this->cols['progress'] = array(
'rank' => $rank,
'width' => 19, // in mm
'status' => false,
'title' => array(
'textkey' => 'Progress'
),
'border-left' => true, // add left line separator
);
if ($this->situationinvoice)
{
$this->cols['progress']['status'] = true;
}
if ($this->situationinvoice)
{
$this->cols['progress']['status'] = true;
}
$rank = $rank + 10;
$this->cols['unit'] = array(
'rank' => $rank,
'width' => 11, // in mm
'status' => false,
'title' => array(
'textkey' => 'Unit'
),
'border-left' => true, // add left line separator
);
if ($conf->global->PRODUCT_USE_UNITS) {
$this->cols['unit']['status'] = true;
}
$rank = $rank + 10;
$this->cols['unit'] = array(
'rank' => $rank,
'width' => 11, // in mm
'status' => false,
'title' => array(
'textkey' => 'Unit'
),
'border-left' => true, // add left line separator
);
if ($conf->global->PRODUCT_USE_UNITS) {
$this->cols['unit']['status'] = true;
}
$rank = $rank + 10;
$this->cols['discount'] = array(
'rank' => $rank,
'width' => 13, // in mm
'status' => false,
'title' => array(
'textkey' => 'ReductionShort'
),
'border-left' => true, // add left line separator
);
if ($this->atleastonediscount) {
$this->cols['discount']['status'] = true;
}
$rank = $rank + 10;
$this->cols['discount'] = array(
'rank' => $rank,
'width' => 13, // in mm
'status' => false,
'title' => array(
'textkey' => 'ReductionShort'
),
'border-left' => true, // add left line separator
);
if ($this->atleastonediscount) {
$this->cols['discount']['status'] = true;
}
$rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100
$this->cols['totalexcltax'] = array(
'rank' => $rank,
'width' => 26, // in mm
'status' => true,
'title' => array(
'textkey' => 'TotalHT'
),
'border-left' => true, // add left line separator
);
$rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100
$this->cols['totalexcltax'] = array(
'rank' => $rank,
'width' => 26, // in mm
'status' => true,
'title' => array(
'textkey' => 'TotalHT'
),
'border-left' => true, // add left line separator
);
// Add extrafields cols
if (!empty($object->lines)) {
$line = reset($object->lines);
$this->defineColumnExtrafield($line, $outputlangs, $hidedetails);
}
// Add extrafields cols
if (!empty($object->lines)) {
$line = reset($object->lines);
$this->defineColumnExtrafield($line, $outputlangs, $hidedetails);
}
$parameters = array(
'object' => $object,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'hidedesc' => $hidedesc,
'hideref' => $hideref
);
$parameters = array(
'object' => $object,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'hidedesc' => $hidedesc,
'hideref' => $hideref
);
$reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook
if ($reshook < 0)
{
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
elseif (empty($reshook))
{
$this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys
}
else
{
$this->cols = $hookmanager->resArray;
}
$reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook
if ($reshook < 0)
{
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
elseif (empty($reshook))
{
$this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys
}
else
{
$this->cols = $hookmanager->resArray;
}
}
}

View File

@ -200,6 +200,8 @@ DELETE FROM llx_const WHERE name = __ENCRYPT('DONATION_ART885')__;
ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0;
ALTER TABLE llx_extrafields ADD COLUMN printable integer DEFAULT 0;
UPDATE llx_const SET name = 'INVOICE_USE_RETAINED_WARRANTY' WHERE name = 'INVOICE_USE_SITUATION_RETAINED_WARRANTY';
ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype;
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER accountancy_code_buy;

View File

@ -219,7 +219,10 @@ ShowInvoiceSituation=Show situation invoice
UseSituationInvoices=Allow situation invoice
UseSituationInvoicesCreditNote=Allow situation invoice credit note
Retainedwarranty=Retained warranty
AllowedInvoiceForRetainedWarranty=Retained warranty usable on the following types of invoices
RetainedwarrantyDefaultPercent=Retained warranty default percent
RetainedwarrantyOnlyForSituation=Make "retained warranty" available only for situation invoices
RetainedwarrantyOnlyForSituationFinal=On situation invoices the global "retained warranty" deduction is applied only on the final situation
ToPayOn=To pay on %s
toPayOn=to pay on %s
RetainedWarranty=Retained Warranty