mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW Can set the start/end date of service line in invoice templates
This commit is contained in:
parent
f447d1287c
commit
98b7d4c2e2
|
|
@ -553,7 +553,7 @@ if (empty($reshook))
|
|||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
|
||||
)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
$idwarehouse = GETPOST('idwarehouse','int');
|
||||
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
|
|
@ -640,8 +640,8 @@ if (empty($reshook))
|
|||
else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$close_code = $_POST["close_code"];
|
||||
$close_note = $_POST["close_note"];
|
||||
$close_code = GETPOST("close_code",'none');
|
||||
$close_note = GETPOST("close_note",'none');
|
||||
if ($close_code) {
|
||||
$result = $object->set_paid($user, $close_code, $close_note);
|
||||
if ($result<0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
|
@ -651,8 +651,8 @@ if (empty($reshook))
|
|||
} // Classify "abandoned"
|
||||
else if ($action == 'confirm_canceled' && $confirm == 'yes') {
|
||||
$object->fetch($id);
|
||||
$close_code = $_POST["close_code"];
|
||||
$close_note = $_POST["close_note"];
|
||||
$close_code = GETPOST("close_code",'none');
|
||||
$close_note = GETPOST("close_note",'none');
|
||||
if ($close_code) {
|
||||
$result = $object->set_canceled($user, $close_code, $close_note);
|
||||
if ($result<0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
|
@ -1419,6 +1419,7 @@ if (empty($reshook))
|
|||
}
|
||||
}
|
||||
|
||||
// Situation invoices
|
||||
if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations'])))
|
||||
{
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
|
|
@ -1455,16 +1456,16 @@ if (empty($reshook))
|
|||
$object->fetch_thirdparty();
|
||||
$object->date = $datefacture;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->note_public = trim(GETPOST('note_public','none'));
|
||||
$object->note = trim(GETPOST('note','none'));
|
||||
$object->ref_client = GETPOST('ref_client','alpha');
|
||||
$object->ref_int = GETPOST('ref_int','alpha');
|
||||
$object->modelpdf = GETPOST('model','alpha');
|
||||
$object->fk_project = GETPOST('projectid','int');
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id','int');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id','int');
|
||||
$object->remise_absolue = GETPOST('remise_absolue','int');
|
||||
$object->remise_percent = GETPOST('remise_percent','int');
|
||||
|
||||
// Proprietes particulieres a facture de remplacement
|
||||
|
||||
|
|
@ -1533,14 +1534,14 @@ if (empty($reshook))
|
|||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef='';
|
||||
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
||||
$product_desc=(GETPOST('dp_desc','none')?GETPOST('dp_desc','none'):'');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode','alpha');
|
||||
if ($prod_entry_mode == 'free')
|
||||
{
|
||||
$idprod=0;
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$tva_tx = (GETPOST('tva_tx','alpha') ? GETPOST('tva_tx','alpha') : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ class FactureRec extends CommonInvoice
|
|||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, ';
|
||||
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
|
||||
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
|
||||
$sql.= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc,';
|
||||
//$sql.= ' l.situation_percent, l.fk_prev_id,';
|
||||
//$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
|
||||
$sql.= ' l.rang, l.special_code,';
|
||||
|
|
@ -487,6 +487,8 @@ class FactureRec extends CommonInvoice
|
|||
$line->remise_percent = $objp->remise_percent;
|
||||
$line->fk_remise_except = $objp->fk_remise_except;
|
||||
$line->fk_product = $objp->fk_product;
|
||||
$line->date_start_fill = $objp->date_start_fill;
|
||||
$line->date_end_fill = $objp->date_end_fill;
|
||||
$line->info_bits = $objp->info_bits;
|
||||
$line->total_ht = $objp->total_ht;
|
||||
$line->total_tva = $objp->total_tva;
|
||||
|
|
@ -602,15 +604,17 @@ class FactureRec extends CommonInvoice
|
|||
* @param string $label Label of the line
|
||||
* @param string $fk_unit Unit
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
|
||||
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null, $pu_ht_devise=0)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null, $pu_ht_devise=0, $date_start_fill=0, $date_end_fill=0)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
$facid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit,pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit,pu_ht_devise=$pu_ht_devise,date_start_fill=$date_start_fill,date_end_fill=$date_end_fill", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Check parameters
|
||||
|
|
@ -700,6 +704,8 @@ class FactureRec extends CommonInvoice
|
|||
$sql.= ", total_localtax1";
|
||||
$sql.= ", total_localtax2";
|
||||
$sql.= ", total_ttc";
|
||||
$sql.= ", date_start_fill";
|
||||
$sql.= ", date_end_fill";
|
||||
$sql.= ", info_bits";
|
||||
$sql.= ", rang";
|
||||
$sql.= ", special_code";
|
||||
|
|
@ -727,6 +733,8 @@ class FactureRec extends CommonInvoice
|
|||
$sql.= ", ".price2num($total_localtax1);
|
||||
$sql.= ", ".price2num($total_localtax2);
|
||||
$sql.= ", ".price2num($total_ttc);
|
||||
$sql.= ", ".(int) $date_start_fill;
|
||||
$sql.= ", ".(int) $date_end_fill;
|
||||
$sql.= ", ".$info_bits;
|
||||
$sql.= ", ".$rang;
|
||||
$sql.= ", ".$special_code;
|
||||
|
|
@ -778,9 +786,11 @@ class FactureRec extends CommonInvoice
|
|||
* @param string $fk_unit Unit
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @param int $notrigger disable line update trigger
|
||||
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
|
||||
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null, $pu_ht_devise = 0, $notrigger=0)
|
||||
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null, $pu_ht_devise = 0, $notrigger=0, $date_start_fill=0, $date_end_fill=0)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
|
|
@ -883,6 +893,8 @@ class FactureRec extends CommonInvoice
|
|||
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
|
||||
$sql.= ", total_localtax2='".price2num($total_localtax2)."'";
|
||||
$sql.= ", total_ttc='".price2num($total_ttc)."'";
|
||||
$sql.= ", date_start_fill=".((int) $date_start_fill);
|
||||
$sql.= ", date_end_fill=".((int) $date_end_fill);
|
||||
$sql.= ", info_bits=".$info_bits;
|
||||
$sql.= ", rang=".$rang;
|
||||
$sql.= ", special_code=".$special_code;
|
||||
|
|
@ -948,7 +960,7 @@ class FactureRec extends CommonInvoice
|
|||
* Create all recurrents invoices (for all entities if multicompany is used).
|
||||
* A result may also be provided into this->output.
|
||||
*
|
||||
* WARNING: This method change context $conf->entity to be in correct context for each recurring invoice found.
|
||||
* WARNING: This method change temporarly context $conf->entity to be in correct context for each recurring invoice found.
|
||||
*
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
|
|
@ -1561,6 +1573,10 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||
public $element='facturedetrec';
|
||||
public $table_element='facturedet_rec';
|
||||
|
||||
var $date_start_fill;
|
||||
var $date_end_fill;
|
||||
|
||||
|
||||
/**
|
||||
* Delete line in database
|
||||
*
|
||||
|
|
@ -1615,7 +1631,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||
{
|
||||
$sql = 'SELECT l.rowid, l.fk_facture ,l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,';
|
||||
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
|
||||
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
|
||||
$sql.= ' l.date_start_fill, l.date_end_fill, l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
|
||||
$sql.= ' l.rang, l.special_code,';
|
||||
$sql.= ' l.fk_unit, l.fk_contract_line,';
|
||||
$sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
|
||||
|
|
@ -1655,6 +1671,8 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||
$this->remise_percent = $objp->remise_percent;
|
||||
$this->fk_remise_except = $objp->fk_remise_except;
|
||||
$this->fk_product = $objp->fk_product;
|
||||
$this->date_start_fill = $objp->date_start_fill;
|
||||
$this->date_end_fill = $objp->date_end_fill;
|
||||
$this->info_bits = $objp->info_bits;
|
||||
$this->total_ht = $objp->total_ht;
|
||||
$this->total_tva = $objp->total_tva;
|
||||
|
|
@ -1711,6 +1729,9 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||
$sql.= ", product_type=".$this->product_type;
|
||||
$sql.= ", remise_percent='".price2num($this->remise_percent)."'";
|
||||
$sql.= ", subprice='".price2num($this->subprice)."'";
|
||||
$sql.= ", info_bits='".price2num($this->info_bits)."'";
|
||||
$sql.= ", date_start_fill=".(int) $this->date_start_fill;
|
||||
$sql.= ", date_end_fill=".(int) $this->date_end_fill;
|
||||
$sql.= ", total_ht='".price2num($this->total_ht)."'";
|
||||
$sql.= ", total_tva='".price2num($this->total_tva)."'";
|
||||
$sql.= ", total_localtax1='".price2num($this->total_localtax1)."'";
|
||||
|
|
|
|||
|
|
@ -287,6 +287,10 @@ class Facture extends CommonInvoice
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$originaldatewhen=null;
|
||||
$nextdatewhen=null;
|
||||
$previousdaynextdatewhen=null;
|
||||
|
||||
// Create invoice from a template invoice
|
||||
if ($this->fac_rec > 0)
|
||||
{
|
||||
|
|
@ -297,7 +301,10 @@ class Facture extends CommonInvoice
|
|||
$result=$_facrec->fetch($this->fac_rec);
|
||||
$result=$_facrec->fetchObjectLinked(); // This load $_facrec->linkedObjectsIds
|
||||
|
||||
// Define some dates
|
||||
$originaldatewhen = $_facrec->date_when;
|
||||
$nextdatewhen=dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency);
|
||||
$previousdaynextdatewhen=dol_time_plus_duree($nextdatewhen, -1, 'd');
|
||||
|
||||
$this->socid = $_facrec->socid; // Invoice created on same thirdparty than template
|
||||
$this->entity = $_facrec->entity; // Invoice created in same entity than template
|
||||
|
|
@ -374,7 +381,8 @@ class Facture extends CommonInvoice
|
|||
$substitutionarray['__INVOICE_NEXT_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y');
|
||||
// Only for tempalte invoice
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = dol_print_date($originaldatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date(dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency), 'dayhour');
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($nextdatewhen, 'dayhour');
|
||||
$substitutionarray['__INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($previousdaynextdatewhen, 'dayhour');
|
||||
|
||||
//var_dump($substitutionarray);exit;
|
||||
|
||||
|
|
@ -494,6 +502,7 @@ class Facture extends CommonInvoice
|
|||
}
|
||||
}
|
||||
|
||||
// Propagate contacts
|
||||
if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
|
||||
{
|
||||
$originforcontact = $this->origin;
|
||||
|
|
@ -531,11 +540,10 @@ class Facture extends CommonInvoice
|
|||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Insert lines of invoices into database
|
||||
* Insert lines of invoices, if not from template invoice, into database
|
||||
*/
|
||||
if (count($this->lines) && is_object($this->lines[0])) // If this->lines is array of InvoiceLines (preferred mode)
|
||||
if (! $error && empty($this->fac_rec) && count($this->lines) && is_object($this->lines[0])) // If this->lines is array of InvoiceLines (preferred mode)
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
|
||||
|
|
@ -545,9 +553,18 @@ class Facture extends CommonInvoice
|
|||
$newinvoiceline=$this->lines[$i];
|
||||
$newinvoiceline->fk_facture=$this->id;
|
||||
|
||||
// TODO This seems not used. Here we put origin 'facture' but after, we put an id of object !
|
||||
$newinvoiceline->origin = $this->element;
|
||||
$newinvoiceline->origin_id = $this->lines[$i]->id;
|
||||
$newinvoiceline->origin = $this->lines[$i]->element;
|
||||
$newinvoiceline->origin_id = $this->lines[$i]->id;
|
||||
|
||||
// Auto set date of service ?
|
||||
if ($this->lines[$i]->date_start_fill == 1 && $originaldatewhen) // $originaldatewhen is defined when generating from recurring invoice only
|
||||
{
|
||||
$newinvoiceline->date_start = $originaldatewhen;
|
||||
}
|
||||
if ($this->lines[$i]->date_end_fill == 1 && $previousdaynextdatewhen) // $previousdaynextdatewhen is defined when generating from recurring invoice only
|
||||
{
|
||||
$newinvoiceline->date_end = $previousdaynextdatewhen;
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
|
|
@ -581,7 +598,7 @@ class Facture extends CommonInvoice
|
|||
}
|
||||
}
|
||||
}
|
||||
else // If this->lines is an array of invoice line arrays
|
||||
elseif (! $error && empty($this->fac_rec)) // If this->lines is an array of invoice line arrays
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
|
||||
|
|
@ -689,7 +706,9 @@ class Facture extends CommonInvoice
|
|||
$localtax2_tx,
|
||||
$_facrec->lines[$i]->fk_product,
|
||||
$_facrec->lines[$i]->remise_percent,
|
||||
'','',0,
|
||||
($_facrec->lines[$i]->date_start_fill == 1 && $originaldatewhen)?$originaldatewhen:'',
|
||||
($_facrec->lines[$i]->date_end_fill == 1 && $previousdaynextdatewhen)?$previousdaynextdatewhen:'',
|
||||
0,
|
||||
$tva_npr,
|
||||
'',
|
||||
'HT',
|
||||
|
|
@ -2522,8 +2541,8 @@ class Facture extends CommonInvoice
|
|||
* @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
|
||||
* @param int $fk_product Id of predefined product/service
|
||||
* @param double $remise_percent Percent of discount on line
|
||||
* @param int $date_start Date start of service
|
||||
* @param int $date_end Date end of service
|
||||
* @param int $date_start Date start of service
|
||||
* @param int $date_end Date end of service
|
||||
* @param int $ventil Code of dispatching into accountancy
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @param int $fk_remise_except Id discount used
|
||||
|
|
|
|||
|
|
@ -66,22 +66,8 @@ if ($action == "create" || $action == "add") $objecttype = '';
|
|||
$result = restrictedArea($user, 'facture', $id, $objecttype);
|
||||
$projectid = GETPOST('projectid','int');
|
||||
|
||||
$search_ref=GETPOST('search_ref');
|
||||
$search_societe=GETPOST('search_societe');
|
||||
$search_montant_ht=GETPOST('search_montant_ht');
|
||||
$search_montant_vat=GETPOST('search_montant_vat');
|
||||
$search_montant_ttc=GETPOST('search_montant_ttc');
|
||||
$search_payment_mode=GETPOST('search_payment_mode');
|
||||
$search_payment_term=GETPOST('search_payment_term');
|
||||
$day=GETPOST('day');
|
||||
$year=GETPOST('year');
|
||||
$month=GETPOST('month');
|
||||
$day_date_when=GETPOST('day_date_when');
|
||||
$year_date_when=GETPOST('year_date_when');
|
||||
$month_date_when=GETPOST('month_date_when');
|
||||
$search_recurring=GETPOST('search_recurring','int');
|
||||
$search_frequency=GETPOST('search_frequency','alpha');
|
||||
$search_unit_frequency=GETPOST('search_unit_frequency','alpha');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
|
|
@ -144,28 +130,6 @@ if (empty($reshook))
|
|||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$search_montant_vat='';
|
||||
$search_montant_ttc='';
|
||||
$search_montant_mode='';
|
||||
$search_montant_term='';
|
||||
$day='';
|
||||
$year='';
|
||||
$month='';
|
||||
$day_date_when='';
|
||||
$year_date_when='';
|
||||
$month_date_when='';
|
||||
$search_recurring='';
|
||||
$search_frequency='';
|
||||
$search_unit_frequency='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
/*$objectclass='MyObject';
|
||||
$objectlabel='MyObject';
|
||||
|
|
@ -686,6 +650,9 @@ if (empty($reshook))
|
|||
$fk_unit= GETPOST('units', 'alpha');
|
||||
}
|
||||
|
||||
$date_start_fill = GETPOST('date_start_fill','int');
|
||||
$date_end_fill = GETPOST('date_end_fill','int');
|
||||
|
||||
// Margin
|
||||
$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
|
||||
|
|
@ -706,7 +673,7 @@ if (empty($reshook))
|
|||
else
|
||||
{
|
||||
// Insert line
|
||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx,$localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit);
|
||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx,$localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
|
|
@ -762,6 +729,9 @@ if (empty($reshook))
|
|||
unset($_POST['date_endmonth']);
|
||||
unset($_POST['date_endyear']);
|
||||
|
||||
unset($_POST['date_start_fill']);
|
||||
unset($_POST['date_end_fill']);
|
||||
|
||||
unset($_POST['situations']);
|
||||
unset($_POST['progress']);
|
||||
}
|
||||
|
|
@ -883,6 +853,9 @@ if (empty($reshook))
|
|||
$error ++;
|
||||
}
|
||||
|
||||
$date_start_fill = GETPOST('date_start_fill','int');
|
||||
$date_end_fill = GETPOST('date_end_fill','int');
|
||||
|
||||
// Update line
|
||||
if (! $error)
|
||||
{
|
||||
|
|
@ -905,7 +878,10 @@ if (empty($reshook))
|
|||
$special_code,
|
||||
$label,
|
||||
GETPOST('units'),
|
||||
$pu_ht_devise
|
||||
$pu_ht_devise,
|
||||
0,
|
||||
$date_start_fill,
|
||||
$date_end_fill
|
||||
);
|
||||
|
||||
if ($result >= 0)
|
||||
|
|
|
|||
|
|
@ -283,6 +283,18 @@ else {
|
|||
if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes';
|
||||
$doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,$toolbarname,'',false,true,$enabled,$nbrows,'98%');
|
||||
$doleditor->Create();
|
||||
|
||||
// Show autofill date for recuring invoices
|
||||
if (! empty($conf->service->enabled) && $object->element == 'facturerec')
|
||||
{
|
||||
echo '<div class="divlinefordates"><br>';
|
||||
echo $langs->trans('AutoFillDateFrom').' ';
|
||||
echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1);
|
||||
echo ' - ';
|
||||
echo $langs->trans('AutoFillDateTo').' ';
|
||||
echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1);
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
|
|
@ -594,8 +606,17 @@ jQuery(document).ready(function() {
|
|||
if (editor) { editor.focus(); }
|
||||
}
|
||||
}
|
||||
if (jQuery('#select_type').val() == '0') jQuery('#trlinefordates').hide();
|
||||
else jQuery('#trlinefordates').show();
|
||||
console.log("Hide/show date according to product type");
|
||||
if (jQuery('#select_type').val() == '0')
|
||||
{
|
||||
jQuery('#trlinefordates').hide();
|
||||
jQuery('.divlinefordates').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#trlinefordates').show();
|
||||
jQuery('.divlinefordates').show();
|
||||
}
|
||||
});
|
||||
|
||||
$("#prod_entry_mode_predef").on( "click", function() {
|
||||
|
|
@ -799,7 +820,7 @@ function setforfree() {
|
|||
jQuery("#units, #title_units").show();
|
||||
}
|
||||
function setforpredef() {
|
||||
console.log("Call setforpredef. We hide some fields");
|
||||
console.log("Call setforpredef. We hide some fields and show dates");
|
||||
jQuery("#select_type").val(-1);
|
||||
|
||||
jQuery("#prod_entry_mode_free").prop('checked',false).change();
|
||||
|
|
@ -820,6 +841,9 @@ function setforpredef() {
|
|||
jQuery(".np_marginRate").hide(); // May no exists
|
||||
jQuery(".np_markRate").hide(); // May no exists
|
||||
jQuery("#units, #title_units").hide();
|
||||
|
||||
jQuery('#trlinefordates').show();
|
||||
jQuery('.divlinefordates').show();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,10 @@ if (!empty($conf->multicurrency->enabled)) $colspan+=2;
|
|||
$coldisplay=-1; // We remove first td
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>><?php $coldisplay+=(! empty($conf->global->MAIN_VIEW_LINE_NUMBER))?2:1; ?>
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
|
||||
<?php } ?>
|
||||
<td>
|
||||
<div id="line_<?php echo $line->id; ?>"></div>
|
||||
|
||||
<input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
|
||||
|
|
@ -83,7 +86,7 @@ $coldisplay=-1; // We remove first td
|
|||
echo ' - '.nl2br($line->product_label);
|
||||
?>
|
||||
|
||||
<br>
|
||||
<br><br>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
|
@ -110,6 +113,18 @@ $coldisplay=-1; // We remove first td
|
|||
} else {
|
||||
print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>';
|
||||
}
|
||||
|
||||
// Show autofill date for recuring invoices
|
||||
if (! empty($conf->service->enabled) && $line->product_type == 1 && $line->element == 'facturedetrec')
|
||||
{
|
||||
echo '<br>';
|
||||
echo $langs->trans('AutoFillDateFrom').' ';
|
||||
echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1);
|
||||
echo ' - ';
|
||||
echo $langs->trans('AutoFillDateTo').' ';
|
||||
echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
|
||||
|
|
@ -117,7 +132,7 @@ $coldisplay=-1; // We remove first td
|
|||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
?>
|
||||
<td align="right"><input id="fourn_ref" name="fourn_ref" class="flat" value="<?php echo $line->ref_fourn; ?>" size="12"></td>
|
||||
<td align="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo $line->ref_fourn; ?>"></td>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
@ -237,6 +252,9 @@ $coldisplay=-1; // We remove first td
|
|||
|
||||
<?php if (! empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?>
|
||||
<tr id="service_duration_area" <?php echo $bc[$var]; ?>>
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td class="linecolnum" align="center"><?php $coldisplay++; ?></td>
|
||||
<?php } ?>
|
||||
<td colspan="<?php echo 7+$colspan ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
|
||||
<?php
|
||||
$hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:'');
|
||||
|
|
@ -264,7 +282,8 @@ $coldisplay=-1; // We remove first td
|
|||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
?>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
|
|||
|
|
@ -121,20 +121,9 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
|||
if ($line->fk_product > 0)
|
||||
{
|
||||
echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
|
||||
|
||||
// Show range
|
||||
echo get_date_range($line->date_start, $line->date_end, $format);
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
{
|
||||
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
|
|
@ -145,9 +134,24 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
|||
if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
|
||||
echo $text.' '.dol_htmlentitiesbr($line->description);
|
||||
}
|
||||
}
|
||||
|
||||
// Show range
|
||||
echo get_date_range($line->date_start,$line->date_end, $format);
|
||||
// Show date range
|
||||
if ($line->element == 'facturedetrec') {
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '<br><br><div class="nowraponall">';
|
||||
if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill);
|
||||
if ($line->date_start_fill && $line->date_end_fill) echo ' - ';
|
||||
if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill);
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '</div>';
|
||||
}
|
||||
else {
|
||||
echo get_date_range($line->date_start, $line->date_end, $format);
|
||||
}
|
||||
|
||||
// Add description in form
|
||||
if ($line->fk_product > 0 && ! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
{
|
||||
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -224,3 +224,6 @@ CREATE TABLE llx_c_ticketsup_type
|
|||
description varchar(255)
|
||||
)ENGINE=innodb;
|
||||
|
||||
|
||||
ALTER TABLE llx_facturedet_rec ADD COLUMN date_start_fill integer DEFAULT 0;
|
||||
ALTER TABLE llx_facturedet_rec ADD COLUMN date_end_fill integer DEFAULT 0;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ create table llx_facturedet_rec
|
|||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- total LocalTax2 for total quantity of line
|
||||
total_ttc double(24,8), -- Total TTC de la ligne toute quantity et incluant remise ligne et globale
|
||||
date_start_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__
|
||||
date_end_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0, -- ordre d'affichage
|
||||
|
|
|
|||
|
|
@ -528,3 +528,7 @@ BillCreated=%s bill(s) created
|
|||
StatusOfGeneratedDocuments=Status of document generation
|
||||
DoNotGenerateDoc=Do not generate document file
|
||||
AutogenerateDoc=Auto generate document file
|
||||
AutoFillDateFrom=Set start date for service line with invoice date
|
||||
AutoFillDateFromShort=Set start date
|
||||
AutoFillDateTo=Set end date for service line with next invoice date
|
||||
AutoFillDateToShort=Set end date
|
||||
|
|
|
|||
|
|
@ -3010,7 +3010,9 @@ div.tabBar .noborder {
|
|||
#tablelines tr.liste_titre td, .paymenttable tr.liste_titre td, .margintable tr.liste_titre td, .tableforservicepart1 tr.liste_titre td {
|
||||
border-bottom: 1px solid rgb(<?php echo $colortopbordertitle1 ?>) !important;
|
||||
}
|
||||
|
||||
#tablelines tr td {
|
||||
height: unset;
|
||||
}
|
||||
|
||||
/* Prepare to remove class pair - impair */
|
||||
|
||||
|
|
|
|||
|
|
@ -3039,6 +3039,9 @@ div .tdtop {
|
|||
#tablelines tr.liste_titre td, .paymenttable tr.liste_titre td, .margintable tr.liste_titre td, .tableforservicepart1 tr.liste_titre td {
|
||||
border-bottom: 1px solid #AAA !important;
|
||||
}
|
||||
#tablelines tr td {
|
||||
height: unset;
|
||||
}
|
||||
|
||||
|
||||
/* Prepare to remove class pair - impair */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user