FIX Legal issue for GB. Add hidden option for this.
This commit is contained in:
parent
ba43297936
commit
3ddf427ff1
@ -312,6 +312,15 @@ if (empty($reshook))
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setdate_pointoftax' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
$object->date_pointoftax=$date_pointoftax;
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setconditions' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@ -702,12 +711,15 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
if (! $error) {
|
||||
// This is a replacement invoice
|
||||
$result = $object->fetch($_POST['fac_replacement']);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
@ -752,11 +764,14 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
@ -858,12 +873,15 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
@ -904,6 +922,8 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Si facture standard
|
||||
@ -911,6 +931,7 @@ if (empty($reshook))
|
||||
$object->type = GETPOST('type');
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
@ -1203,7 +1224,7 @@ if (empty($reshook))
|
||||
{ // If some invoice's lines coming from page
|
||||
$id = $object->create($user);
|
||||
|
||||
for($i = 1; $i <= $NBLINES; $i ++) {
|
||||
for ($i = 1; $i <= $NBLINES; $i ++) {
|
||||
if ($_POST['idprod' . $i]) {
|
||||
$product = new Product($db);
|
||||
$product->fetch($_POST['idprod' . $i]);
|
||||
@ -1224,6 +1245,8 @@ if (empty($reshook))
|
||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("Date")) . '</div>';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
if (!($_POST['situations'] > 0)) {
|
||||
$error++;
|
||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>';
|
||||
@ -1248,6 +1271,7 @@ 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'];
|
||||
@ -2396,6 +2420,15 @@ if ($action == 'create')
|
||||
print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date point of tax
|
||||
if (! empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans('DatePointOfTax') . '</td><td colspan="2">';
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
print $form->select_date($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
|
||||
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||
@ -3460,6 +3493,24 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
||||
{
|
||||
// Date invoice
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DatePointOfTax');
|
||||
print '</td>';
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate_pointoftax&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editdate_pointoftax') {
|
||||
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_pointoftax, 'date_pointoftax');
|
||||
} else {
|
||||
print dol_print_date($object->date_pointoftax, 'daytext');
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Conditions de reglement
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
|
||||
@ -336,6 +336,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", remise_absolue";
|
||||
$sql.= ", remise_percent";
|
||||
$sql.= ", datef";
|
||||
$sql.= ", date_pointoftax";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", ref_client, ref_int";
|
||||
@ -358,6 +359,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL');
|
||||
$sql.= ", ".($this->remise_percent>0?$this->remise_percent:'NULL');
|
||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||
$sql.= ", '".$this->db->idate($this->date_pointoftax)."'";
|
||||
$sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
|
||||
@ -665,6 +667,7 @@ class Facture extends CommonInvoice
|
||||
$facture->type = $this->type;
|
||||
$facture->socid = $this->socid;
|
||||
$facture->date = $this->date;
|
||||
$facture->date_pointoftax = $this->date_pointoftax;
|
||||
$facture->note_public = $this->note_public;
|
||||
$facture->note_private = $this->note_private;
|
||||
$facture->ref_client = $this->ref_client;
|
||||
@ -1014,7 +1017,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
$sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
|
||||
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql.= ', f.datef as df';
|
||||
$sql.= ', f.datef as df, f.date_pointoftax';
|
||||
$sql.= ', f.date_lim_reglement as dlr';
|
||||
$sql.= ', f.datec as datec';
|
||||
$sql.= ', f.date_valid as datev';
|
||||
@ -1054,6 +1057,7 @@ class Facture extends CommonInvoice
|
||||
$this->ref_int = $obj->ref_int;
|
||||
$this->type = $obj->type;
|
||||
$this->date = $this->db->jdate($obj->df);
|
||||
$this->date_pointoftax = $this->db->jdate($obj->date_pointoftax);
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
@ -1328,6 +1332,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").",";
|
||||
$sql.= " datec=".(strval($this->date_creation)!='' ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
|
||||
$sql.= " datef=".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null').",";
|
||||
$sql.= " date_pointoftax=".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').",";
|
||||
$sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
|
||||
$sql.= " paye=".(isset($this->paye)?$this->paye:"null").",";
|
||||
$sql.= " remise_percent=".(isset($this->remise_percent)?$this->remise_percent:"null").",";
|
||||
|
||||
@ -1530,6 +1530,14 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateInvoice")." : " . dol_print_date($object->date,"day",false,$outputlangs), '', 'R');
|
||||
|
||||
if (! empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
||||
{
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("DatePointOfTax")." : " . dol_print_date($object->date_pointoftax,"day",false,$outputlangs), '', 'R');
|
||||
}
|
||||
|
||||
if ($object->type != 2)
|
||||
{
|
||||
$posy+=3;
|
||||
|
||||
@ -108,6 +108,8 @@ ALTER TABLE llx_cronjob ADD COLUMN test varchar(255) DEFAULT '1';
|
||||
|
||||
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_statut (fk_statut);
|
||||
|
||||
ALTER TABLE llx_facture ADD COLUMN date_pointoftax date;
|
||||
|
||||
UPDATE llx_projet as p set p.opp_percent = (SELECT percent FROM llx_c_lead_status as cls WHERE cls.rowid = p.fk_opp_status) WHERE p.opp_percent IS NULL AND p.fk_opp_status IS NOT NULL;
|
||||
|
||||
ALTER TABLE llx_facturedet ADD COLUMN fk_contract_line integer NULL AFTER rang;
|
||||
|
||||
@ -37,8 +37,9 @@ create table llx_facture
|
||||
increment varchar(10),
|
||||
fk_soc integer NOT NULL,
|
||||
datec datetime, -- date de creation de la facture
|
||||
datef date, -- date de la facture
|
||||
date_valid date, -- date de validation
|
||||
datef date, -- date invoice
|
||||
date_pointoftax date, -- date point of tax (for GB)
|
||||
date_valid date, -- date validation
|
||||
tms timestamp, -- date creation/modification
|
||||
paye smallint DEFAULT 0 NOT NULL,
|
||||
amount double(24,8) DEFAULT 0 NOT NULL,
|
||||
|
||||
@ -223,6 +223,7 @@ RelatedRecurringCustomerInvoices=Related recurring customer invoices
|
||||
MenuToValid=To valid
|
||||
DateMaxPayment=Payment due before
|
||||
DateInvoice=Invoice date
|
||||
DatePointOfTax=Point of tax
|
||||
NoInvoice=No invoice
|
||||
ClassifyBill=Classify invoice
|
||||
SupplierBillsToPay=Unpaid supplier invoices
|
||||
|
||||
Loading…
Reference in New Issue
Block a user