diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 55504a547c2..1621ca63e7a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2181,7 +2181,7 @@ class Adherent extends CommonObject if ($mode == 'expired') { $sql .= " AND a.statut = 1"; $sql .= " AND a.entity IN (".getEntity('adherent').")"; - $sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = 1)"; + $sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = '1')"; } elseif ($mode == 'shift') { $sql .= " AND a.statut = -1"; $sql .= " AND a.entity IN (".getEntity('adherent').")"; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 1b088f0c2b9..d4868ed68ac 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -166,8 +166,8 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'none')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'none')), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities - dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities $varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/'; if ($_FILES[$varforimage]["tmp_name"]) @@ -354,7 +354,8 @@ print ''; // Show bugtrack link print ''.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; -print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1); +print ajax_constantonoff("MAIN_BUGTRACK_ENABLELINK", array(), $conf->entity, 0, 0, 1, 0); +//print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1); print ''; print ' '; print ''; @@ -362,7 +363,8 @@ print ''; // Hide wiki link on login page $pictohelp = ''; print ''.$langs->trans("DisableLinkToHelp", $pictohelp).''; -print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); +print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0); +//print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); print ''; print ' '; print ''; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 5502d44dae0..5fccd2b07c9 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -36,24 +36,25 @@ if (!$user->admin) accessforbidden(); $usersignature = $user->signature; // For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html. + if ($action == 'test' || $action == 'send') { - $usersignature = dol_string_nohtmltag($usersignature); + $usersignature = dol_string_nohtmltag($usersignature, 2); } $substitutionarrayfortest = array( -'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, -'__ID__' => 'RecipientIdRecord', -//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails -'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty)) ? '' : '', -'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails -'__LOGIN__' => 'RecipientLogin', -'__LASTNAME__' => 'RecipientLastname', -'__FIRSTNAME__' => 'RecipientFirstname', -'__ADDRESS__'=> 'RecipientAddress', -'__ZIP__'=> 'RecipientZip', -'__TOWN_'=> 'RecipientTown', -'__COUNTRY__'=> 'RecipientCountry' + '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, + '__ID__' => 'RecipientIdRecord', + //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails + '__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty)) ? '' : '', + '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails + '__LOGIN__' => 'RecipientLogin', + '__LASTNAME__' => 'RecipientLastname', + '__FIRSTNAME__' => 'RecipientFirstname', + '__ADDRESS__'=> 'RecipientAddress', + '__ZIP__'=> 'RecipientZip', + '__TOWN_'=> 'RecipientTown', + '__COUNTRY__'=> 'RecipientCountry' ); complete_substitutions_array($substitutionarrayfortest, $langs); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index ab2889368cd..c4628ff44da 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -543,8 +543,8 @@ if ($mode == 'common' || $mode == 'commonkanban') $moreforfilter .= ''; $moreforfilter .= '
'; - $moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list paddingleft imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', 1, array('morecss'=>'reposition')); - $moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt paddingleft imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', 1, array('morecss'=>'reposition')); + $moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list paddingleft imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', 1, array('morecss'=>'reposition'.($mode == 'common' ? '' : ' btnTitleSelected'))); + $moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt paddingleft imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', 1, array('morecss'=>'reposition'.($mode == 'commonkanban' ? '' : ' btnTitleSelected'))); $moreforfilter .= '
'; $moreforfilter .= '
'.$moreinfo.'
'; @@ -654,7 +654,8 @@ if ($mode == 'common' || $mode == 'commonkanban') } $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label']; - print load_fiche_titre($familytext, '', ''); + + print load_fiche_titre($familytext, '', '', 0, '', 'modulefamilygroup'); if ($mode == 'commonkanban') { print '
'; diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 04439d11710..3627daab7d9 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -339,16 +339,20 @@ function getConfigFilePath() */ function getTableColumn($name, array $list) { + global $langs; + $name = strtolower($name); $html = ""; if (in_array($name, $list)) { - $html .= 'Ok'; + if ($name == 'xdebug') $html .= ''; + else $html .= ''; } else { - $html .= 'Warning'; + if ($name == 'xdebug') $html .= yn(0); + else $html .= ''; } $html .= ""; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 93283cab815..06f0b0e8fe7 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -90,7 +90,7 @@ function printDropdownBookmarksList() $i = 0; while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) { - $bookmarkList .= 'target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >'; + $bookmarkList .= 'target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >'; $bookmarkList .= dol_escape_htmltag($obj->title); $bookmarkList .= ''; $i++; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 3fcbffba3b2..80e52110d8c 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1810,11 +1810,13 @@ class AccountLine extends CommonObject */ public $fk_account; - public $bank_account_label; // Label of bank account + /** + * @var string Label of bank account + */ + public $bank_account_label; /** - * Issuer - * @var Societe + * @var string Name of check issuer */ public $emetteur; diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index fd87dd5e447..18a24245071 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -28,7 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; @@ -75,9 +75,9 @@ print '
'; print ''; print ''; -print ''; +print ''; print ''; @@ -100,11 +100,11 @@ $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE s.rowid = f.fk_soc"; -$sql .= " AND f.entity IN (".getEntity('invoice').")"; +$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; $sql .= " AND f.total_ttc > 0"; if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { - $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; + $sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED; } $sql .= " AND pfd.traite = 0 AND pfd.fk_facture_fourn = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -177,9 +177,11 @@ print '
'; /* * Withdraw receipts */ + $limit = 5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; +$sql .= " WHERE p.type = 'bank-transfer'"; $sql .= " ORDER BY datec DESC"; $sql .= $db->plimit($limit); @@ -198,26 +200,30 @@ if ($result) print '
'; print ''; - while ($i < min($num, $limit)) - { - $obj = $db->fetch_object($result); + if ($num > 0) { + while ($i < min($num, $limit)) + { + $obj = $db->fetch_object($result); + print ''; - print ''; + print "\n"; + print '\n"; + print '\n"; + print '\n"; - print "\n"; - print '\n"; - print '\n"; - print '\n"; - - print "\n"; - $i++; + print "\n"; + $i++; + } + } else { + print ''; } + print "
'.$langs->trans("Statistics").'
'.$langs->trans("NbOfInvoiceToWithdraw").'
'.$langs->trans("NbOfInvoiceToPayByBankTransfer").''; -print ''; +print ''; print $bprev->NbFactureAPrelever(); print ''; print '
'.$langs->trans("Status").'
"; + $bprev->id = $obj->rowid; + $bprev->ref = $obj->ref; + $bprev->statut = $obj->statut; + print $bprev->getNomUrl(1); + print "'.dol_print_date($db->jdate($obj->datec), "dayhour")."'.price($obj->amount)."'.$bprev->getLibStatut(3).""; - $bprev->id = $obj->rowid; - $bprev->ref = $obj->ref; - $bprev->statut = $obj->statut; - print $bprev->getNomUrl(1); - print "'.dol_print_date($db->jdate($obj->datec), "dayhour")."'.price($obj->amount)."'.$bprev->getLibStatut(3)."
'.$langs->trans("None").'

"; $db->free($result); } diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index c7c717e702b..ea768638552 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -38,6 +38,8 @@ $socid = GETPOST('socid', 'int'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +$type = GETPOST('type', 'aZ09'); + $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); @@ -57,6 +59,11 @@ $search_amount = GETPOST('search_amount', 'alpha'); $bon = new BonPrelevement($db); $hookmanager->initHooks(array('withdrawalsreceiptslist')); +$usercancreate = $user->rights->prelevement->bons->creer; +if ($type == 'bank-transfer') { + $usercancreate = $user->rights->paymentbybanktransfer->create; +} + /* * Actions @@ -78,6 +85,11 @@ llxHeader('', $langs->trans("WithdrawalsReceipts")); $sql = "SELECT p.rowid, p.ref, p.amount, p.statut, p.datec"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " WHERE p.entity IN (".getEntity('invoice').")"; +if ($type == 'bank-transfer') { + $sql .= " AND p.type = 'bank-transfer'"; +} else { + $sql .= " AND p.type = 'debit-order'"; +} if ($search_ref) $sql .= natural_search("p.ref", $search_ref); if ($search_amount) $sql .= natural_search("p.amount", $search_amount, 1); @@ -112,7 +124,7 @@ if ($result) $selectedfields = ''; $newcardbutton = ''; - if ($user->rights->prelevement->bons->creer) + if ($usercancreate) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php'); } @@ -127,7 +139,14 @@ if ($result) print ''; print ''; - print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1); + $titlekey = "WithdrawalsReceipts"; + $title = $langs->trans("WithdrawalsReceipts"); + if ($type == 'bank-transfer') { + $titlekey = "BankTransferReceipts"; + $title = $langs->trans("BankTransferReceipts"); + } + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1); $moreforfilter = ''; @@ -146,7 +165,7 @@ if ($result) print ''; print ''; - print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); + print_liste_field_titre($titlekey, $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "p.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index d81e101be3d..d630f65edd7 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -45,6 +45,8 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); +$type = GETPOST('type', 'aZ09'); + // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 0c21a3e6d2b..62188f1c7fc 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -638,8 +638,7 @@ class BonPrelevement extends CommonObject $arr = array(); /* - * Returns all invoices presented - * within a withdrawal receipt + * Returns all invoices presented within same order */ $sql = "SELECT fk_facture"; if ($amounts) $sql .= ", SUM(pl.amount)"; @@ -1159,8 +1158,12 @@ class BonPrelevement extends CommonObject if (!$notrigger) { + $triggername = 'DIRECT_DEBIT_ORDER_DELETE'; + if ($this->type == 'bank-transfer') { + $triggername = 'PAYMENTBYBANKTRANFER_DELETE'; + } // Call trigger - $result = $this->call_trigger('DIRECT_DEBIT_ORDER_DELETE', $user); + $result = $this->call_trigger($triggername, $user); if ($result < 0) $error++; // End call triggers } @@ -1224,7 +1227,12 @@ class BonPrelevement extends CommonObject $result = ''; - $label = ''.$langs->trans("ShowWithdraw").''; + $labeltoshow = 'Withdraw'; + if ($this->type == 'bank-transfer') { + $labeltoshow = 'PaymentByBankTransfer'; + } + + $label = ''.$langs->trans($labeltoshow).''; $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; if (isset($this->statut)) { @@ -1232,6 +1240,9 @@ class BonPrelevement extends CommonObject } $url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id; + if ($this->type == 'bank-transfer') { + $url = DOL_URL_ROOT.'/compta/paymentbybanktransfer/card.php?id='.$this->id; + } if ($option != 'nolink') { @@ -1272,7 +1283,7 @@ class BonPrelevement extends CommonObject //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); global $action, $hookmanager; - $hookmanager->initHooks(array('myobjectdao')); + $hookmanager->initHooks(array('banktransferdao')); $parameters = array('id'=>$this->id, 'getnomurl'=>$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 5306b6799b9..06ae8f7c794 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -43,6 +43,8 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bill if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +$type = GETPOST('type', 'aZ09'); + // Get supervariables $action = GETPOST('action', 'alpha'); $mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real'; @@ -130,7 +132,12 @@ $h++; dol_fiche_head($head, $hselected, $langs->trans("StandingOrders"), 0, 'payment'); */ -print load_fiche_titre($langs->trans("NewStandingOrder")); +$title = $langs->trans("NewStandingOrder"); +if ($type == 'bank-transfer') { + $title = $langs->trans("NewPaymentByBankTransfer"); +} + +print load_fiche_titre($title); dol_fiche_head(); @@ -144,12 +151,17 @@ if ($nb < 0 || $nb1 < 0 || $nb11 < 0) } print ''; -print ''; +$title = $langs->trans("NbOfInvoiceToWithdraw"); +if ($type == 'bank-transfer') { + $title = $langs->trans("NbOfInvoiceToPayByBankTransfer"); +} + +print ''; print ''; -print ''; +print ''; print ''; @@ -160,7 +172,7 @@ print ''; if ($mesg) print $mesg; -print "
\n"; +print '
'."\n"; print '
'; print ''; @@ -184,7 +196,11 @@ if ($nb) { } else { - print ''.$langs->trans("CreateAll")."\n"; + $title = $langs->trans("CreateAll"); + if ($type == 'bank-transfer') { + $title = $langs->trans("CreateFileForPaymentByBankTransfer"); + } + print ''.$title."\n"; } } } @@ -206,7 +222,11 @@ print '
'; $sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,"; $sql .= " pfd.date_demande, pfd.amount"; -$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; +if ($type == 'bank-transfer') { + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; +} else { + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; +} $sql .= " ".MAIN_DB_PREFIX."societe as s,"; $sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE s.rowid = f.fk_soc"; @@ -217,7 +237,11 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) } $sql .= " AND f.total_ttc > 0"; $sql .= " AND pfd.traite = 0"; -$sql .= " AND pfd.fk_facture = f.rowid"; +if ($type == 'bank-transfer') { + $sql .= " AND pfd.fk_facture = f.rowid"; +} else { + $sql .= " AND pfd.fk_facture_fourn = f.rowid"; +} if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid; $nbtotalofrecords = ''; @@ -252,7 +276,11 @@ if ($resql) print ''; } - print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit); + $title = $langs->trans("InvoiceWaitingWithdraw"); + if ($type == 'bank-transfer') { + $title = $langs->trans("InvoiceWaitingPaymentByBankTransfer"); + } + print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit); print '
'.$langs->trans("NbOfInvoiceToWithdraw").'
'.$title.''; print $nb; print '
'.$langs->trans("AmountToWithdraw").'
'.$langs->trans("AmountTotal").''; print price($pricetowithdraw); print '
'; print ''; diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 181f71a678c..720aac24be5 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -21,12 +21,13 @@ /** * \file htdocs/compta/prelevement/demandes.php * \ingroup prelevement - * \brief Page to list withdraw requests + * \brief Page to list bank transfer requests (debit order or payments of vendors) */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/modPrelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; @@ -43,6 +44,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myo $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$type = GETPOST('type', 'aZ09'); + $search_facture = GETPOST('search_facture', 'alpha'); $search_societe = trim(GETPOST('search_societe', 'alpha')); @@ -85,13 +88,20 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' * View */ -if (!$status) -{ - $title = $langs->trans("RequestStandingOrderToTreat"); -} -else -{ - $title = $langs->trans("RequestStandingOrderTreated"); +if ($type != 'bank-transfer') { + if (!$status) + { + $title = $langs->trans("RequestStandingOrderToTreat"); + } else { + $title = $langs->trans("RequestStandingOrderTreated"); + } +} else { + if (!$status) + { + $title = $langs->trans("RequestPaymentsByBankTransferToTreat"); + } else { + $title = $langs->trans("RequestPaymentsByBankTransferTreated"); + } } llxHeader('', $title); @@ -105,7 +115,11 @@ $sql = "SELECT f.ref, f.rowid, f.total_ttc,"; $sql .= " s.nom as name, s.rowid as socid,"; $sql .= " pfd.date_demande as date_demande,"; $sql .= " pfd.fk_user_demande"; -$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; +if ($type != 'bank-transfer') { + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; +} else { + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; +} $sql .= " ".MAIN_DB_PREFIX."societe as s,"; $sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -120,7 +134,11 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } -$sql .= " AND pfd.fk_facture = f.rowid"; +if ($type != 'bank-transfer') { + $sql .= " AND pfd.fk_facture = f.rowid"; +} else { + $sql .= " AND pfd.fk_facture_fourn = f.rowid"; +} if ($search_facture) $sql .= natural_search("f.ref", $search_facture); if ($search_societe) $sql .= natural_search("s.nom", $search_societe); $sql .= $db->order($sortfield, $sortorder); @@ -142,9 +160,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; -} -else -{ +} else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -160,6 +176,9 @@ else $newcardbutton = ''.$langs->trans("Back").''; +if ($type == 'bank-transfer') { + $newcardbutton = ''.$langs->trans("Back").''; +} print ''; if ($optioncss != '') print ''; @@ -171,6 +190,8 @@ print ''; print ''; print ''; +$param = ''; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit); print '
'; @@ -195,8 +216,6 @@ print $searchpicto; print ''; print ''; -$users = array(); - $i = 0; while ($i < min($num, $limit)) { diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index fb0a5548426..06c20a2b04f 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -42,6 +42,8 @@ $prev_id = GETPOST('id', 'int'); $socid = GETPOST('socid', 'int'); $ref = GETPOST('ref', 'alpha'); +$type = GETPOST('type', 'aZ09'); + $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 1cc454a3d4d..75cff74da8a 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -41,6 +41,8 @@ if ($user->socid > 0) accessforbidden(); $prev_id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); +$type = GETPOST('type', 'aZ09'); + // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 18028e2059a..899ff69fea1 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -39,6 +39,8 @@ if ($user->socid > 0) accessforbidden(); $prev_id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); +$type = GETPOST('type', 'aZ09'); + // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index eb2932fd4cb..5e1905e3a59 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -180,6 +180,7 @@ print '
'; $limit = 5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; +$sql .= " WHERE p.type = 'debit-order'"; $sql .= " ORDER BY datec DESC"; $sql .= $db->plimit($limit); @@ -198,26 +199,31 @@ if ($result) print '
'; print ''; - while ($i < min($num, $limit)) - { - $obj = $db->fetch_object($result); + if ($num > 0) { + while ($i < min($num, $limit)) + { + $obj = $db->fetch_object($result); - print ''; + print ''; - print "\n"; - print '\n"; - print '\n"; - print '\n"; + print "\n"; + print '\n"; + print '\n"; + print '\n"; - print "\n"; - $i++; + print "\n"; + $i++; + } + } else { + print ''; } + print "
'.$langs->trans("Status").'
"; - $bprev->id = $obj->rowid; - $bprev->ref = $obj->ref; - $bprev->statut = $obj->statut; - print $bprev->getNomUrl(1); - print "'.dol_print_date($db->jdate($obj->datec), "dayhour")."'.price($obj->amount)."'.$bprev->getLibStatut(3).""; + $bprev->id = $obj->rowid; + $bprev->ref = $obj->ref; + $bprev->statut = $obj->statut; + print $bprev->getNomUrl(1); + print "'.dol_print_date($db->jdate($obj->datec), "dayhour")."'.price($obj->amount)."'.$bprev->getLibStatut(3)."
'.$langs->trans("None").'

