From f08c91fcc6c7c603b05c1ff6b7b4a17270d4635d Mon Sep 17 00:00:00 2001 From: bahfir abbes Date: Wed, 9 Sep 2020 09:14:02 +0100 Subject: [PATCH 01/12] fix: replace values of __YEAR__, __MONTH__ and __DAY__ in member docs --- htdocs/core/modules/member/doc/pdf_standard.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 0051862d52e..bcab63940c0 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -267,9 +267,9 @@ class pdf_standard extends CommonStickerGenerator '__EMAIL__'=>$object->email, '__BIRTH__'=>dol_print_date($object->birth, 'day'), '__TYPE__'=>$object->type, - '__YEAR__'=>$year, - '__MONTH__'=>$month, - '__DAY__'=>$day, + '__YEAR__'=>date('Y', dol_now()), + '__MONTH__'=>date('m', dol_now()), + '__DAY__'=>date('d', dol_now()), '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, '__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/" ); From 870443a09980f8be3e75edf76951c8594c093ebb Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Wed, 9 Sep 2020 11:34:47 +0200 Subject: [PATCH 02/12] Add selectable columns for extra payments --- htdocs/compta/bank/various_payment/list.php | 371 ++++++++++++++------ 1 file changed, 257 insertions(+), 114 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 09193b3ee91..9cda90f02b7 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Tobias Sekan * * 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 @@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array("compta", "banks", "bills", "accountancy")); @@ -44,11 +46,14 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_datep_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_datep_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_datev_start = dol_mktime(0, 0, 0, GETPOST('search_date_value_startmonth', 'int'), GETPOST('search_date_value_startday', 'int'), GETPOST('search_date_value_startyear', 'int')); +$search_datev_end = dol_mktime(23, 59, 59, GETPOST('search_date_value_endmonth', 'int'), GETPOST('search_date_value_endday', 'int'), GETPOST('search_date_value_endyear', 'int')); $search_amount_deb = GETPOST('search_amount_deb', 'alpha'); $search_amount_cred = GETPOST('search_amount_cred', 'alpha'); -$search_account = GETPOST('search_account', 'int'); +$search_bank_account = GETPOST('search_account', 'int'); +$search_bank_entry = GETPOST('search_bank_entry', 'int'); $search_accountancy_account = GETPOST("search_accountancy_account"); if ($search_accountancy_account == - 1) $search_accountancy_account = ''; $search_accountancy_subledger = GETPOST("search_accountancy_subledger"); @@ -81,18 +86,51 @@ if (!GETPOST('typeid')) if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers { - $search_ref = ""; - $search_label = ""; - $search_date_start = ''; - $search_date_end = ''; - $search_amount_deb = ""; - $search_amount_cred = ""; - $search_account = ''; + $search_ref = ''; + $search_label = ''; + $search_datep_start = ''; + $search_datep_end = ''; + $search_datev_start = ''; + $search_datev_end = ''; + $search_amount_deb = ''; + $search_amount_cred = ''; + $search_bank_account = ''; + $search_bank_entry = ''; $search_accountancy_account = ''; $search_accountancy_subledger = ''; - $typeid = ""; + $typeid = ''; } +// Definition of fields for lists +$arrayfields = array( + 'ref' =>array('label'=>"Ref", 'checked'=>1, 'position'=>100), + 'label' =>array('label'=>"Label", 'checked'=>1, 'position'=>110), + 'datep' =>array('label'=>"DatePayment", 'checked'=>1, 'position'=>120), + 'datev' =>array('label'=>"DateValue", 'checked'=>1, 'position'=>130), + 'type' =>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>140), + 'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>!empty($conf->projet->enabled)), + 'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>!empty($conf->banque->enabled)), + 'entry' =>array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>310, "enabled"=>!empty($conf->banque->enabled)), + 'account' =>array('label'=>"AccountAccountingShort", 'checked'=>1, 'position'=>400, "enabled"=>!empty($conf->accounting->enabled)), + 'subledger' =>array('label'=>"SubledgerAccount", 'checked'=>1, 'position'=>410, "enabled"=>!empty($conf->accounting->enabled)), + 'debit' =>array('label'=>"Debit", 'checked'=>1, 'position'=>500), + 'credit' =>array('label'=>"Credit", 'checked'=>1, 'position'=>510), +); + +$arrayfields = dol_sort_array($arrayfields, 'position'); + +/* + * Actions + */ + +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; +} /* * View @@ -101,11 +139,15 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' llxHeader(); $form = new Form($db); -$formaccounting = new FormAccounting($db); -$variousstatic = new PaymentVarious($db); -$accountstatic = new Account($db); +if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) $formaccounting = new FormAccounting($db); +if ($arrayfields['bank']['checked'] && !empty($conf->accounting->enabled)) $accountingjournal = new AccountingJournal($db); +if ($arrayfields['ref']['checked']) $variousstatic = new PaymentVarious($db); +if ($arrayfields['bank']['checked']) $accountstatic = new Account($db); +if ($arrayfields['project']['checked']) $proj = new Project($db); +if ($arrayfields['entry']['checked']) $bankline = new AccountLine($db); +if ($arrayfields['account']['checked']) $accountingaccount = new AccountingAccount($db); -$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, v.subledger_account,"; +$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, v.subledger_account, v.fk_projet as fk_project,"; $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"; @@ -117,11 +159,14 @@ $sql .= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref); if ($search_label) $sql .= natural_search(array('v.label'), $search_label); -if ($search_date_start) $sql .= " AND v.datep >= '".$db->idate($search_date_start)."'"; -if ($search_date_end) $sql .= " AND v.datep <= '".$db->idate($search_date_end)."'"; +if ($search_datep_start) $sql .= " AND v.datep >= '".$db->idate($search_datep_start)."'"; +if ($search_datep_end) $sql .= " AND v.datep <= '".$db->idate($search_datep_end)."'"; +if ($search_datev_start) $sql .= " AND v.datev >= '".$db->idate($search_datev_start)."'"; +if ($search_datev_end) $sql .= " AND v.datev <= '".$db->idate($search_datev_end)."'"; 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=".$db->escape($search_account); +if ($search_bank_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_bank_account); +if ($search_bank_entry > 0) $sql .= " AND b.fk_account=".$db->escape($search_bank_account); if ($search_accountancy_account > 0) $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account); if ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger); if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; @@ -154,10 +199,10 @@ if ($result) if ($search_label) $param .= '&search_label='.urlencode($search_label); if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); - if ($typeid > 0) $param .= '&typeid='.urlencode($typeid); - if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb); - if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred); - if ($search_account > 0) $param .= '&search_amount='.urlencode($search_account); + if ($typeid > 0) $param .= '&typeid='.urlencode($typeid); + if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb); + if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred); + if ($search_bank_account > 0) $param .= '&search_amount='.urlencode($search_bank_account); if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); @@ -170,66 +215,111 @@ if ($result) } print '
'; - + if ($optioncss != '') print ''; print ''; print ''; print ''; print ''; print ''; - + print ''; + print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + print '
'; - print ''."\n"; + print '
'; print ''; - // Ref - print ''; - - // Label - print ''; - - // Date - print ''; - - // Type - print ''; - - // Account - if (!empty($conf->banque->enabled)) - { + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; } + // Ref + if ($arrayfields['ref']['checked']) { + print ''; + } + + // Label + if ($arrayfields['label']['checked']) { + print ''; + } + + // Payment date + if ($arrayfields['datep']['checked']) { + print ''; + } + + // Value date + if ($arrayfields['datev']['checked']) { + print ''; + } + + // Payment type + if ($arrayfields['type']['checked']) { + print ''; + } + + // Project + if ($arrayfields['project']['checked']) { + print ''; + } + + // Bank account + if ($arrayfields['bank']['checked']) { + print ''; + } + + // Bank entry + if ($arrayfields['entry']['checked']) { + print ''; + } + // Accounting account - if (!empty($conf->accounting->enabled)) - { - // Accounting account + if ($arrayfields['account']['checked']) { print ''; + } - // Subledger account + // Subledger account + if ($arrayfields['subledger']['checked']) { print ''; + if ($arrayfields['debit']['checked']) { + print ''; + } // Credit - print ''; + if ($arrayfields['credit']['checked']) { + print ''; + } print ''; - print "\n"; - + print ''; print ''; - print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left '); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); - if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); - if (!empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left '); - print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); - print "\n"; + + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); + + if ($arrayfields['ref']['checked']) print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], 'v.rowid', '', $param, '', $sortfield, $sortorder); + if ($arrayfields['label']['checked']) print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder, 'left '); + if ($arrayfields['datep']['checked']) print_liste_field_titre($arrayfields['datep']['label'], $_SERVER["PHP_SELF"], 'v.datep,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); + if ($arrayfields['datev']['checked']) print_liste_field_titre($arrayfields['datev']['label'], $_SERVER["PHP_SELF"], 'v.datev,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); + if ($arrayfields['type']['checked']) print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'left '); + if ($arrayfields['project']['checked']) print_liste_field_titre($arrayfields['project']['label'], $_SERVER["PHP_SELF"], 'fk_project', '', $param, '', $sortfield, $sortorder); + if ($arrayfields['bank']['checked']) print_liste_field_titre($arrayfields['bank']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); + if ($arrayfields['entry']['checked']) print_liste_field_titre($arrayfields['entry']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); + if ($arrayfields['account']['checked']) print_liste_field_titre($arrayfields['account']['label'], $_SERVER["PHP_SELF"], 'v.accountancy_code', '', $param, '', $sortfield, $sortorder, 'left '); + if ($arrayfields['subledger']['checked']) print_liste_field_titre($arrayfields['subledger']['label'], $_SERVER["PHP_SELF"], 'v.subledger_account', '', $param, '', $sortfield, $sortorder, 'left '); + if ($arrayfields['debit']['checked']) print_liste_field_titre($arrayfields['debit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); + if ($arrayfields['credit']['checked']) print_liste_field_titre($arrayfields['credit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); + + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); + print ''; $totalarray = array(); @@ -272,28 +381,53 @@ if ($result) print ''; - $variousstatic->id = $obj->rowid; - $variousstatic->ref = $obj->rowid; - + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''; + } + // Ref - print "\n"; - if (!$i) $totalarray['nbfield']++; + if ($arrayfields['ref']['checked']) { + $variousstatic->id = $obj->rowid; + $variousstatic->ref = $obj->rowid; + print ""; + if (!$i) $totalarray['nbfield']++; + } // Label payment - print "\n"; - if (!$i) $totalarray['nbfield']++; + if ($arrayfields['label']['checked']) { + print ""; + if (!$i) $totalarray['nbfield']++; + } // Date payment - print '\n"; - if (!$i) $totalarray['nbfield']++; + if ($arrayfields['datep']['checked']) { + print '"; + if (!$i) $totalarray['nbfield']++; + } + + + // Date value + if ($arrayfields['datev']['checked']) { + print '"; + if (!$i) $totalarray['nbfield']++; + } // Type - print ''; - if (!$i) $totalarray['nbfield']++; + if ($arrayfields['type']['checked']) { + print ''; + if (!$i) $totalarray['nbfield']++; + } - // Account - if (!empty($conf->banque->enabled)) - { + // Project + if ($arrayfields['project']['checked']) { + $proj->fetch($obj->fk_project); + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Bank account + if ($arrayfields['bank']['checked']) { print ''; - if (!$i) $totalarray['nbfield']++; + } else { + print ' '; + print ''; + if (!$i) $totalarray['nbfield']++; + } + } + + // Bank entry + if ($arrayfields['entry']['checked']) { + $bankline->fetch($obj->fk_bank); + print ''; } // Accounting account - if (!empty($conf->accounting->enabled)) { - $accountingaccount = new AccountingAccount($db); + if ($arrayfields['account']['checked']) { $accountingaccount->fetch('', $obj->accountancy_code, 1); print ''; @@ -326,38 +465,42 @@ if ($result) } // Accounting subledger account - if (!empty($conf->accounting->enabled)) - { + if ($arrayfields['subledger']['checked']) { print ''; if (!$i) $totalarray['nbfield']++; } // Debit - print ''; } - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; - print ''; // Credit - print ''; } - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; - print ''; + print ''; if (!$i) $totalarray['nbfield']++; - print "\n"; + print ""; $i++; } From 32d77cc143acf81463d77b4c95040066ac60096d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 9 Sep 2020 09:46:46 +0000 Subject: [PATCH 03/12] Fixing style errors. --- htdocs/compta/bank/various_payment/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 9cda90f02b7..67e39b069ab 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -215,7 +215,7 @@ if ($result) } print ''; - + if ($optioncss != '') print ''; print ''; print ''; @@ -223,7 +223,7 @@ if ($result) print ''; print ''; print ''; - + print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; @@ -292,21 +292,21 @@ if ($result) if ($arrayfields['project']['checked']) { print ''; + print ''; } // Bank account if ($arrayfields['bank']['checked']) { print ''; + print ''; } // Bank entry if ($arrayfields['entry']['checked']) { print ''; + print ''; } // Accounting account @@ -385,7 +385,7 @@ if ($result) if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; } - + // Ref if ($arrayfields['ref']['checked']) { $variousstatic->id = $obj->rowid; @@ -406,7 +406,7 @@ if ($result) if (!$i) $totalarray['nbfield']++; } - + // Date value if ($arrayfields['datev']['checked']) { print '"; From 059624e9366f0832f25ec73496d426617bf4263a Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 9 Sep 2020 11:46:56 +0200 Subject: [PATCH 04/12] NEW edit and update a ticket --- htdocs/ticket/card.php | 132 ++++++++++++++++++++++++++++++----------- 1 file changed, 96 insertions(+), 36 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 6c7a1278c99..0cb1673fa81 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -268,53 +268,55 @@ if (empty($reshook)) { } } - if ($action == 'edit' && $user->rights->ticket->write) { + if ($action == 'update' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) { $error = 0; - if ($object->fetch(GETPOST('id', 'int')) < 0) { - $error++; - array_push($object->errors, $langs->trans("ErrorTicketIsNotValid")); - $_GET["action"] = $_POST["action"] = ''; - } - } - - if (GETPOST('update', 'alpha') && GETPOST('id', 'int') && $user->rights->ticket->write) { - $error = 0; - - $ret = $object->fetch(GETPOST('id', 'int')); + $ret = $object->fetch(GETPOST('id', 'int'), GETPOST('ref', 'alpha'), GETPOST('track_id', 'alpha')); if ($ret < 0) { $error++; - array_push($object->errors, $langs->trans("ErrorTicketIsNotValid")); - $action = ''; - } elseif (!GETPOST("label")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"))); - $action = 'edit'; - } elseif (!GETPOST("subject", 'alphanohtml')) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); - $action = 'edit'; + array_push($object->errors, $langs->trans('ErrorTicketIsNotValid')); + } + + // check fields + if (!$error) { + if (!GETPOST('subject' , 'alpha')) { + $error++; + array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Subject'))); + } + $ret = $extrafields->setOptionalsFromPost(null, $object); + if ($ret < 0) $error++; } if (!$error) { $db->begin(); - $object->label = GETPOST("label", 'alphanohtml'); - $object->description = GETPOST("description", 'restricthtml'); + $object->subject = GETPOST('subject', 'alpha'); + $object->type_code = GETPOST('type_code', 'alpha'); + $object->category_code = GETPOST('category_code', 'alpha'); + $object->severity_code = GETPOST('severity_code', 'alpha'); - //... $ret = $object->update($user); - if ($ret <= 0) { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'edit'; + if ($ret <= 0) $error++; + + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } + + if ($error) { + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'edit'; + } else { + if (!empty($backtopage)) { + $url = $backtopage; + } else { + $url = 'card.php?track_id=' . $object->track_id; } - if (!$error && $ret > 0) { - $db->commit(); - } else { - $db->rollback(); - } + header('Location: ' . $url); + exit(); } } @@ -650,9 +652,63 @@ if ($action == 'create' || $action == 'presend') } $formticket->showForm(1, 'create'); -} +} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) { + $formticket = new FormTicket($db); -if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' + $head = ticket_prepare_head($object); + + print ''; + print ''; + print ''; + print ''; + + dol_fiche_head($head, 'card', $langs->trans('ticket'), 0, 'ticket'); + + print '
'; + print '
'; - print ''; - print ''; - print '
'; - print $langs->trans('From').' '; - print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1); - print '
'; - print '
'; - print $langs->trans('to').' '; - print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1); - - print '
'; - print '
'; - $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16); - print ''; - $form->select_comptes($search_account, 'search_account', 0, '', 1); print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans('From').' '; + print $form->selectDate($search_datep_start ? $search_datep_start : -1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to').' '; + print $form->selectDate($search_datep_end ? $search_datep_end : -1, 'search_date_end', 0, 0, 1); + print '
'; + print '
'; + print '
'; + print $langs->trans('From').' '; + print $form->selectDate($search_datev_start ? $search_datev_start : -1, 'search_date_value_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to').' '; + print $form->selectDate($search_datev_end ? $search_datev_end : -1, 'search_date_value_end', 0, 0, 1); + print '
'; + print '
'; + $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16); + print ''; + // TODO + print ''; + $form->select_comptes($search_bank_account, 'search_account', 0, '', 1); + print ''; + print ''; + print ''; print '
'; print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200'); print '
'; print '
'; print '
'; print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200'); @@ -238,31 +328,50 @@ if ($result) } // Debit - print '
'; + print ''; + print ''; + print ''; + print ''; $searchpicto = $form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.(($offset * $limit) + $i).'".$variousstatic->getNomUrl(1)."".$variousstatic->getNomUrl(1)."".dol_trunc($obj->label, 40)."".dol_trunc($obj->label, 40)."'.dol_print_date($db->jdate($obj->datep), 'day')."'.dol_print_date($obj->datep, 'day')."'.dol_print_date($obj->datev, 'day')."'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''.$proj->getNomUrl(1).''; if ($obj->bid > 0) { @@ -303,22 +437,27 @@ if ($result) if (!empty($conf->accounting->enabled)) { $accountstatic->account_number = $obj->bank_account_number; - - $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($obj->accountancy_journal); $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); } $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } else print ' '; - print ''.$bankline->getNomUrl(1).''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''.length_accounta($obj->subledger_account).''; - if ($obj->sens == 0) - { - print price($obj->amount); - $totalarray['val']['total_deb'] += $obj->amount; + if ($arrayfields['debit']['checked']) { + print ''; + if ($obj->sens == 0) + { + print price($obj->amount); + $totalarray['val']['total_deb'] += $obj->amount; + } + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; + print ''; - if ($obj->sens == 1) - { - print price($obj->amount); - $totalarray['val']['total_cred'] += $obj->amount; + if ($arrayfields['credit']['checked']) { + print ''; + if ($obj->sens == 1) + { + print price($obj->amount); + $totalarray['val']['total_cred'] += $obj->amount; + } + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; + print '
'; // TODO - print ''; $form->select_comptes($search_bank_account, 'search_account', 0, '', 1); - print ''; print ''; - print ''.(($offset * $limit) + $i).''.dol_print_date($obj->datev, 'day')."
'; + + // Type + print ''; + + // Severity + print ''; + + // Group + print ''; + + // Subject + print ''; + + // Other attributes + $parameters = array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) { + print $object->showOptionals($extrafields, 'edit'); + } + + print '
'; + $formticket->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $object->type_code), 'type_code', '', '2'); + print '
'; + $formticket->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $object->severity_code), 'severity_code', '', '2'); + print '
'; + $formticket->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $object->category_code), 'category_code', '', '2'); + print '
'; + print ''; + print '
'; + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; +} +elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') { if ($res > 0) @@ -1193,6 +1249,10 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print ''; } + if ($user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) { + print ''; + } + // Close ticket if statut is read if ($object->fk_statut > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { print ''; From be2fa82396ec650572819981c23c50c8ec91e3bc Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 9 Sep 2020 11:54:50 +0200 Subject: [PATCH 05/12] FIX stickler error comma in argument list --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 0cb1673fa81..ba1edf1e11a 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -279,7 +279,7 @@ if (empty($reshook)) { // check fields if (!$error) { - if (!GETPOST('subject' , 'alpha')) { + if (!GETPOST('subject', 'alpha')) { $error++; array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Subject'))); } From 0c5bf5012e16da29dd4f722c7826d0a9289bb31f Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 9 Sep 2020 12:09:17 +0200 Subject: [PATCH 06/12] NEW Ticket title --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index ba1edf1e11a..ea27fc98f44 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -662,7 +662,7 @@ if ($action == 'create' || $action == 'presend') print ''; print ''; - dol_fiche_head($head, 'card', $langs->trans('ticket'), 0, 'ticket'); + dol_fiche_head($head, 'card', $langs->trans('Ticket'), 0, 'ticket'); print '
'; print ''; From 8fa001d98da9171669872e4ad6772c1289fae699 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Wed, 9 Sep 2020 13:27:41 +0200 Subject: [PATCH 07/12] Fix to short summary line --- htdocs/compta/bank/various_payment/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 9cda90f02b7..8918d7cdf5f 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -454,6 +454,7 @@ if ($result) if ($arrayfields['entry']['checked']) { $bankline->fetch($obj->fk_bank); print ''; + if (!$i) $totalarray['nbfield']++; } // Accounting account From 1d894f4b7c2caf767909ddc0250407d9f957fd1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Wed, 9 Sep 2020 13:38:42 +0200 Subject: [PATCH 08/12] FIX ref_ext for invoice lines from API Add and update ref_ext in invoice lines --- htdocs/compta/facture/class/api_invoices.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index c1ed5b809da..53603415d7f 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -415,7 +415,9 @@ class Invoices extends DolibarrApi $request_data->array_options, $request_data->situation_percent, $request_data->fk_unit, - $request_data->multicurrency_subprice + $request_data->multicurrency_subprice, + 0, + $request_data->ref_ext ); if ($updateRes > 0) { @@ -704,7 +706,9 @@ class Invoices extends DolibarrApi $request_data->array_options, $request_data->situation_percent, $request_data->fk_prev_id, - $request_data->fk_unit + $request_data->fk_unit, + 0, + $request_data->ref_ext ); if ($updateRes < 0) { From 229aa14a9731b5543b767f807e9b8d6ae296a85a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Sep 2020 14:43:24 +0200 Subject: [PATCH 09/12] Update pdf_standard.class.php --- htdocs/core/modules/member/doc/pdf_standard.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index bcab63940c0..590bd72f5c5 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -251,6 +251,10 @@ class pdf_standard extends CommonStickerGenerator { if ($object->country == '-') $object->country = ''; + $year = date('Y', dol_now()) + $month = date('m', dol_now()) + $day = date('d', dol_now()) + // List of values to scan for a replacement $substitutionarray = array( '__ID__' => $object->id, @@ -267,9 +271,9 @@ class pdf_standard extends CommonStickerGenerator '__EMAIL__'=>$object->email, '__BIRTH__'=>dol_print_date($object->birth, 'day'), '__TYPE__'=>$object->type, - '__YEAR__'=>date('Y', dol_now()), - '__MONTH__'=>date('m', dol_now()), - '__DAY__'=>date('d', dol_now()), + '__YEAR__'=>$year, + '__MONTH__'=>$month, + '__DAY__'=>$day, '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, '__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/" ); From 4b783d203e58a52a4f3a8c6fa3a172fc3aa93767 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Sep 2020 14:44:09 +0200 Subject: [PATCH 10/12] Update pdf_standard.class.php --- htdocs/core/modules/member/doc/pdf_standard.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 590bd72f5c5..d6d60d7b149 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -271,7 +271,7 @@ class pdf_standard extends CommonStickerGenerator '__EMAIL__'=>$object->email, '__BIRTH__'=>dol_print_date($object->birth, 'day'), '__TYPE__'=>$object->type, - '__YEAR__'=>$year, + '__YEAR__'=>$year, '__MONTH__'=>$month, '__DAY__'=>$day, '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, From 221c54c16f4d8133358e03fafb8894abe7f276f7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 9 Sep 2020 12:46:25 +0000 Subject: [PATCH 11/12] Fixing style errors. --- htdocs/core/modules/member/doc/pdf_standard.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index d6d60d7b149..37a9a924548 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -254,7 +254,7 @@ class pdf_standard extends CommonStickerGenerator $year = date('Y', dol_now()) $month = date('m', dol_now()) $day = date('d', dol_now()) - + // List of values to scan for a replacement $substitutionarray = array( '__ID__' => $object->id, From b99192bdb28e6a6f91ccf9e6a854db52785c02a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Sep 2020 14:46:42 +0200 Subject: [PATCH 12/12] Update pdf_standard.class.php --- htdocs/core/modules/member/doc/pdf_standard.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 37a9a924548..23e25c92590 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -251,10 +251,11 @@ class pdf_standard extends CommonStickerGenerator { if ($object->country == '-') $object->country = ''; - $year = date('Y', dol_now()) - $month = date('m', dol_now()) - $day = date('d', dol_now()) - + $now = dol_now(); + $year = dol_print_date($now, '%Y'); + $month = dol_print_date($now, '%m'); + $day = dol_print_date($now, '%d'); + // List of values to scan for a replacement $substitutionarray = array( '__ID__' => $object->id,
'.$bankline->getNomUrl(1).'