Add RefExt field on RemiseCheque
This commit is contained in:
parent
aff2be1bc0
commit
7abc53698a
@ -37,6 +37,7 @@ class RemiseCheque extends CommonObject
|
|||||||
var $id;
|
var $id;
|
||||||
var $num;
|
var $num;
|
||||||
var $intitule;
|
var $intitule;
|
||||||
|
var $ref_ext;
|
||||||
//! Numero d'erreur Plage 1024-1279
|
//! Numero d'erreur Plage 1024-1279
|
||||||
var $errno;
|
var $errno;
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ class RemiseCheque extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.number, bc.statut, bc.nbcheque";
|
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.number, bc.statut, bc.nbcheque, bc.ref_ext";
|
||||||
$sql.= ", bc.date_bordereau as date_bordereau";
|
$sql.= ", bc.date_bordereau as date_bordereau";
|
||||||
$sql.= ", ba.label as account_label";
|
$sql.= ", ba.label as account_label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
||||||
@ -86,6 +87,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$this->author_id = $obj->fk_user_author;
|
$this->author_id = $obj->fk_user_author;
|
||||||
$this->nbcheque = $obj->nbcheque;
|
$this->nbcheque = $obj->nbcheque;
|
||||||
$this->statut = $obj->statut;
|
$this->statut = $obj->statut;
|
||||||
|
$this->ref_ext = $obj->ref_ext;
|
||||||
|
|
||||||
if ($this->statut == 0)
|
if ($this->statut == 0)
|
||||||
{
|
{
|
||||||
@ -139,6 +141,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$sql.= ", number";
|
$sql.= ", number";
|
||||||
$sql.= ", entity";
|
$sql.= ", entity";
|
||||||
$sql.= ", nbcheque";
|
$sql.= ", nbcheque";
|
||||||
|
$sql.= ", ref_ext";
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
$sql.= $this->db->idate($now);
|
$sql.= $this->db->idate($now);
|
||||||
$sql.= ", ".$this->db->idate($now);
|
$sql.= ", ".$this->db->idate($now);
|
||||||
@ -149,6 +152,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$sql.= ", 0";
|
$sql.= ", 0";
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
$sql.= ", 0";
|
$sql.= ", 0";
|
||||||
|
$sql.= ", ''";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
|
dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
|
||||||
@ -721,6 +725,41 @@ class RemiseCheque extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the external ref
|
||||||
|
*
|
||||||
|
* @param User $user Object user
|
||||||
|
* @param timestamp $ref_rext External ref
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function set_ref_ext($user, $ref_ext)
|
||||||
|
{
|
||||||
|
if ($user->rights->banque->cheque)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||||
|
$sql.= " SET ref_ext = '".$ref_ext."'";
|
||||||
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
dol_syslog("RemiseCheque::set_ref_ext sql=$sql",LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$this->ref_ext = $ref_ext;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
dol_syslog("RemiseCheque::set_ref_ext ".$this->error,LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoie nom clicable (avec eventuellement le picto)
|
* Renvoie nom clicable (avec eventuellement le picto)
|
||||||
|
|||||||
@ -89,6 +89,29 @@ if ($action == 'setdate' && $user->rights->banque->cheque)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($action == 'setrefext' && $user->rights->banque->cheque)
|
||||||
|
{
|
||||||
|
$result = $object->fetch(GETPOST('id','int'));
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$ref_ext = GETPOST('ref_ext');
|
||||||
|
|
||||||
|
$result=$object->set_ref_ext($user, $ref_ext);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$object->error.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$object->error.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->cheque)
|
if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->cheque)
|
||||||
{
|
{
|
||||||
if (is_array($_POST['toRemise']))
|
if (is_array($_POST['toRemise']))
|
||||||
@ -492,6 +515,32 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// External ref
|
||||||
|
print '<tr><td>';
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('RefExt');
|
||||||
|
print '</td>';
|
||||||
|
if ($action != 'editrefext') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editrefext&id='.$object->id.'">'.img_edit($langs->trans('SetRefExt'),1).'</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td colspan="2">';
|
||||||
|
if ($action == 'editrefext')
|
||||||
|
{
|
||||||
|
print '<form name="setrefext" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="setrefext">';
|
||||||
|
print '<input type="text" name="ref_ext" value="'.$object->ref_ext.'">';
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $object->ref_ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('Account').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('Account').'</td><td colspan="2">';
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -275,3 +275,6 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
|
|||||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN22', 1001, '', 0, '', 'Tozeur', 1);
|
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN22', 1001, '', 0, '', 'Tozeur', 1);
|
||||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN23', 1001, '', 0, '', 'Tunis', 1);
|
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN23', 1001, '', 0, '', 'Tunis', 1);
|
||||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN24', 1001, '', 0, '', 'Zaghouan', 1);
|
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN24', 1001, '', 0, '', 'Zaghouan', 1);
|
||||||
|
|
||||||
|
# Add ref_ext on bordereau_cheque
|
||||||
|
ALTER TABLE `llx_bordereau_cheque` ADD `ref_ext` VARCHAR( 255 ) NOT NULL;
|
||||||
|
|||||||
@ -33,6 +33,7 @@ create table llx_bordereau_cheque
|
|||||||
fk_bank_account integer,
|
fk_bank_account integer,
|
||||||
fk_user_author integer,
|
fk_user_author integer,
|
||||||
note text,
|
note text,
|
||||||
statut smallint NOT NULL DEFAULT 0
|
statut smallint NOT NULL DEFAULT 0,
|
||||||
|
ref_ext varchar(255)
|
||||||
|
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -154,3 +154,4 @@ InvoiceLinesToDispatch=Invoice lines to dispatch
|
|||||||
InvoiceDispatched=Dispatched invoices
|
InvoiceDispatched=Dispatched invoices
|
||||||
AccountancyDashboard=Accountancy summary
|
AccountancyDashboard=Accountancy summary
|
||||||
ByProductsAndServices=By products and services
|
ByProductsAndServices=By products and services
|
||||||
|
RefExt=External ref
|
||||||
@ -165,3 +165,4 @@ InvoiceLinesToDispatch=Lignes de factures à ventiler
|
|||||||
InvoiceDispatched=Factures ventilées
|
InvoiceDispatched=Factures ventilées
|
||||||
AccountancyDashboard=Synthèse compta/tréso
|
AccountancyDashboard=Synthèse compta/tréso
|
||||||
ByProductsAndServices=Par produits et services
|
ByProductsAndServices=Par produits et services
|
||||||
|
RefExt=Référence externe
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user