Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
1fac7b01b8
@ -2136,6 +2136,8 @@ class Facture extends CommonInvoice
|
||||
if ($this->paye != 1)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
dol_syslog(get_class($this)."::set_paid rowid=".$this->id, LOG_DEBUG);
|
||||
|
||||
@ -2144,6 +2146,8 @@ class Facture extends CommonInvoice
|
||||
if (! $close_code) $sql.= ', paye=1';
|
||||
if ($close_code) $sql.= ", close_code='".$this->db->escape($close_code)."'";
|
||||
if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'";
|
||||
$sql.= ', fk_user_closing = '.$user->id;
|
||||
$sql.= ", date_closing = '".$this->db->idate($now)."'";
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2195,7 +2199,9 @@ class Facture extends CommonInvoice
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||
$sql.= ' SET paye=0, fk_statut='.self::STATUS_VALIDATED.', close_code=null, close_note=null';
|
||||
$sql.= ' SET paye=0, fk_statut='.self::STATUS_VALIDATED.', close_code=null, close_note=null,';
|
||||
$sql.= ' date_closing=null,';
|
||||
$sql.= ' fk_user_closing=null';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG);
|
||||
@ -3521,7 +3527,8 @@ class Facture extends CommonInvoice
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT c.rowid, datec, date_valid as datev, tms as datem,';
|
||||
$sql.= ' fk_user_author, fk_user_valid';
|
||||
$sql.= ' date_closing as dateclosing,';
|
||||
$sql.= ' fk_user_author, fk_user_valid, fk_user_closing';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as c';
|
||||
$sql.= ' WHERE c.rowid = '.$id;
|
||||
|
||||
@ -3536,7 +3543,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
if ($obj->fk_user_valid)
|
||||
{
|
||||
@ -3544,9 +3551,17 @@ class Facture extends CommonInvoice
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
if ($obj->fk_user_closing)
|
||||
{
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_closing);
|
||||
$this->user_closing = $cluser;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev); // Should be in log table
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_closing = $this->db->jdate($obj->dateclosing);
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
|
||||
@ -181,6 +181,7 @@ $arrayfields=array(
|
||||
'rtp'=>array('label'=>"Rest", 'checked'=>0),
|
||||
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'f.date_closing'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
||||
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
|
||||
@ -382,7 +383,7 @@ $sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_publ
|
||||
$sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||
$sql.= ' f.paye as paye, f.fk_statut,';
|
||||
$sql.= ' f.datec as date_creation, f.tms as date_update,';
|
||||
$sql.= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
|
||||
if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
|
||||
{
|
||||
$sql.= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final,f.situation_cycle_ref,f.situation_counter,';
|
||||
@ -497,7 +498,7 @@ if (! $sall)
|
||||
$sql.= ' f.localtax1, f.localtax2,';
|
||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||
$sql.= ' f.paye, f.fk_statut,';
|
||||
$sql.= ' f.datec, f.tms,';
|
||||
$sql.= ' f.datec, f.tms, f.date_closing,';
|
||||
$sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
|
||||
$sql.= ' typent.code,';
|
||||
$sql.= ' state.code_departement, state.nom,';
|
||||
@ -866,6 +867,12 @@ if ($resql)
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.date_closing']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
@ -932,6 +939,7 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.date_closing']['checked'])) print_liste_field_titre($arrayfields['f.date_closing']['label'], $_SERVER["PHP_SELF"], "f.date_closing", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type,dynamount_payed", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
@ -1262,6 +1270,14 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date closing
|
||||
if (! empty($arrayfields['f.date_closing']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_closing), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['f.fk_statut']['checked']))
|
||||
{
|
||||
|
||||
@ -267,6 +267,7 @@ $sql.= " state.code_departement, state.nom";
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -93,7 +93,8 @@ ALTER TABLE llx_extrafields ADD COLUMN printable boolean DEFAULT FALSE;
|
||||
ALTER TABLE llx_facture ADD COLUMN retained_warranty real DEFAULT NULL after situation_final;
|
||||
ALTER TABLE llx_facture ADD COLUMN retained_warranty_date_limit date DEFAULT NULL after retained_warranty;
|
||||
ALTER TABLE llx_facture ADD COLUMN retained_warranty_fk_cond_reglement integer DEFAULT NULL after retained_warranty_date_limit;
|
||||
|
||||
ALTER TABLE llx_facture ADD COLUMN date_closing datetime DEFAULT NULL after date_valid;
|
||||
ALTER TABLE llx_facture ADD COLUMN fk_user_closing integer DEFAULT NULL after fk_user_valid;
|
||||
|
||||
ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1 NOT NULL;
|
||||
|
||||
@ -311,3 +312,4 @@ create table llx_fichinterdet_rec
|
||||
|
||||
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_start datetime DEFAULT NULL AFTER product_type;
|
||||
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_end datetime DEFAULT NULL AFTER date_start;
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ create table llx_facture
|
||||
date_pointoftax date DEFAULT NULL, -- date point of tax (for GB)
|
||||
date_valid date, -- date validation
|
||||
tms timestamp, -- date creation/modification
|
||||
date_closing datetime, -- date de cloture
|
||||
paye smallint DEFAULT 0 NOT NULL,
|
||||
amount double(24,8) DEFAULT 0 NOT NULL,
|
||||
remise_percent real DEFAULT 0, -- remise relative
|
||||
@ -62,7 +63,8 @@ create table llx_facture
|
||||
fk_user_author integer, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
fk_user_valid integer, -- user validating
|
||||
|
||||
fk_user_closing integer, -- user closing
|
||||
|
||||
module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ...)
|
||||
pos_source varchar(32), -- name of POS station when invoice is generated by a POS module
|
||||
fk_fac_rec_source integer, -- facture rec source
|
||||
|
||||
@ -328,6 +328,7 @@ if (! empty($arrayfields['t.tobill']['checked']) || ! empty($arrayfields['t.bill
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
||||
}
|
||||
}
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user