"; $db->free($result); } diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 9169f71a377..c225b9d47f3 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -43,6 +43,8 @@ $action = GETPOST('action', 'alpha'); $id = GETPOST('id', 'int'); $socid = GETPOST('socid', 'int'); +$type = GETPOST('type', 'aZ09'); + $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortorder = GETPOST('sortorder', 'alpha'); $sortfield = GETPOST('sortfield', 'alpha'); diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 48f9bcc7c54..e97a492de9b 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -47,6 +47,8 @@ $socid = GETPOST('socid', 'int'); if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +$type = GETPOST('type', 'aZ09'); + $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 6d1994b7a4b..7dfd5e558d9 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -38,6 +38,8 @@ $socid = GETPOST('socid', 'int'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +$type = GETPOST('type', 'aZ09'); + // Get supervariables $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortorder = GETPOST('sortorder', 'alpha'); @@ -47,6 +49,8 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + + /* * View */ diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index c6d1962ff46..416bb68128b 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -36,6 +36,8 @@ $socid = GETPOST('socid', 'int'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +$type = GETPOST('type', 'aZ09'); + /* * View diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ebae28e9582..c067ee2bc56 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -46,7 +46,7 @@ if (empty($objectclass) || empty($uploaddir)) // For backward compatibility if (!empty($permtoread) && empty($permissiontoread)) $permissiontoread = $permtoread; if (!empty($permtocreate) && empty($permissiontoadd)) $permissiontoadd = $permtocreate; -if (!empty($permtodelete) && empty($permissiontodelete)) $permissiontoread = $permtodelete; +if (!empty($permtodelete) && empty($permissiontodelete)) $permissiontodelete = $permtodelete; // Mass actions. Controls on number of lines checked. diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index bb6a8de30d4..83227b00e51 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -355,7 +355,7 @@ if ($useajax || $action == 'delete') $section_id = $section; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; - $useglobalvars = 1; + $form = new Form($db); $formquestion['urlfile'] = array('type'=>'hidden', 'value'=>$urlfile, 'name'=>'urlfile'); // We must always put field, even if empty because it is filled by javascript later $formquestion['section'] = array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); // We must always put field, even if empty because it is filled by javascript later diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index d4ee7ccaced..55474850b8e 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -88,7 +88,12 @@ class DolEditor // Define some properties if (in_array($this->tool, array('textarea', 'ckeditor', 'ace'))) { - $this->content = $content; + if ($this->tool == 'ckeditor' && ! dol_textishtml($content)) { // We force content to be into HTML if we are using an advanced editor if content is not HTML. + $this->content = dol_nl2br($content); + } + else { + $this->content = $content; + } $this->htmlname = $htmlname; $this->toolbarname = $shorttoolbarname; $this->toolbarstartexpanded = $toolbarstartexpanded; @@ -125,11 +130,6 @@ class DolEditor $found = 0; $out = ''; - if ($this->tool == 'fckeditor') // not used anymore - { - $found = 1; - $this->editor->Create(); - } if (in_array($this->tool, array('textarea', 'ckeditor'))) { $found = 1; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6e0651568a1..e1a834a42ca 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1676,8 +1676,13 @@ class ExtraFields } elseif ($type == 'select') { - if ($langfile && $param['options'][$value]) $value = $langs->trans($param['options'][$value]); - else $value = $param['options'][$value]; + $valstr = $param['options'][$value]; + if (($pos = strpos($valstr, "|")) !== false) + { + $valstr = substr($valstr, 0, $pos); + } + if ($langfile && $valstr) $value = $langs->trans($valstr); + else $value = $valstr; } elseif ($type == 'sellist') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f2b11938ca2..7496de72ec2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3801,7 +3801,8 @@ class Form $sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture'; $sql .= ' WHERE entity IN ('.getEntity('invoice').')'; - $sql .= ' AND situation_counter>=1'; + $sql .= ' AND situation_counter >= 1'; + $sql .= ' AND type <> 2'; $sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; $resql = $this->db->query($sql); if ($resql && $this->db->num_rows($resql) > 0) { @@ -4207,7 +4208,6 @@ class Form public function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = '', $useajax = 0, $height = 0, $width = 500, $disableformtag = 0) { global $langs, $conf; - global $useglobalvars; $more = ''; $formconfirm = ''; @@ -4355,7 +4355,7 @@ class Form if (isset($input['inputko']) && $input['inputko'] == 1) array_push($inputko, $input['name']); } } - // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template + // Show JQuery confirm box. $formconfirm .= '