From d401974028f17fd0f568bbe3e88f7a484b8ba0b6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 24 Nov 2018 15:33:48 +0100 Subject: [PATCH 1/7] Fix retrieve Donation newpayment.php --- htdocs/public/payment/newpayment.php | 143 +++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 5811e89aacc..4cda9365b9d 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1423,7 +1423,150 @@ if ($source == 'membersubscription') print ''."\n"; } +// Payment on donation +if ($source == 'donation') +{ + $found=true; + $langs->load("don"); + require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; + + $don=new Don($db); + $result=$don->fetch($ref); + if ($result <= 0) + { + $mesg=$don->error; + $error++; + } + else + { + $don->fetch_thirdparty(); + $object = $don; + } + + if ($action != 'dopayment') // Do not change amount if we just click on first dopayment + { + $amount=$subscription->total_ttc; + if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); + $amount=price2num($amount); + } + + $fulltag='DON='.$don->ref.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M'); + if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; } + $fulltag=dol_string_unaccent($fulltag); + + // Creditor + + print ''.$langs->trans("Creditor"); + print ''.$creditor.''; + print ''; + print ''."\n"; + + // Debitor + + print ''.$langs->trans("Member"); + print ''; + if ($don->morphy == 'mor' && ! empty($don->societe)) print $don->societe; + else print $don->getFullName($langs); + print ''; + + // Object + + $text=''.$langs->trans("PaymentDonation").''; + if (GETPOST('desc','alpha')) $text=''.$langs->trans(GETPOST('desc','alpha')).''; + print ''.$langs->trans("Designation"); + print ''.$text; + print ''; + print ''; + print ''."\n"; + + // Amount + + print ''.$langs->trans("Amount"); + if (empty($amount)) + { + if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ' ('.$langs->trans("ToComplete"); + if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - '.$langs->trans("SeeHere").''; + if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ')'; + } + print ''; + $valtoshow=''; + if (empty($amount) || ! is_numeric($amount)) + { + $valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); + // force default subscription amount to value defined into constant... + if (empty($valtoshow)) + { + if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + } + else { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + } + } + } + if (empty($amount) || ! is_numeric($amount)) + { + //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); + if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); + print ''; + print ''; + } + else { + $valtoshow=$amount; + if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); + print ''.price($valtoshow).''; + print ''; + print ''; + } + // Currency + print ' '.$langs->trans("Currency".$currency).''; + print ''; + print ''."\n"; + + // Tag + + print ''.$langs->trans("PaymentCode"); + print ''.$fulltag.''; + print ''; + print ''; + print ''."\n"; + + // Shipping address + $shipToName=$don->getFullName($langs); + $shipToStreet=$don->address; + $shipToCity=$don->town; + $shipToState=$don->state_code; + $shipToCountryCode=$don->country_code; + $shipToZip=$don->zip; + $shipToStreet2=''; + $phoneNum=$don->phone; + if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) + { + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + } + else + { + print ''."\n"; + } + if (is_object($don->thirdparty)) print ''."\n"; + print ''."\n"; + $labeldesc = $langs->trans("PaymentSubscription"); + if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); + print ''."\n"; +} if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters"); From 9154fd366fb30494a0be80f889f76953174efa93 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 24 Nov 2018 22:30:06 +0100 Subject: [PATCH 2/7] Fix create accounting account from balance --- htdocs/accountancy/admin/card.php | 9 +++++---- htdocs/accountancy/bookkeeping/balance.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 74958d606ec..33fdb675ac0 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2014 Florian Henry +/* Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2014 Florian Henry * * 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 @@ -41,6 +41,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $rowid = GETPOST('rowid', 'int'); $cancel = GETPOST('cancel','alpha'); +$accountingaccount = GETPOST('accountingaccount','alpha'); // Security check @@ -229,7 +230,7 @@ if ($action == 'create') { // Account number print '' . $langs->trans("AccountNumber") . ''; - print ''; + print ''; // Label print '' . $langs->trans("Label") . ''; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index e807d1acced..5183281f4cd 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -266,7 +266,7 @@ if ($action != 'export_csv') $description = $object->get_compte_desc($line->numero_compte); // Search description of the account $root_account_description = $object->get_compte_racine($line->numero_compte); if (empty($description)) { - $link = '' . img_edit_add() . ''; + $link = '' . img_edit_add() . ''; } print ''; From db719dbcbbf179c7583492bbe049dcba1f626dc3 Mon Sep 17 00:00:00 2001 From: IJ Date: Sun, 25 Nov 2018 20:36:25 +0000 Subject: [PATCH 3/7] FIX: Display All Types of Payments on Expense Report Card Fixes #9991 - Bug: 7.0.4: Expense Report Payment Type Not Displayed - without this fix, only cash type accounts were shown when payment was made --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 4bc41f6fa47..2a09fa2a71e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1925,7 +1925,7 @@ else print $paymentexpensereportstatic->getNomUrl(1); print ''; print ''.dol_print_date($db->jdate($objp->dp),'day')."\n"; - $labeltype=$langs->trans("PaymentType".$objp->p_code)!=("PaymentType".$objp->p_code)?$langs->trans("PaymentType".$objp->p_code):$objp->fk_typepayment; + $labeltype=$langs->trans("PaymentType".$objp->p_code)!=("PaymentType".$objp->p_code)?$langs->trans("PaymentType".$objp->p_code):$objp->payment_type; print "".$labeltype.' '.$objp->num_payment."\n"; if (! empty($conf->banque->enabled)) { From 2af24903e9afc4bca44469e8c1222de3168d597d Mon Sep 17 00:00:00 2001 From: oscim Date: Mon, 26 Nov 2018 10:53:34 +0100 Subject: [PATCH 4/7] Update company.lib.php Fix list in agenda for tab customer / provider , no thirdparty selected because name of class is not Societe --- htdocs/core/lib/company.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 09f7bd85c90..fc15480de09 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1344,7 +1344,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o"; $sql.= " WHERE a.entity IN (".getEntity('agenda').")"; - if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; + if (is_object($filterobj) && in_array( get_class($filterobj), array('Societe', 'Client', 'Fournisseur') ) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { @@ -1386,6 +1386,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']); + + // TODO Add limit for thirdparty in contexte very all result $sql.= $db->order($sortfield, $sortorder); dol_syslog("company.lib::show_actions_done", LOG_DEBUG); $resql=$db->query($sql); From f5ebcca475b1840b709eb17034b53c0998ae1990 Mon Sep 17 00:00:00 2001 From: oscim Date: Mon, 26 Nov 2018 15:47:51 +0100 Subject: [PATCH 5/7] error space after comment --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index fc15480de09..379fb04eb4f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1387,7 +1387,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']); - // TODO Add limit for thirdparty in contexte very all result + //TODO Add limit for thirdparty in contexte very all result $sql.= $db->order($sortfield, $sortorder); dol_syslog("company.lib::show_actions_done", LOG_DEBUG); $resql=$db->query($sql); From b4aa9ee335f0b6f03ddbe68caf8bb2176808f078 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 28 Nov 2018 17:04:42 +0100 Subject: [PATCH 6/7] FIX remove constant for avoid problem --- htdocs/core/modules/modAccounting.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 42cd67b9dab..ef152521969 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -80,7 +80,7 @@ class modAccounting extends DolibarrModules "MAIN_COMPANY_CODE_ALWAYS_REQUIRED", "chaine", "1", - "With this constants on, third party code is always required whatever is numbering module behaviour", 0, 'current', 0 + "With this constants on, third party code is always required whatever is numbering module behaviour", 0, 'current', 1 ); $this->const[2] = array( "MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED", From f3ce49806d286d2dcda951b455b2b51cb082532e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Nov 2018 11:15:27 +0100 Subject: [PATCH 7/7] Update company.lib.php --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 379fb04eb4f..4618828e476 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1344,7 +1344,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o"; $sql.= " WHERE a.entity IN (".getEntity('agenda').")"; - if (is_object($filterobj) && in_array( get_class($filterobj), array('Societe', 'Client', 'Fournisseur') ) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; + if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {