Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
e073fa15f7
@ -73,16 +73,16 @@ $description=GETPOST("description",'alpha');
|
||||
$dateop = dol_mktime(12,0,0,GETPOST("opmonth",'int'),GETPOST("opday",'int'),GETPOST("opyear",'int'));
|
||||
$debit=GETPOST("debit",'alpha');
|
||||
$credit=GETPOST("credit",'alpha');
|
||||
$type=GETPOST("type",'alpha');
|
||||
$account=GETPOST("account",'int');
|
||||
$accountancy_code=GETPOST('accountancy_code', 'alpha');
|
||||
$bid=GETPOST("bid","int");
|
||||
$search_type=GETPOST("search_type",'alpha');
|
||||
$search_account=GETPOST("search_account",'int')?GETPOST("search_account",'int'):GETPOST("account",'int');
|
||||
$search_accountancy_code=GETPOST('search_accountancy_code', 'alpha')?GETPOST('search_accountancy_code', 'alpha'):GETPOST('accountancy_code', 'alpha');
|
||||
$search_bid=GETPOST("search_bid","int")?GETPOST("search_bid","int"):GETPOST("bid","int");
|
||||
$search_ref=GETPOST('search_ref','alpha');
|
||||
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
||||
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
||||
$search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int'));
|
||||
$search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPOST('search_end_dvday', 'int'), GETPOST('search_end_dvyear', 'int'));
|
||||
$search_thirdparty=GETPOST("thirdparty",'alpha');
|
||||
$search_thirdparty=GETPOST("search_thirdparty",'alpha')?GETPOST("search_thirdparty",'alpha'):GETPOST("thirdparty",'alpha');
|
||||
$search_req_nb=GETPOST("req_nb",'alpha');
|
||||
$search_num_releve=GETPOST("search_num_releve",'alpha');
|
||||
$search_conciliated=GETPOST("search_conciliated",'int');
|
||||
@ -108,7 +108,7 @@ $mode_balance_ok=false;
|
||||
if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid'))
|
||||
{
|
||||
$sortfield = 'b.datev,b.dateo,b.rowid';
|
||||
if ($id > 0 || ! empty($ref) || $account > 0) $mode_balance_ok = true;
|
||||
if ($id > 0 || ! empty($ref) || $search_account > 0) $mode_balance_ok = true;
|
||||
}
|
||||
if (strtolower($sortorder) == 'desc') $mode_balance_ok = false;
|
||||
|
||||
@ -116,7 +116,7 @@ $object = new Account($db);
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$result=$object->fetch($id, $ref);
|
||||
$account = $object->id; // Force the search field on id of account
|
||||
$search_account = $object->id; // Force the search field on id of account
|
||||
}
|
||||
|
||||
|
||||
@ -179,10 +179,10 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_dv_start='';
|
||||
$search_dv_end='';
|
||||
$description="";
|
||||
$type="";
|
||||
$search_type="";
|
||||
$debit="";
|
||||
$credit="";
|
||||
$bid="";
|
||||
$search_bid="";
|
||||
$search_ref="";
|
||||
$search_req_nb='';
|
||||
$search_thirdparty='';
|
||||
@ -190,8 +190,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_conciliated='';
|
||||
$thirdparty='';
|
||||
|
||||
$account="";
|
||||
if ($id > 0 || ! empty($ref)) $account=$object->id;
|
||||
$search_account="";
|
||||
if ($id > 0 || ! empty($ref)) $search_account=$object->id;
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
@ -297,7 +297,7 @@ if (GETPOST('save') && ! $cancel && $user->rights->banque->modifier)
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
|
||||
}
|
||||
/*if (! empty($conf->accounting->enabled) && (empty($accountancy_code) || $accountancy_code == '-1'))
|
||||
/*if (! empty($conf->accounting->enabled) && (empty($search_accountancy_code) || $search_accountancy_code == '-1'))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
|
||||
$error++;
|
||||
@ -307,7 +307,7 @@ if (GETPOST('save') && ! $cancel && $user->rights->banque->modifier)
|
||||
{
|
||||
$objecttmp = new Account($db);
|
||||
$objecttmp->fetch($bankaccountid);
|
||||
$insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $accountancy_code);
|
||||
$insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $search_accountancy_code);
|
||||
if ($insertid > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
@ -364,26 +364,27 @@ $now = dol_now();
|
||||
|
||||
// Must be before button action
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($id > 0) $param.='&id='.urlencode($id);
|
||||
if (!empty($ref)) $param.='&ref='.urlencode($ref);
|
||||
if (!empty($search_ref)) $param.='&search_ref='.urlencode($search_ref);
|
||||
if (!empty($description)) $param.='&description='.urlencode($description);
|
||||
if (!empty($type)) $param.='&type='.urlencode($type);
|
||||
if (!empty($debit)) $param.='&debit='.$debit;
|
||||
if (!empty($credit)) $param.='&credit='.$credit;
|
||||
if (!empty($account)) $param.='&account='.$account;
|
||||
if (!empty($search_type)) $param.='&type='.urlencode($search_type);
|
||||
if (!empty($search_thirdparty)) $param.='&search_thirdparty='.urlencode($search_thirdparty);
|
||||
if (!empty($debit)) $param.='&debit='.urlencode($debit);
|
||||
if (!empty($credit)) $param.='&credit='.urlencode($credit);
|
||||
if (!empty($search_account)) $param.='&search_account='.urlencode($search_account);
|
||||
if (!empty($search_num_releve)) $param.='&search_num_releve='.urlencode($search_num_releve);
|
||||
if ($search_conciliated != '' && $search_conciliated != '-1') $param.='&search_conciliated='.urlencode($search_conciliated);
|
||||
if (!empty($bid)) $param.='&bid='.$bid;
|
||||
if ($search_bid > 0) $param.='&search_bid='.urlencode($search_bid);
|
||||
if (dol_strlen($search_dt_start) > 0) $param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||
if (dol_strlen($search_dt_end) > 0) $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||
if (dol_strlen($search_dv_start) > 0) $param .= '&search_start_dvmonth=' . GETPOST('search_start_dvmonth', 'int') . '&search_start_dvday=' . GETPOST('search_start_dvday', 'int') . '&search_start_dvyear=' . GETPOST('search_start_dvyear', 'int');
|
||||
if (dol_strlen($search_dv_end) > 0) $param .= '&search_end_dvmonth=' . GETPOST('search_end_dvmonth', 'int') . '&search_end_dvday=' . GETPOST('search_end_dvday', 'int') . '&search_end_dvyear=' . GETPOST('search_end_dvyear', 'int');
|
||||
if ($search_req_nb) $param.='&req_nb='.urlencode($search_req_nb);
|
||||
if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($search_req_nb) $param.='&req_nb='.urlencode($search_req_nb);
|
||||
if (GETPOST("search_thirdparty",'int')) $param.='&thirdparty='.urlencode(GETPOST("search_thirdparty",'int'));
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -454,7 +455,7 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ";
|
||||
if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
if ($search_bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank as b";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||
@ -462,21 +463,21 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
if ($account > 0) $sql.=" AND b.fk_account = ".$account;
|
||||
if ($search_account > 0) $sql.=" AND b.fk_account = ".$search_account;
|
||||
// Search period criteria
|
||||
if (dol_strlen($search_dt_start)>0) $sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
|
||||
if (dol_strlen($search_dt_end)>0) $sql .= " AND b.dateo <= '" . $db->idate($search_dt_end) . "'";
|
||||
// Search period criteria
|
||||
if (dol_strlen($search_dv_start)>0) $sql .= " AND b.datev >= '" . $db->idate($search_dv_start) . "'";
|
||||
if (dol_strlen($search_dv_end)>0) $sql .= " AND b.datev <= '" . $db->idate($search_dv_end) . "'";
|
||||
if ($search_ref) $sql.=natural_search("b.rowid", $search_ref);
|
||||
if ($search_ref) $sql.=natural_search("b.rowid", $search_ref, 1);
|
||||
if ($search_req_nb) $sql.= natural_search("b.num_chq", $search_req_nb);
|
||||
if ($search_num_releve) $sql.= natural_search("b.num_releve", $search_num_releve);
|
||||
if ($search_conciliated != '' && $search_conciliated != '-1') $sql.= " AND b.rappro = ".$search_conciliated;
|
||||
if ($search_thirdparty) $sql.= natural_search("s.nom", $search_thirdparty);
|
||||
if ($description) $sql.= natural_search("b.label", $description); // Warning some text are just translation keys, not translated strings
|
||||
if ($bid) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid;
|
||||
if (! empty($type)) $sql.= " AND b.fk_type = '".$db->escape($type)."' ";
|
||||
if ($search_bid > 0) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$search_bid;
|
||||
if (! empty($search_type)) $sql.= " AND b.fk_type = '".$db->escape($search_type)."' ";
|
||||
// Search criteria amount
|
||||
$debit = price2num(str_replace('-','',$debit));
|
||||
$credit = price2num(str_replace('-','',$credit));
|
||||
@ -518,11 +519,11 @@ if ($page >= $nbtotalofpages)
|
||||
}
|
||||
|
||||
// If not account defined $mode_balance_ok=false
|
||||
if (empty($account)) $mode_balance_ok=false;
|
||||
if (empty($search_account)) $mode_balance_ok=false;
|
||||
// If a search is done $mode_balance_ok=false
|
||||
if (! empty($search_ref)) $mode_balance_ok=false;
|
||||
if (! empty($req_nb)) $mode_balance_ok=false;
|
||||
if (! empty($type)) $mode_balance_ok=false;
|
||||
if (! empty($search_type)) $mode_balance_ok=false;
|
||||
if (! empty($debit)) $mode_balance_ok=false;
|
||||
if (! empty($credit)) $mode_balance_ok=false;
|
||||
if (! empty($thirdparty)) $mode_balance_ok=false;
|
||||
@ -643,7 +644,7 @@ if ($resql)
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td>'.$langs->trans("Numero").'</td>';
|
||||
//if (! $account > 0)
|
||||
//if (! $search_account > 0)
|
||||
//{
|
||||
print '<td align=right>'.$langs->trans("BankAccount").'</td>';
|
||||
//}
|
||||
@ -677,10 +678,10 @@ if ($resql)
|
||||
print '<td>';
|
||||
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq","alpha").'">';
|
||||
print '</td>';
|
||||
//if (! $account > 0)
|
||||
//if (! $search_account > 0)
|
||||
//{
|
||||
print '<td align=right>';
|
||||
$form->select_comptes(GETPOST('add_account','int')?GETPOST('add_account','int'):$account,'add_account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
|
||||
$form->select_comptes(GETPOST('add_account','int')?GETPOST('add_account','int'):$search_account,'add_account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
|
||||
print '</td>';
|
||||
//}
|
||||
print '<td align="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit","alpha").'"></td>';
|
||||
@ -688,7 +689,7 @@ if ($resql)
|
||||
/*if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
||||
print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, null, 1, 1, '');
|
||||
print '</td>';
|
||||
}*/
|
||||
print '<td align="center">';
|
||||
@ -733,7 +734,7 @@ if ($resql)
|
||||
if (! empty($conf->global->BANK_USE_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
$addbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$account).'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
$addbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$search_account).'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
$addbutton = '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
@ -768,15 +769,8 @@ if ($resql)
|
||||
|
||||
$picto='title_bank';
|
||||
if ($id > 0 || ! empty($ref)) $picto='';
|
||||
if (GETPOST("bid"))
|
||||
{
|
||||
$result=$bankcateg->fetch(GETPOST("bid"));
|
||||
print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit);
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit);
|
||||
|
||||
// We can add page now to param
|
||||
if ($page != '') $param.='&page='.urlencode($page);
|
||||
@ -799,6 +793,22 @@ if ($resql)
|
||||
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
if (! empty($conf->categorie->enabled))
|
||||
{
|
||||
// Categories
|
||||
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
|
||||
{
|
||||
$langs->load('categories');
|
||||
|
||||
// Bank line
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('RubriquesTransactions').' : ';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid, 'parent', null, null, 1);
|
||||
$moreforfilter.=$form->selectarray('search_bid', $cate_arbo, $search_bid, 1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
}
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
@ -842,7 +852,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['type']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 0, 1, 'maxwidth100');
|
||||
$form->select_types_paiements(empty($search_type)?'':$search_type, 'search_type', '', 2, 0, 1, 0, 1, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['b.num_chq']['checked']))
|
||||
@ -852,12 +862,12 @@ if ($resql)
|
||||
}
|
||||
if (! empty($arrayfields['bu.label']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'" size="10"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'" size="10"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['ba.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$form->select_comptes($account,'account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
|
||||
$form->select_comptes($search_account,'search_account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['b.debit']['checked']))
|
||||
@ -947,7 +957,7 @@ if ($resql)
|
||||
// If we are in a situation where we need/can show balance, we calculate the start of balance
|
||||
if (! $balancecalculated && (! empty($arrayfields['balancebefore']['checked']) || ! empty($arrayfields['balance']['checked'])) && $mode_balance_ok)
|
||||
{
|
||||
if (! $account)
|
||||
if (! $search_account)
|
||||
{
|
||||
dol_print_error('', 'account is not defined but $mode_balance_ok is true');
|
||||
exit;
|
||||
@ -962,7 +972,7 @@ if ($resql)
|
||||
$sqlforbalance.= " ".MAIN_DB_PREFIX."bank as b";
|
||||
$sqlforbalance.= " WHERE b.fk_account = ba.rowid";
|
||||
$sqlforbalance.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sqlforbalance.= " AND b.fk_account = ".$account;
|
||||
$sqlforbalance.= " AND b.fk_account = ".$search_account;
|
||||
$sqlforbalance.= " AND (b.datev < '" . $db->idate($db->jdate($objp->dv)) . "' OR (b.datev = '" . $db->idate($db->jdate($objp->dv)) . "' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))";
|
||||
$resqlforbalance = $db->query($sqlforbalance);
|
||||
//print $sqlforbalance;
|
||||
@ -1048,7 +1058,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['b.rowid']['checked']))
|
||||
{
|
||||
print '<td align="left" class="nowrap">';
|
||||
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."</a> ";
|
||||
print "<a href=\"ligne.php?rowid=".$objp->rowid.'&save_lastsearch_values=1">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."</a> ";
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -564,7 +564,7 @@ else
|
||||
$accountstatic=new Account($db);
|
||||
$accountstatic->fetch($object->account_id);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='';
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
@ -92,10 +92,12 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
$max=10;
|
||||
|
||||
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref";
|
||||
$sql.= ", bc.statut, bc.nbcheque";
|
||||
$sql.= ", ba.label, ba.rowid as bid";
|
||||
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
|
||||
$sql.= " bc.statut, bc.nbcheque,";
|
||||
$sql.= " ba.ref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.accountancy_journal,";
|
||||
$sql.= " aj.code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
|
||||
$sql.= " WHERE ba.rowid = bc.fk_bank_account";
|
||||
$sql.= " AND bc.entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC";
|
||||
@ -122,8 +124,13 @@ if ($resql)
|
||||
$checkdepositstatic->statut=$objp->statut;
|
||||
|
||||
$accountstatic->id=$objp->bid;
|
||||
$accountstatic->ref=$objp->ref;
|
||||
$accountstatic->label=$objp->label;
|
||||
|
||||
$accountstatic->number=$objp->number;
|
||||
$accountstatic->currency_code=$objp->currency_code;
|
||||
$accountstatic->account_number=$objp->account_number;
|
||||
$accountstatic->accountancy_journal=$objp->code;
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
||||
print '<td>'.$checkdepositstatic->getNomUrl(1).'</td>';
|
||||
|
||||
@ -699,7 +699,8 @@ class FormFile
|
||||
$out.= '<!-- html.formfile::showdocuments -->'."\n";
|
||||
|
||||
// Show title of array if not already shown
|
||||
if ((! empty($file_list) || ! empty($link_list) || preg_match('/^massfilesarea/', $modulepart)) && ! $headershown)
|
||||
if ((! empty($file_list) || ! empty($link_list) || preg_match('/^massfilesarea/', $modulepart))
|
||||
&& ! $headershown)
|
||||
{
|
||||
$headershown=1;
|
||||
$out.= '<div class="titre">'.$titletoshow.'</div>'."\n";
|
||||
|
||||
@ -72,7 +72,7 @@
|
||||
<td>Fondation d'entreprise</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tdtop"><INPUT type="checkbox" checked="checked"></td>
|
||||
<td class="tdtop"><INPUT type="checkbox"></td>
|
||||
<td>Oeuvre ou organisme d'intérêt général</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Benoit Bruchard <benoitb21@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -89,7 +89,7 @@ class html_cerfafr extends ModeleDon
|
||||
$outputlangs->load("donations");
|
||||
|
||||
$currency = !empty($currency) ? $currency : $conf->currency;
|
||||
|
||||
|
||||
if (! empty($conf->don->dir_output))
|
||||
{
|
||||
// Definition of the object don (for upward compatibility)
|
||||
@ -134,21 +134,21 @@ class html_cerfafr extends ModeleDon
|
||||
$paymentmode = $formclass->cache_types_paiements[$don->modepaiementid]['label'];
|
||||
}
|
||||
else $paymentmode = '';
|
||||
|
||||
if ($don->modepaiementid==7){
|
||||
|
||||
if ($don->modepaymentcode=='CHQ'){
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
}
|
||||
else if ($don->modepaiementid==4){
|
||||
else if ($don->modepaymentcode=='LIQ'){
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox" checked="checked"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
}
|
||||
else if ($don->modepaiementid==2 || $don->modepaiementid==3 || $don->modepaiementid==6){
|
||||
else if ($don->modepaymentcode=='VIR' || $don->modepaymentcode=='PRE' || $don->modepaymentcode=='CB'){
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox" checked="checked"> Virement, prélèvement, carte bancaire</td>';
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if (empty($don->societe))
|
||||
{
|
||||
@ -159,14 +159,14 @@ class html_cerfafr extends ModeleDon
|
||||
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" checked="checked" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 885-0 V bis A du CGI</td>';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Define contents
|
||||
$donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html";
|
||||
$form = implode('', file($donmodel));
|
||||
$form = str_replace('__REF__',$don->id,$form);
|
||||
$form = str_replace('__DATE__',dol_print_date($don->date,'day',false,$outputlangs),$form);
|
||||
//$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist
|
||||
$form = str_replace('__AMOUNT__',$don->amount,$form);
|
||||
$form = str_replace('__AMOUNT__', price($don->amount), $form);
|
||||
$form = str_replace('__AMOUNTLETTERS__',chiffre_en_lettre($don->amount),$form);
|
||||
$form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form);
|
||||
$form = str_replace('__CURRENCYCODE__',$conf->currency,$form);
|
||||
@ -183,7 +183,6 @@ class html_cerfafr extends ModeleDon
|
||||
$form = str_replace('__DONATOR_ZIP__',$don->zip,$form);
|
||||
$form = str_replace('__DONATOR_TOWN__',$don->town,$form);
|
||||
$form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode,$form);
|
||||
$form = str_replace('__ModePaiement__', $ModePaiement,$form);
|
||||
$form = str_replace('__NOW__',dol_print_date($now,'day',false,$outputlangs),$form);
|
||||
$form = str_replace('__DonationRef__',$outputlangs->trans("DonationRef"),$form);
|
||||
$form = str_replace('__DonationTitle__',$outputlangs->trans("DonationTitle"),$form);
|
||||
@ -204,6 +203,8 @@ class html_cerfafr extends ModeleDon
|
||||
$form = str_replace('__IConfirmDonationReception__',$outputlangs->trans("IConfirmDonationReception"),$form);
|
||||
$form = str_replace('__DonationMessage__',$conf->global->DONATION_MESSAGE,$form);
|
||||
|
||||
$form = str_replace('__ModePaiement__', $ModePaiement,$form);
|
||||
|
||||
$frencharticle='';
|
||||
if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencharticle='<font size="+1">Article 200, 238 bis et 885-0 V bis A du code général des impôts (CGI)</font>';
|
||||
$form = str_replace('__FrenchArticle__',$frencharticle,$form);
|
||||
@ -260,7 +261,7 @@ class html_cerfafr extends ModeleDon
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -394,34 +395,34 @@ function chiffre_en_lettre($montant, $devise1='', $devise2='')
|
||||
if($cent[$i]==1) $trio[$i]='cent';
|
||||
else if($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' cents';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix');
|
||||
$secon_c=$chif2[$dix_c];
|
||||
if($cent_c==1) $trio_c='cent';
|
||||
else if($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents';
|
||||
|
||||
|
||||
if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1))
|
||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' million ';
|
||||
else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!=''))
|
||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions ';
|
||||
else
|
||||
$somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
|
||||
|
||||
|
||||
if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
|
||||
$somme = $somme.' mille ';
|
||||
else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!=''))
|
||||
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles ';
|
||||
else
|
||||
$somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
|
||||
|
||||
|
||||
$somme = $somme. $trio[1]. ' ' .$secon[1]. ' ' . $prim[1];
|
||||
|
||||
|
||||
$somme = $somme. ' '. $dev1 .' ' ;
|
||||
|
||||
|
||||
if(($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c==''))
|
||||
return $somme. ' et zéro '. $dev2;
|
||||
else
|
||||
return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ print load_fiche_titre($langs->trans("DonationsSetup"),$linkback,'title_setup');
|
||||
|
||||
$head = donation_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Donations"), 0, 'payment');
|
||||
dol_fiche_head($head, 'general', $langs->trans("Donations"), -1, 'payment');
|
||||
|
||||
|
||||
// Document templates
|
||||
|
||||
@ -67,7 +67,7 @@ print load_fiche_titre($langs->trans("DonationsSetup"),$linkback,'title_setup');
|
||||
|
||||
$head = donation_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'attributes', $langs->trans("Donations"), 0, 'payment');
|
||||
dol_fiche_head($head, 'attributes', $langs->trans("Donations"), -1, 'payment');
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
|
||||
@ -98,20 +98,21 @@ if ($action == 'update')
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
$object->firstname = GETPOST("firstname");
|
||||
$object->lastname = GETPOST("lastname");
|
||||
$object->societe = GETPOST("societe");
|
||||
$object->address = GETPOST("address");
|
||||
$object->amount = price2num(GETPOST("amount"));
|
||||
$object->town = GETPOST("town");
|
||||
$object->zip = GETPOST("zipcode");
|
||||
$object->firstname = GETPOST("firstname",'alpha');
|
||||
$object->lastname = GETPOST("lastname",'alpha');
|
||||
$object->societe = GETPOST("societe",'alpha');
|
||||
$object->address = GETPOST("address",'alpha');
|
||||
$object->amount = price2num(GETPOST("amount",'alpha'));
|
||||
$object->town = GETPOST("town",'alpha');
|
||||
$object->zip = GETPOST("zipcode",'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->email = GETPOST("email");
|
||||
$object->email = GETPOST("email",'alpha');
|
||||
$object->date = $donation_date;
|
||||
$object->public = GETPOST("public");
|
||||
$object->fk_project = GETPOST("fk_project");
|
||||
$object->note_private= GETPOST("note_private");
|
||||
$object->note_public = GETPOST("note_public");
|
||||
$object->public = GETPOST("public",'alpha');
|
||||
$object->fk_project = GETPOST("fk_project",'alpha');
|
||||
$object->note_private= GETPOST("note_private",'none');
|
||||
$object->note_public = GETPOST("note_public",'none');
|
||||
$object->modepaymentid = GETPOST('modepayment','int');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
@ -151,20 +152,21 @@ if ($action == 'add')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->firstname = GETPOST("firstname");
|
||||
$object->lastname = GETPOST("lastname");
|
||||
$object->societe = GETPOST("societe");
|
||||
$object->address = GETPOST("address");
|
||||
$object->amount = price2num(GETPOST("amount"));
|
||||
$object->zip = GETPOST("zipcode");
|
||||
$object->town = GETPOST("town");
|
||||
$object->firstname = GETPOST("firstname",'alpha');
|
||||
$object->lastname = GETPOST("lastname",'alpha');
|
||||
$object->societe = GETPOST("societe",'alpha');
|
||||
$object->address = GETPOST("address",'alpha');
|
||||
$object->amount = price2num(GETPOST("amount",'alpha'));
|
||||
$object->zip = GETPOST("zipcode",'alpha');
|
||||
$object->town = GETPOST("town",'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->email = GETPOST("email");
|
||||
$object->email = GETPOST("email",'alpha');
|
||||
$object->date = $donation_date;
|
||||
$object->note_private= GETPOST("note_private");
|
||||
$object->note_public = GETPOST("note_public");
|
||||
$object->public = GETPOST("public");
|
||||
$object->fk_project = GETPOST("fk_project");
|
||||
$object->note_private= GETPOST("note_private",'none');
|
||||
$object->note_public = GETPOST("note_public",'none');
|
||||
$object->public = GETPOST("public",'alpha');
|
||||
$object->fk_project = GETPOST("fk_project",'alpha');
|
||||
$object->modepaymentid = GETPOST('modepayment','int');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
@ -348,6 +350,12 @@ if ($action == 'create')
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
|
||||
|
||||
// Payment mode
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
$selected = GETPOST('modepayment','int');
|
||||
$form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
|
||||
@ -480,14 +488,14 @@ if (! empty($id) && $action == 'edit')
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
|
||||
|
||||
// Payment mode
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
|
||||
if ($object->modepaymentid) $selected = $object->modepaymentid;
|
||||
else $selected = '';
|
||||
|
||||
$form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Status
|
||||
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Project
|
||||
@ -764,7 +772,7 @@ if (! empty($id) && $action != 'edit')
|
||||
$filename = dol_sanitizeFileName($object->id);
|
||||
$filedir = $conf->don->dir_output . "/" . dol_sanitizeFileName($object->id);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?rowid='.$object->id;
|
||||
$genallowed = ($object->statut == 2 && ($object->paid == 0 || $user->admin) && $user->rights->don->lire);
|
||||
$genallowed = (($object->paid == 0 || $user->admin) && $user->rights->don->lire);
|
||||
$delallowed = $user->rights->don->creer;
|
||||
|
||||
print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
|
||||
|
||||
@ -69,7 +69,7 @@ class Don extends CommonObject
|
||||
global $langs;
|
||||
|
||||
$this->db = $db;
|
||||
$this->modepaiementid = 0;
|
||||
$this->modepaymentid = 0;
|
||||
|
||||
$langs->load("donations");
|
||||
$this->labelstatut[-1]=$langs->trans("Canceled");
|
||||
@ -338,7 +338,6 @@ class Don extends CommonObject
|
||||
$sql.= ", address";
|
||||
$sql.= ", zip";
|
||||
$sql.= ", town";
|
||||
// $sql.= ", country"; -- Deprecated
|
||||
$sql.= ", fk_country";
|
||||
$sql.= ", public";
|
||||
$sql.= ", fk_projet";
|
||||
@ -354,7 +353,7 @@ class Don extends CommonObject
|
||||
$sql.= " '".$this->db->idate($now)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".price2num($this->amount);
|
||||
$sql.= ", ".($this->modepaiementid?$this->modepaiementid:"null");
|
||||
$sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null");
|
||||
$sql.= ", '".$this->db->escape($this->firstname)."'";
|
||||
$sql.= ", '".$this->db->escape($this->lastname)."'";
|
||||
$sql.= ", '".$this->db->escape($this->societe)."'";
|
||||
@ -605,9 +604,10 @@ class Don extends CommonObject
|
||||
|
||||
$sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,";
|
||||
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
||||
$sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
|
||||
$sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, ";
|
||||
$sql.= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
|
||||
$sql.= " p.ref as project_ref,";
|
||||
$sql.= " cp.libelle as payment_label, cp.code as payment_code,";
|
||||
$sql.= " c.code as country_code, c.label as country";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet";
|
||||
@ -657,7 +657,8 @@ class Don extends CommonObject
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->public = $obj->public;
|
||||
$this->modepaymentid = $obj->fk_payment;
|
||||
$this->modepayment = $obj->libelle;
|
||||
$this->modepaymentcode = $obj->payment_code;
|
||||
$this->modepayment = $obj->payment_label;
|
||||
$this->paid = $obj->paid;
|
||||
$this->amount = $obj->amount;
|
||||
$this->note_private = $obj->note_private;
|
||||
|
||||
@ -29,7 +29,7 @@ create table llx_don
|
||||
fk_statut smallint NOT NULL DEFAULT 0, -- Status of donation promise or validate
|
||||
datedon datetime, -- Date of the donation/promise
|
||||
amount double(24,8) DEFAULT 0,
|
||||
fk_payment integer,
|
||||
fk_payment integer, -- Id of payment mode
|
||||
paid smallint default 0 NOT NULL,
|
||||
firstname varchar(50),
|
||||
lastname varchar(50),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user