Affiche liens de écriture sur page des rappro et sur page de detail d'une ecriture
This commit is contained in:
parent
bc797e3157
commit
fe87b759da
@ -121,25 +121,37 @@ class Account
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
* \brief Renvoi tableau des liens
|
||||||
|
* \param line_id Id ligne écriture
|
||||||
|
* \retuen array Tableau des liens
|
||||||
*/
|
*/
|
||||||
function get_url($line_id)
|
function get_url($line_id)
|
||||||
{
|
{
|
||||||
$lines = array();
|
$lines = array();
|
||||||
$sql = "SELECT fk_bank, url_id, url, label FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank = $line_id";
|
$sql = "SELECT url_id, url, label, type";
|
||||||
$result = $this->db->query($sql);
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank_url";
|
||||||
|
$sql.= " WHERE fk_bank = ".$line_id;
|
||||||
|
$sql.= " ORDER BY type, label";
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$num = $this->db->num_rows();
|
$num = $this->db->num_rows($result);
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
// Anciens liens (pour compatibilité)
|
||||||
$lines[$i][0] = $obj->url;
|
$lines[$i][0] = $obj->url;
|
||||||
$lines[$i][1] = $obj->url_id;
|
$lines[$i][1] = $obj->url_id;
|
||||||
$lines[$i][2] = $obj->label;
|
$lines[$i][2] = $obj->label;
|
||||||
|
$lines[$i][3] = $obj->type;
|
||||||
|
// Nouveaux liens
|
||||||
|
$lines[$i]['url'] = $obj->url;
|
||||||
|
$lines[$i]['url_id'] = $obj->url_id;
|
||||||
|
$lines[$i]['label'] = $obj->label;
|
||||||
|
$lines[$i]['type'] = $obj->type;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
return $lines;
|
return $lines;
|
||||||
|
|||||||
@ -365,7 +365,7 @@ llxFooter('$Date$ - $Revision$');
|
|||||||
*/
|
*/
|
||||||
function _print_lines($db,$result,$sql,$acct)
|
function _print_lines($db,$result,$sql,$acct)
|
||||||
{
|
{
|
||||||
global $bc, $nbline, $viewline, $user, $page;
|
global $langs, $bc, $nbline, $viewline, $user, $page;
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$total=0;
|
$total=0;
|
||||||
@ -395,18 +395,19 @@ function _print_lines($db,$result,$sql,$acct)
|
|||||||
print "<td nowrap>".dolibarr_print_date($objp->do,"%d/%m/%y")."</td>\n";
|
print "<td nowrap>".dolibarr_print_date($objp->do,"%d/%m/%y")."</td>\n";
|
||||||
print "<td nowrap> ".dolibarr_print_date($objp->dv,"%d/%m/%y")."</td>\n";
|
print "<td nowrap> ".dolibarr_print_date($objp->dv,"%d/%m/%y")."</td>\n";
|
||||||
print "<td nowrap> ".$objp->fk_type." ".($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
print "<td nowrap> ".$objp->fk_type." ".($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||||
print "<td><a href=\"ligne.php?rowid=$objp->rowid&account=$acct->id\">$objp->label</a>";
|
print '<td><a href="ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'">'.$objp->label.'</a>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajout les liens
|
* Ajout les liens
|
||||||
*/
|
*/
|
||||||
$urls_line = $acct->get_url($objp->rowid);
|
$links = $acct->get_url($objp->rowid);
|
||||||
$numurl = sizeof($urls_line);
|
foreach($links as $key=>$val)
|
||||||
$k = 0;
|
|
||||||
while ($k < $numurl)
|
|
||||||
{
|
{
|
||||||
print ' <a href="'.$urls_line[$k][0].$urls_line[$k][1].'">'.$urls_line[$k][2].'</a>';
|
print ' - ';
|
||||||
$k++;
|
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||||
|
// if ($links[$key]['type']=='payment') { print img_object($langs->trans('ShowPayment'),'payment').' '; }
|
||||||
|
// if ($links[$key]['type']=='company') { print img_object($langs->trans('ShowCustomer'),'company').' '; }
|
||||||
|
print $links[$key]['label'].'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -129,8 +129,21 @@ if ($_POST["action"] == 'type')
|
|||||||
|
|
||||||
if ($_POST["action"] == 'num_releve')
|
if ($_POST["action"] == 'num_releve')
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank set num_releve=".$_POST["num_rel"]." WHERE rowid = $rowid;";
|
$db->begin();
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||||
|
$sql.= " SET num_releve='".$_POST["num_rel"]."'";
|
||||||
|
$sql.= " WHERE rowid = ".$rowid;
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,6 +211,8 @@ if ($result)
|
|||||||
$acct->fetch($objp->fk_account);
|
$acct->fetch($objp->fk_account);
|
||||||
$account = $acct->id;
|
$account = $acct->id;
|
||||||
|
|
||||||
|
$links=$acct->get_url($rowid);
|
||||||
|
|
||||||
// Tableau sur 4 colonne si déja rapproché, sinon sur 5 colonnes
|
// Tableau sur 4 colonne si déja rapproché, sinon sur 5 colonnes
|
||||||
|
|
||||||
// Author
|
// Author
|
||||||
@ -211,7 +226,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="3"> </td>';
|
print '<td colspan="4"> </td>';
|
||||||
}
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
@ -246,7 +261,10 @@ if ($result)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
*/
|
*/
|
||||||
print '<td colspan="4"><a href="account.php?account='.$acct->id."\">".$acct->label."</a></td>";
|
print '<td colspan="4">';
|
||||||
|
print '<a href="account.php?account='.$acct->id.'">'.$acct->label.'</a>';
|
||||||
|
print '<input type="hidden" name="accountid" value="'.$acct->id.'">';
|
||||||
|
print '</td>';
|
||||||
/*
|
/*
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -254,23 +272,24 @@ if ($result)
|
|||||||
|
|
||||||
// Date ope
|
// Date ope
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td colspan="3">';
|
|
||||||
if (! $objp->rappro)
|
if (! $objp->rappro)
|
||||||
{
|
{
|
||||||
|
print '<td colspan="3">';
|
||||||
$html->select_date($objp->do,'do');
|
$html->select_date($objp->do,'do');
|
||||||
print '</td><td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></td>';
|
print '</td><td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
print '<td colspan="4">';
|
||||||
print dolibarr_print_date($objp->do);
|
print dolibarr_print_date($objp->do);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Value date
|
// Value date
|
||||||
print "<tr><td>".$langs->trans("DateValue")."</td>";
|
print "<tr><td>".$langs->trans("DateValue")."</td>";
|
||||||
print '<td colspan="3">';
|
|
||||||
if (! $objp->rappro)
|
if (! $objp->rappro)
|
||||||
{
|
{
|
||||||
|
print '<td colspan="3">';
|
||||||
$html->select_date($objp->dv,'dv');
|
$html->select_date($objp->dv,'dv');
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="ligne.php?action=dvprev&account='.$_GET["account"].'&rowid='.$objp->rowid.'">';
|
print '<a href="ligne.php?action=dvprev&account='.$_GET["account"].'&rowid='.$objp->rowid.'">';
|
||||||
@ -281,6 +300,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
print '<td colspan="4">';
|
||||||
print dolibarr_print_date($objp->dv);
|
print dolibarr_print_date($objp->dv);
|
||||||
}
|
}
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
@ -290,26 +310,43 @@ if ($result)
|
|||||||
if (! $objp->rappro)
|
if (! $objp->rappro)
|
||||||
{
|
{
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td colspan="2">';
|
|
||||||
}
|
|
||||||
print '<input name="label" class="flat" value="'.$objp->label.'" size="50">';
|
print '<input name="label" class="flat" value="'.$objp->label.'" size="50">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td colspan="4">';
|
||||||
|
print $objp->label;
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Affiche liens
|
||||||
|
if (sizeof($links)) {
|
||||||
|
print "<tr><td>".$langs->trans("Links")."</td>";
|
||||||
|
print '<td colspan="3">';
|
||||||
|
foreach($links as $key=>$val)
|
||||||
|
{
|
||||||
|
if ($key) print '<br>';
|
||||||
|
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||||
|
if ($links[$key]['type']=='payment') { print img_object($langs->trans('ShowPayment'),'payment').' '; }
|
||||||
|
if ($links[$key]['type']=='company') { print img_object($langs->trans('ShowCustomer'),'company').' '; }
|
||||||
|
print $links[$key]['label'].'</a>';
|
||||||
|
}
|
||||||
|
print '</td><td> </td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print "<tr><td>".$langs->trans("Amount")."</td>";
|
print "<tr><td>".$langs->trans("Amount")."</td>";
|
||||||
print '<td colspan="3">';
|
|
||||||
if (! $objp->rappro)
|
if (! $objp->rappro)
|
||||||
{
|
{
|
||||||
print '<input name="amount" class="flat" value="'.price($objp->amount).'">';
|
print '<td colspan="3">';
|
||||||
|
print '<input name="amount" class="flat" size="10" value="'.price($objp->amount).'"> '.$conf->monnaie;
|
||||||
print '</td><td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
print '</td><td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
print '<td colspan="4">';
|
||||||
print price($objp->amount);
|
print price($objp->amount);
|
||||||
}
|
}
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|||||||
@ -122,7 +122,8 @@ $acct = new Account($db);
|
|||||||
$acct->fetch($_GET["account"]);
|
$acct->fetch($_GET["account"]);
|
||||||
|
|
||||||
$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, ".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type as type";
|
$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, ".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type as type";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b WHERE rappro=0 AND fk_account=".$_GET["account"];
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
|
$sql.= " WHERE rappro=0 AND fk_account=".$_GET["account"];
|
||||||
$sql.= " ORDER BY dateo";
|
$sql.= " ORDER BY dateo";
|
||||||
$sql.= " ASC LIMIT ".$conf->liste_limit;
|
$sql.= " ASC LIMIT ".$conf->liste_limit;
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ if ($resql)
|
|||||||
$var=True;
|
$var=True;
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
print_titre('Rapprochement compte bancaire : <a href="account.php?account='.$_GET["account"].'">'.$acct->label.'</a>');
|
print_titre($langs->trans("Reconciliation").': <a href="account.php?account='.$_GET["account"].'">'.$acct->label.'</a>');
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
if ($msg) {
|
if ($msg) {
|
||||||
@ -198,7 +199,20 @@ if ($resql)
|
|||||||
print '<td nowrap>'.dolibarr_print_date($objp->do).'</td>';
|
print '<td nowrap>'.dolibarr_print_date($objp->do).'</td>';
|
||||||
print '<td nowrap>'.dolibarr_print_date($objp->dv).'</td>';
|
print '<td nowrap>'.dolibarr_print_date($objp->dv).'</td>';
|
||||||
print '<td nowrap>'.$objp->type.($objp->num_chq?' '.$objp->num_chq:'').'</td>';
|
print '<td nowrap>'.$objp->type.($objp->num_chq?' '.$objp->num_chq:'').'</td>';
|
||||||
print '<td>'.$objp->label.'</td>';
|
print '<td><a href="ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'">'.$objp->label.'</a>';
|
||||||
|
/*
|
||||||
|
* Ajout les liens
|
||||||
|
*/
|
||||||
|
$links = $acct->get_url($objp->rowid);
|
||||||
|
foreach($links as $key=>$val)
|
||||||
|
{
|
||||||
|
print ' - ';
|
||||||
|
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||||
|
// if ($links[$key]['type']=='payment') { print img_object($langs->trans('ShowPayment'),'payment').' '; }
|
||||||
|
// if ($links[$key]['type']=='company') { print img_object($langs->trans('ShowCustomer'),'company').' '; }
|
||||||
|
print $links[$key]['label'].'</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
if ($objp->amount < 0)
|
if ($objp->amount < 0)
|
||||||
{
|
{
|
||||||
@ -216,7 +230,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Si pas encore rapproch
|
// Si pas encore rapprochée
|
||||||
if ($user->rights->banque->modifier)
|
if ($user->rights->banque->modifier)
|
||||||
{
|
{
|
||||||
print '<td align="center" width="30">';
|
print '<td align="center" width="30">';
|
||||||
@ -270,7 +284,7 @@ if ($resql)
|
|||||||
|
|
||||||
if ($num != 0)
|
if ($num != 0)
|
||||||
{
|
{
|
||||||
print "</table>\n";
|
print "</table><br>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user