From ac95ccd87230866f5124c179ae78eb1d1d455a10 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 10 Dec 2017 14:05:36 +0100 Subject: [PATCH] FIX : Debug various_payment --- htdocs/accountancy/bookkeeping/list.php | 18 +++- .../bank/class/paymentvarious.class.php | 41 +++++---- htdocs/compta/bank/various_payment/card.php | 12 +-- .../compta/bank/various_payment/document.php | 91 +++++++++++++------ htdocs/compta/bank/various_payment/index.php | 14 +-- htdocs/compta/bank/various_payment/info.php | 17 ++-- 6 files changed, 118 insertions(+), 75 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 2cc006db4e1..9469ef39ffb 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -160,6 +160,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_date_creation_end = ''; $search_date_modification_start = ''; $search_date_modification_end = ''; + $search_debit = ''; + $search_credit = ''; } // Must be after the remove filter action, before the export. @@ -248,6 +250,14 @@ if (! empty($search_date_modification_end)) { $tmp=dol_getdate($search_date_modification_end); $param .= '&date_modification_endmonth=' . $tmp['mon'] . '&date_modification_endday=' . $tmp['mday'] . '&date_modification_endyear=' . $tmp['year']; } +if (! empty($search_debit)) { + $filter['t.debit'] = $search_debit; + $param .= '&search_debit=' . $search_debit; +} +if (! empty($search_credit)) { + $filter['t.credit'] = $search_credit; + $param .= '&search_credit=' . $search_credit; +} if ($action == 'delbookkeeping') { @@ -507,12 +517,16 @@ if (! empty($arrayfields['t.label_operation']['checked'])) // Debit if (! empty($arrayfields['t.debit']['checked'])) { - print ' '; + print ''; + print ''; + print ''; } // Credit if (! empty($arrayfields['t.credit']['checked'])) { - print ' '; + print ''; + print ''; + print ''; } // Code journal if (! empty($arrayfields['t.code_journal']['checked'])) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 6504c519358..5922b3f5aa7 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * * 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 @@ -266,12 +266,12 @@ class PaymentVarious extends CommonObject $this->fk_user_modif=''; } - /** - * Create in database - * - * @param User $user User that create - * @return int <0 if KO, >0 if OK - */ + /** + * Create in database + * + * @param User $user User that create + * @return int <0 if KO, >0 if OK + */ function create($user) { global $conf,$langs; @@ -338,6 +338,7 @@ class PaymentVarious extends CommonObject if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'"; $sql.= ", '".$this->db->escape($this->label)."'"; $sql.= ", '".$this->db->escape($this->accountancy_code)."'"; + $sql.= ", ".($this->fk_project > 0? $this->fk_project : 0); $sql.= ", ".$user->id; $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", NULL"; @@ -407,10 +408,10 @@ class PaymentVarious extends CommonObject } } - // Call trigger - $result=$this->call_trigger('PAYMENT_VARIOUS_CREATE',$user); - if ($result < 0) $error++; - // End call triggers + // Call trigger + $result=$this->call_trigger('PAYMENT_VARIOUS_CREATE',$user); + if ($result < 0) $error++; + // End call triggers } else $error++; @@ -437,8 +438,8 @@ class PaymentVarious extends CommonObject /** * Update link between payment various and line generate into llx_bank * - * @param int $id_bank Id bank account - * @return int <0 if KO, >0 if OK + * @param int $id_bank Id bank account + * @return int <0 if KO, >0 if OK */ function update_fk_bank($id_bank) { @@ -517,18 +518,18 @@ class PaymentVarious extends CommonObject /** * Send name clicable (with possibly the picto) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option link option - * @return string Chaine with URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param string $option link option + * @return string Chaine with URL */ function getNomUrl($withpicto=0,$option='') { global $langs; $result=''; - $label=$langs->trans("ShowVariousPayment").': '.$this->ref; + $label=$langs->trans("ShowVariousPayment").': '.$this->ref; - $linkstart = ''; + $linkstart = ''; $linkend=''; $result .= $linkstart; @@ -542,8 +543,8 @@ class PaymentVarious extends CommonObject /** * Information on record * - * @param int $id Id of record - * @return void + * @param int $id Id of record + * @return void */ function info($id) { diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 4c57ab5f324..32426a312f4 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * * 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 @@ -16,9 +16,9 @@ */ /** - * \file htdocs/compta/bank/various_expenses/card.php - * \ingroup bank - * \brief Page of various expenses + * \file htdocs/compta/bank/various_expenses/card.php + * \ingroup bank + * \brief Page of various expenses */ require '../../../main.inc.php'; @@ -40,8 +40,8 @@ $langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); // Get parameters $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); -$cancel = GETPOST('cancel', 'aZ09'); -$backtopage = GETPOST('backtopage', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); $accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0; $label=GETPOST("label","alpha"); diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 8ae83f9c550..ff304676686 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * * 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 @@ -17,9 +17,9 @@ */ /** - * \file htdocs/compta/bank/various_payment/document.php - * \ingroup banque - * \brief Page of linked files onto various_payment + * \file htdocs/compta/bank/various_payment/document.php + * \ingroup bank + * \brief Page of linked files onto various payment */ require '../../../main.inc.php'; @@ -28,9 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; -$langs->load("other"); -$langs->load("bank"); -$langs->load("companies"); +$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); $id = GETPOST('id','int'); $ref = GETPOST('ref', 'alpha'); @@ -38,9 +36,9 @@ $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); // Security check +$socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'salaries', $id, ''); - +$result = restrictedArea($user, 'banque', '', '', ''); // Get parameters $sortfield = GETPOST('sortfield','alpha'); @@ -74,8 +72,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; $form = new Form($db); -llxHeader("",$langs->trans("VariousPayment")); - +$title = $langs->trans("VariousPayment") . ' - ' . $langs->trans("Documents"); +$help_url = ''; +llxHeader("",$title,$help_url); if ($object->id) { @@ -83,6 +82,46 @@ if ($object->id) dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), 0, 'payment'); + $morehtmlref='
'; + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.=$langs->trans('Project') . ' '; + if ($user->rights->tax->charges->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); @@ -92,30 +131,22 @@ if ($object->id) $totalsize+=$file['size']; } + print ''; - print '
'; + print ''; + print ''; + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - $linkback = ''.$langs->trans("BackToList").''; + print '
'; - // Ref - print ''.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); - print ''; + print '
'; - // Societe - //print "".$langs->trans("Company")."".$object->client->getNomUrl(1).""; - - print ''.$langs->trans("NbOfAttachedFiles").''.count($filearray).''; - print ''.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").''; - print ''; - - print ''; - - $modulepart = 'banque'; - $permission = $user->rights->banque->modifier; - $param = '&id=' . $object->id; - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; + dol_fiche_end(); + $modulepart = 'banque'; + $permission = $user->rights->banque->modifier; + $param = '&id=' . $object->id; + include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 8550c0b50ef..6ebcb5fa109 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/compta/bank/various_payment/index.php - * \ingroup bank - * \brief List of various payments + * \file htdocs/compta/bank/various_payment/index.php + * \ingroup bank + * \brief List of various payments */ require '../../../main.inc.php'; @@ -92,7 +92,7 @@ $form = new Form($db); $variousstatic = new PaymentVarious($db); $accountstatic = new Account($db); -$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,"; +$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v"; @@ -102,9 +102,9 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria -if ($search_ref) $sql.=" AND v.rowid=".$search_ref; -if ($search_label) $sql.=natural_search(array('v.label'), $search_label); -if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); +if ($search_ref) $sql.=" AND v.rowid=".$search_ref; +if ($search_label) $sql.=natural_search(array('v.label'), $search_label); +if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($filtre) { diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index cda6b4ce137..f6c7dc063f7 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * * 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 @@ -16,9 +16,9 @@ */ /** - * \file htdocs/compta/bank/various_payment/info.php - * \ingroup salaries - * \brief Page with info about salaries contribution + * \file htdocs/compta/bank/various_payment/info.php + * \ingroup bank + * \brief Page with info about various payment */ require '../../../main.inc.php'; @@ -26,18 +26,15 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -$langs->load("compta"); -$langs->load("bills"); -$langs->load("salaries"); +$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); $id=GETPOST('id','int'); $action=GETPOST('action','aZ09'); // Security check -$socid = GETPOST('socid','int'); +$socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'salaries', '', '', ''); - +$result = restrictedArea($user, 'banque', '', '', ''); /* * View