Debug
This commit is contained in:
parent
77b123cb2d
commit
ce6df7c022
@ -47,6 +47,7 @@ $langs->load("categories");
|
|||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("loan");
|
$langs->load("loan");
|
||||||
|
$langs->load("donations");
|
||||||
|
|
||||||
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
|
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
|
||||||
$ref = GETPOST('ref','alpha');
|
$ref = GETPOST('ref','alpha');
|
||||||
@ -617,6 +618,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
|
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
|
elseif ($links[$key]['type']=='payment_donation')
|
||||||
|
{
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
|
||||||
|
print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
elseif ($links[$key]['type']=='banktransfert')
|
elseif ($links[$key]['type']=='banktransfert')
|
||||||
{
|
{
|
||||||
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
|
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
|
||||||
@ -716,21 +723,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$chargestatic->ref=$chargestatic->lib;
|
$chargestatic->ref=$chargestatic->lib;
|
||||||
print $chargestatic->getNomUrl(1,16);
|
print $chargestatic->getNomUrl(1,16);
|
||||||
}
|
}
|
||||||
else if ($links[$key]['type']=='donation')
|
|
||||||
{
|
|
||||||
$donstatic->id=$links[$key]['url_id'];
|
|
||||||
if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
|
|
||||||
{
|
|
||||||
if ($reg[1]=='donation') $reg[1]='Donation';
|
|
||||||
$donstatic->lib=$langs->trans($reg[1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$donstatic->lib=$links[$key]['label'];
|
|
||||||
}
|
|
||||||
$donstatic->ref=$donstatic->lib;
|
|
||||||
print $donstatic->getNomUrl(1,16);
|
|
||||||
}
|
|
||||||
else if ($links[$key]['type']=='loan')
|
else if ($links[$key]['type']=='loan')
|
||||||
{
|
{
|
||||||
$loanstatic->id=$links[$key]['url_id'];
|
$loanstatic->id=$links[$key]['url_id'];
|
||||||
|
|||||||
@ -78,11 +78,6 @@ function donation_prepare_head($object)
|
|||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation');
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT . '/don/document.php?id='.$object->id;
|
|
||||||
$head[$h][1] = $langs->trans("Documents");
|
|
||||||
$head[$h][2] = 'documents';
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT . '/don/info.php?id=' . $object->id;
|
$head[$h][0] = DOL_URL_ROOT . '/don/info.php?id=' . $object->id;
|
||||||
$head[$h][1] = $langs->trans("Info");
|
$head[$h][1] = $langs->trans("Info");
|
||||||
|
|||||||
@ -175,7 +175,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', 'donations', 6__+MAX_llx_menu__, '/don/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', 'donations', 6__+MAX_llx_menu__, '/don/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/card.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/card.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/list.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/list.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
||||||
-- Special expenses
|
-- Special expenses
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)', '', 0, 6, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)', '', 0, 6, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__);
|
||||||
|
|||||||
@ -810,7 +810,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$newmenu->add("/don/index.php?leftmenu=donations&mainmenu=accountancy",$langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations');
|
$newmenu->add("/don/index.php?leftmenu=donations&mainmenu=accountancy",$langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations');
|
||||||
if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/card.php?action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer);
|
if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/card.php?action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer);
|
||||||
if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/list.php",$langs->trans("List"), 1, $user->rights->don->lire);
|
if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/list.php",$langs->trans("List"), 1, $user->rights->don->lire);
|
||||||
if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire);
|
// if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Taxes and social contributions
|
// Taxes and social contributions
|
||||||
|
|||||||
@ -214,7 +214,7 @@ if ($action == 'set_cancel')
|
|||||||
}
|
}
|
||||||
if ($action == 'set_paid')
|
if ($action == 'set_paid')
|
||||||
{
|
{
|
||||||
if ($object->set_paye($id, $modepayment) >= 0)
|
if ($object->set_paid($id, $modepayment) >= 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
@ -223,17 +223,6 @@ if ($action == 'set_paid')
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action == 'set_encaisse')
|
|
||||||
{
|
|
||||||
if ($object->set_encaisse($id) >= 0)
|
|
||||||
{
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setEventMessage($object->error, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build doc
|
* Build doc
|
||||||
@ -398,6 +387,7 @@ if (! empty($id) && $action == 'edit')
|
|||||||
|
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
|
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
|
||||||
|
print '<input type="hidden" name="amount" value="'.$object->amount.'">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print "<tr>".'<td>'.$langs->trans("Ref").'</td><td colspan="2">';
|
print "<tr>".'<td>'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||||
@ -408,13 +398,22 @@ if (! empty($id) && $action == 'edit')
|
|||||||
$nbrows=12;
|
$nbrows=12;
|
||||||
if (! empty($conf->projet->enabled)) $nbrows++;
|
if (! empty($conf->projet->enabled)) $nbrows++;
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print "<tr>".'<td width="25%" class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
print "<tr>".'<td width="25%" class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||||
$form->select_date($object->date,'','','','',"update");
|
$form->select_date($object->date,'','','','',"update");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.$object->amount.'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
if ($object->statut == 0)
|
||||||
|
{
|
||||||
|
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.$object->amount.'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">';
|
||||||
|
print price($object->amount,0,$langs,0,0,-1,$conf->currency);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
|
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
|
||||||
print $form->selectyesno("public",1,1);
|
print $form->selectyesno("public",1,1);
|
||||||
@ -549,7 +548,7 @@ if (! empty($id) && $action != 'edit')
|
|||||||
/*
|
/*
|
||||||
* Payments
|
* Payments
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT p.rowid, p.num_payment, datep as dp, p.amount,";
|
$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
|
||||||
$sql.= "c.code as type_code,c.libelle as paiement_type";
|
$sql.= "c.code as type_code,c.libelle as paiement_type";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
|
$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
|
||||||
@ -558,7 +557,7 @@ if (! empty($id) && $action != 'edit')
|
|||||||
$sql.= " AND p.fk_donation = d.rowid";
|
$sql.= " AND p.fk_donation = d.rowid";
|
||||||
$sql.= " AND d.entity = ".$conf->entity;
|
$sql.= " AND d.entity = ".$conf->entity;
|
||||||
$sql.= " AND p.fk_typepayment = c.id";
|
$sql.= " AND p.fk_typepayment = c.id";
|
||||||
$sql.= " ORDER BY dp DESC";
|
$sql.= " ORDER BY dp";
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -581,7 +580,7 @@ if (! empty($id) && $action != 'edit')
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var]."><td>";
|
print "<tr ".$bc[$var]."><td>";
|
||||||
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
|
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
|
||||||
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||||
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->paiement_type;
|
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->paiement_type;
|
||||||
print "<td>".$labeltype.' '.$object->num_paiement."</td>\n";
|
print "<td>".$labeltype.' '.$object->num_paiement."</td>\n";
|
||||||
|
|||||||
@ -718,7 +718,7 @@ class Don extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql .= ", fk_payment=$modepayment";
|
$sql .= ", fk_payment=$modepayment";
|
||||||
}
|
}
|
||||||
$sql .= " WHERE rowid = $rowid AND fk_statut = 1";
|
$sql .= " WHERE rowid = $id AND fk_statut = 1";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -809,7 +809,7 @@ class Don extends CommonObject
|
|||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowDonation").': '.$this->id;
|
$label=$langs->trans("ShowDonation").': '.$this->id;
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/don/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/don/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='generic';
|
$picto='generic';
|
||||||
|
|||||||
@ -82,14 +82,14 @@ class PaymentDonation extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation);
|
if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation);
|
||||||
if (isset($this->amount)) $this->amount=trim($this->amount);
|
if (isset($this->amount)) $this->amount=trim($this->amount);
|
||||||
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
|
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
|
||||||
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
|
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
|
||||||
if (isset($this->note)) $this->note=trim($this->note);
|
if (isset($this->note)) $this->note=trim($this->note);
|
||||||
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
|
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
|
||||||
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
|
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
|
||||||
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
|
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
|
||||||
|
|
||||||
$totalamount = 0;
|
$totalamount = 0;
|
||||||
foreach ($this->amounts as $key => $value) // How payment is dispatch
|
foreach ($this->amounts as $key => $value) // How payment is dispatch
|
||||||
@ -183,23 +183,23 @@ class PaymentDonation extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
|
|
||||||
$this->fk_donation = $obj->fk_donation;
|
$this->fk_donation = $obj->fk_donation;
|
||||||
$this->datec = $this->db->jdate($obj->datec);
|
$this->datec = $this->db->jdate($obj->datec);
|
||||||
$this->tms = $this->db->jdate($obj->tms);
|
$this->tms = $this->db->jdate($obj->tms);
|
||||||
$this->datep = $this->db->jdate($obj->datep);
|
$this->datep = $this->db->jdate($obj->datep);
|
||||||
$this->amount = $obj->amount;
|
$this->amount = $obj->amount;
|
||||||
$this->fk_typepayment = $obj->fk_typepayment;
|
$this->fk_typepayment = $obj->fk_typepayment;
|
||||||
$this->num_payment = $obj->num_payment;
|
$this->num_payment = $obj->num_payment;
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note;
|
||||||
$this->fk_bank = $obj->fk_bank;
|
$this->fk_bank = $obj->fk_bank;
|
||||||
$this->fk_user_creat = $obj->fk_user_creat;
|
$this->fk_user_creat = $obj->fk_user_creat;
|
||||||
$this->fk_user_modif = $obj->fk_user_modif;
|
$this->fk_user_modif = $obj->fk_user_modif;
|
||||||
|
|
||||||
$this->type_code = $obj->type_code;
|
$this->type_code = $obj->type_code;
|
||||||
$this->type_libelle = $obj->type_libelle;
|
$this->type_libelle = $obj->type_libelle;
|
||||||
|
|
||||||
$this->bank_account = $obj->fk_account;
|
$this->bank_account = $obj->fk_account;
|
||||||
$this->bank_line = $obj->fk_bank;
|
$this->bank_line = $obj->fk_bank;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
@ -227,14 +227,14 @@ class PaymentDonation extends CommonObject
|
|||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
|
||||||
if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation);
|
if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation);
|
||||||
if (isset($this->amount)) $this->amount=trim($this->amount);
|
if (isset($this->amount)) $this->amount=trim($this->amount);
|
||||||
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
|
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
|
||||||
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
|
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
|
||||||
if (isset($this->note)) $this->note=trim($this->note);
|
if (isset($this->note)) $this->note=trim($this->note);
|
||||||
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
|
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
|
||||||
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
|
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
|
||||||
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
|
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -482,14 +482,14 @@ class PaymentDonation extends CommonObject
|
|||||||
$acc->fetch($accountid);
|
$acc->fetch($accountid);
|
||||||
|
|
||||||
$total=$this->total;
|
$total=$this->total;
|
||||||
if ($mode == 'payment_donation') $total=-$total;
|
if ($mode == 'payment_donation') $amount=$total;
|
||||||
|
|
||||||
// Insert payment into llx_bank
|
// Insert payment into llx_bank
|
||||||
$bank_line_id = $acc->addline(
|
$bank_line_id = $acc->addline(
|
||||||
$this->datepaid,
|
$this->datepaid,
|
||||||
$this->paymenttype, // Payment mode id or code ("CHQ or VIR for example")
|
$this->paymenttype, // Payment mode id or code ("CHQ or VIR for example")
|
||||||
$label,
|
$label,
|
||||||
$total,
|
$amount,
|
||||||
$this->num_payment,
|
$this->num_payment,
|
||||||
'',
|
'',
|
||||||
$user,
|
$user,
|
||||||
@ -520,19 +520,6 @@ class PaymentDonation extends CommonObject
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add link 'thirdparty' in bank_url between donation and bank transaction (for each donation concerned by payment)
|
|
||||||
$linkaddedforthirdparty=array();
|
|
||||||
foreach ($this->amounts as $key => $value)
|
|
||||||
{
|
|
||||||
if ($mode == 'payment_donation')
|
|
||||||
{
|
|
||||||
$don = new Don($this->db);
|
|
||||||
$don->fetch($key);
|
|
||||||
$result=$acc->add_url_line($bank_line_id, $don->rowid, DOL_URL_ROOT.'/don/card.php?rowid=', $don->type_libelle.(($don->lib && $don->lib!=$don->type_libelle)?' ('.$don->lib.')':''),'donation');
|
|
||||||
if ($result <= 0) dol_print_error($this->db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -553,7 +540,7 @@ class PaymentDonation extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank generee
|
* Update link between the donation payment and the generated line in llx_bank
|
||||||
*
|
*
|
||||||
* @param int $id_bank Id if bank
|
* @param int $id_bank Id if bank
|
||||||
* @return int >0 if OK, <=0 if KO
|
* @return int >0 if OK, <=0 if KO
|
||||||
@ -593,7 +580,7 @@ class PaymentDonation extends CommonObject
|
|||||||
|
|
||||||
if (!empty($this->id))
|
if (!empty($this->id))
|
||||||
{
|
{
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
|
if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
|
||||||
|
|||||||
@ -1,125 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/don/document.php
|
|
||||||
* \ingroup donations
|
|
||||||
* \brief Page of linked files into donations
|
|
||||||
*/
|
|
||||||
|
|
||||||
require '../main.inc.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|
||||||
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("donations");
|
|
||||||
$langs->load("companies");
|
|
||||||
$langs->load("interventions");
|
|
||||||
|
|
||||||
$id = GETPOST('id','int');
|
|
||||||
$ref = GETPOST('ref', 'alpha');
|
|
||||||
$action = GETPOST('action','alpha');
|
|
||||||
$confirm = GETPOST('confirm','alpha');
|
|
||||||
|
|
||||||
// Security check
|
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
|
||||||
$result = restrictedArea($user, 'don', $id, '');
|
|
||||||
|
|
||||||
// Get parameters
|
|
||||||
$sortfield = GETPOST('sortfield','alpha');
|
|
||||||
$sortorder = GETPOST('sortorder','alpha');
|
|
||||||
$page = GETPOST('page','int');
|
|
||||||
if ($page == -1) { $page = 0; }
|
|
||||||
$offset = $conf->liste_limit * $page;
|
|
||||||
$pageprev = $page - 1;
|
|
||||||
$pagenext = $page + 1;
|
|
||||||
if (! $sortorder) $sortorder="ASC";
|
|
||||||
if (! $sortfield) $sortfield="name";
|
|
||||||
|
|
||||||
$object = new Don($db);
|
|
||||||
$object->fetch($id, $ref);
|
|
||||||
|
|
||||||
$upload_dir = $conf->dons->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
|
||||||
$modulepart='don';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
|
|
||||||
llxHeader("","",$langs->trans("Don"));
|
|
||||||
|
|
||||||
|
|
||||||
if ($object->id)
|
|
||||||
{
|
|
||||||
$object->fetch_thirdparty();
|
|
||||||
|
|
||||||
$head=donation_prepare_head($object);
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'documents', $langs->trans("Don"), 0, 'bill');
|
|
||||||
|
|
||||||
|
|
||||||
// Built files list
|
|
||||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
|
||||||
$totalsize=0;
|
|
||||||
foreach($filearray as $key => $file)
|
|
||||||
{
|
|
||||||
$totalsize+=$file['size'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
// Ref
|
|
||||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
|
|
||||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
$modulepart = 'don';
|
|
||||||
$permission = $user->rights->don->creer;
|
|
||||||
$param = '&id=' . $object->id;
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("ErrorUnknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
@ -126,7 +126,7 @@ $head[$h][1] = $langs->trans("Card");
|
|||||||
$hselected = $h;
|
$hselected = $h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("PaymentDonation"), 0, 'payment');
|
dol_fiche_head($head, $hselected, $langs->trans("DonationPayment"), 0, 'payment');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la suppression du paiement
|
* Confirmation de la suppression du paiement
|
||||||
@ -151,19 +151,19 @@ if ($action == 'valide')
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td valign="top" width="140">'.$langs->trans('Ref').'</td>';
|
print '<tr><td valign="top" width="20%">'.$langs->trans('Ref').'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print $form->showrefnav($payment,'id','',1,'rowid','id');
|
print $form->showrefnav($payment,'id','',1,'rowid','id');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td valign="top" width="120">'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($payment->datep,'day').'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($payment->datep,'day').'</td></tr>';
|
||||||
|
|
||||||
// Mode
|
// Mode
|
||||||
print '<tr><td valign="top">'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$payment->type_code).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$payment->type_code).'</td></tr>';
|
||||||
|
|
||||||
// Number
|
// Number
|
||||||
print '<tr><td valign="top">'.$langs->trans('Number').'</td><td colspan="3">'.$payment->num_paiement.'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Number').'</td><td colspan="3">'.$payment->num_payment.'</td></tr>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($payment->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($payment->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||||
@ -196,7 +196,7 @@ print '</table>';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$disable_delete = 0;
|
$disable_delete = 0;
|
||||||
$sql = 'SELECT d.rowid as did, d.libelle, d.paid, d.amount as d_amount, pd.amount, pd.libelle as d_type';
|
$sql = 'SELECT d.rowid as did, d.paid, d.amount as d_amount, pd.amount';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_donation as pd,'.MAIN_DB_PREFIX.'don as d';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_donation as pd,'.MAIN_DB_PREFIX.'don as d';
|
||||||
$sql.= ' WHERE pd.fk_donation = d.rowid';
|
$sql.= ' WHERE pd.fk_donation = d.rowid';
|
||||||
$sql.= ' AND d.entity = '.$conf->entity;
|
$sql.= ' AND d.entity = '.$conf->entity;
|
||||||
@ -213,9 +213,7 @@ if ($resql)
|
|||||||
print '<br><table class="noborder" width="100%">';
|
print '<br><table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans('Donation').'</td>';
|
print '<td>'.$langs->trans('Donation').'</td>';
|
||||||
print '<td>'.$langs->trans('Type').'</td>';
|
print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
|
||||||
print '<td>'.$langs->trans('Label').'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans('ExpectedToPay').'</td>';
|
|
||||||
print '<td align="center">'.$langs->trans('Status').'</td>';
|
print '<td align="center">'.$langs->trans('Status').'</td>';
|
||||||
print '<td align="right">'.$langs->trans('PayedByThisPayment').'</td>';
|
print '<td align="right">'.$langs->trans('PayedByThisPayment').'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -235,13 +233,6 @@ if ($resql)
|
|||||||
$don->fetch($objp->did);
|
$don->fetch($objp->did);
|
||||||
print $don->getNomUrl(1);
|
print $don->getNomUrl(1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
// Type
|
|
||||||
print '<td>';
|
|
||||||
print $don->type_libelle;
|
|
||||||
/*print $don->type;*/
|
|
||||||
print "</td>\n";
|
|
||||||
// Label
|
|
||||||
print '<td>'.$objp->libelle.'</td>';
|
|
||||||
// Expected to pay
|
// Expected to pay
|
||||||
print '<td align="right">'.price($objp->d_amount).'</td>';
|
print '<td align="right">'.price($objp->d_amount).'</td>';
|
||||||
// Status
|
// Status
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,7 +26,7 @@
|
|||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/don/class/dontats.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/don/class/donstats.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
|
|
||||||
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||||
|
|||||||
@ -40,3 +40,4 @@ FrenchOptions=Options for France
|
|||||||
DONATION_ART200=Show article 200 from CGI if you are concerned
|
DONATION_ART200=Show article 200 from CGI if you are concerned
|
||||||
DONATION_ART238=Show article 238 from CGI if you are concerned
|
DONATION_ART238=Show article 238 from CGI if you are concerned
|
||||||
DONATION_ART885=Show article 885 from CGI if you are concerned
|
DONATION_ART885=Show article 885 from CGI if you are concerned
|
||||||
|
DonationPayment=Donation payment
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user