Merge branch 'develop' into patch-147

This commit is contained in:
Laurent Destailleur 2019-04-11 17:54:29 +02:00 committed by GitHub
commit 9337e48072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2002 changed files with 99086 additions and 60189 deletions

View File

@ -31,7 +31,6 @@ addons:
- pgloader - pgloader
php: php:
- '5.4'
- '5.5' - '5.5'
- '5.6' - '5.6'
- '7.0' - '7.0'
@ -62,8 +61,6 @@ matrix:
- php: nightly - php: nightly
# We exclude some combinations not usefull to save Travis CPU # We exclude some combinations not usefull to save Travis CPU
exclude: exclude:
- php: '5.5'
env: DB=mariadb
- php: '5.6' - php: '5.6'
env: DB=mariadb env: DB=mariadb
- php: '7.0' - php: '7.0'
@ -72,8 +69,6 @@ matrix:
env: DB=mariadb env: DB=mariadb
- php: '7.2' - php: '7.2'
env: DB=mariadb env: DB=mariadb
- php: '5.5'
env: DB=postgresql
- php: '5.6' - php: '5.6'
env: DB=postgresql env: DB=postgresql
- php: '7.0' - php: '7.0'

View File

@ -2,20 +2,26 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 10.0.0 compared to 9.0.0 ***** ***** ChangeLog for 10.0.0 compared to 9.0.0 *****
For Users: For Users:
NEW: Module Ticket is available as a stable module. NEW: Module "Ticket" is available as a stable module.
NEW: module "Email Collector" is available as a stable module.
NEW: module "TakePOS" is available as a stable module.
NEW: Experimental module "Vendor receptions". NEW: Experimental module "Vendor receptions".
NEW: Experimental module "BOM". NEW: Experimental module "BOM".
FIX: Disallow line start date to be after end date FIX: Disallow line start date if after end date.
For Developers: For Developers:
NEW: Module DebugBar is available as a stable module. NEW: Module "DebugBar" is available as a stable module.
WARNING: WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* PHP 5.4 is no more supported. Minimum PHP is now 5.5+.
* The PHP extension php-intl is not mandatory but should be installed to have new features working correctly.
* Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules. * Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules.
* API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules. * API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules.
* Deprecated function img_phone as been removed. You can use img_picto(..., 'call|call_out') instead.; * Deprecated function img_phone as been removed. You can use img_picto(..., 'call|call_out') instead.;
@ -24,9 +30,63 @@ Following changes may create regressions for some external modules, but were nec
* All methods set_draft() were renamed into setDraft(). * All methods set_draft() were renamed into setDraft().
* Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject. * Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject.
* Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated. * Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated.
* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION * Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION.
* Method dolEscapeXML was moved from functions.lib.php into function2.lib.php (not used enough to be loaded by default).
* Removed deprecated use of string in dol_print_date(). Only date allowed.
* Deprecated property ->fk_departement is now ->state_id everywhere.
* Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr.
***** ChangeLog for 9.0.2 compared to 9.0.1 *****
FIX: #10822
FIX: Accountancy - Format EBP import
FIX: A page of a site replaced with another when switching in edit mode
FIX: Autodetect buy price for invoices autogenerated with templates.
FIX: Avoid error 500 when extension php-intl not loaded
FIX: bad check on type of expense report (mandatory status not working)
FIX: Bad label of status for members (must be short version in list)
FIX: Can not create contract with numbering module without autogen rule
FIX: Can't set default value of extrafield of type varchar
FIX: check only if invoice module is enabled (bank is check after)
FIX: counter of permissions in badge was wrong
FIX: default value of language of thirdparty
FIX: Don't show accountingjournal:getNomUrl without data
FIX: Duplicate executeHook function
FIX: Edit of personalized groups
FIX: Error with various & salary payment on project
FIX: extrafields always visible on view mode
FIX: function not found
FIX: If we build one invoice for several orders, we must put the ref of
orders on lines.
FIX: expensereport must be in $check array
FIX: missing entity filter and wrong var name
FIX: Missing field "In sale" in list
FIX: missing hook completeTabsHead in margins module
FIX: missing hook in agenda export
FIX: missing vat_src_code when inserting an expense report line
FIX: More complete auto setup of barcode module
FIX: need to round with 2 decimals to avoid movements not correctly balanced
FIX: no need to test anything to display documents tabs on expense report
FIX: old export models was not visible
FIX: Param keepn must be 1 when dol_escape_htmltag used for textarea
FIX: possibility to set up payment mode when invoice module is disabled
FIX: problem with sign of various payment in project preview
FIX: Remane of project
FIX: setup of module export
FIX: several hooks in shipping/delivery cards
FIX: supplier discount was not retrieved when choosing a product
FIX: The minimum amount filter does not work in the VAT report per customer
FIX: Tooltip on click was ko on smartphone
FIX: translation
FIX: useless join
FIX: Vat src code lost after editing expense report line
FIX: we need to keep originline special_code
FIX: Can't insert if there is extrafields mandatory on another entity.
FIX: error in create object when 2 extra fields are mandatory in 2 different entities
FIX: when we create deposit with multi tva, we mustn't add line if amount = 0 (example when we have a 100% reduc on one of origin invoice line)
FIX: wrong redirect link on holiday refuse
NEW: Add more complete error messages in log on stripe payments
***** ChangeLog for 9.0.1 compared to 9.0.0 ***** ***** ChangeLog for 9.0.1 compared to 9.0.0 *****
FIX: #10381 FIX: #10381
FIX: #10460 compatibility with MariaDB 10.4 FIX: #10460 compatibility with MariaDB 10.4
@ -507,7 +567,7 @@ NEW: Filter export model is now by user
NEW: Finish implementation of option PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES NEW: Finish implementation of option PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES
NEW: generalize use of button to create new element from list NEW: generalize use of button to create new element from list
NEW: hidden conf AGENDA_NB_WEEKS_IN_VIEW_PER_USER to set nb weeks to show into per user view NEW: hidden conf AGENDA_NB_WEEKS_IN_VIEW_PER_USER to set nb weeks to show into per user view
NEW: hidden conf to assign category to thirparty that are neither customer nor prospect or supplier NEW: hidden conf to assign category to thirdparty that are neither customer nor prospect or supplier
NEW: hidden conf to set nb weeks to show into user view NEW: hidden conf to set nb weeks to show into user view
NEW: hidden option MAIN_DISABLE_FREE_LINES NEW: hidden option MAIN_DISABLE_FREE_LINES
NEW: improve way of adding users/sales representative to thirdparty NEW: improve way of adding users/sales representative to thirdparty

View File

@ -8,6 +8,15 @@ ALL:
Check "@CHANGE" Check "@CHANGE"
PrestaShopWebservice:
---------------------
Replace
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop');
With
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date');
CKEDITOR (4.6.2): CKEDITOR (4.6.2):
----------------- -----------------
* In ckeditor/ckeditor/contents.css * In ckeditor/ckeditor/contents.css

View File

@ -8,9 +8,11 @@
<exclude-pattern type="relative">documents</exclude-pattern> <exclude-pattern type="relative">documents</exclude-pattern>
<exclude-pattern type="relative">htdocs/custom</exclude-pattern> <exclude-pattern type="relative">htdocs/custom</exclude-pattern>
<exclude-pattern type="relative">htdocs/includes</exclude-pattern> <exclude-pattern type="relative">htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">htdocs/install/doctemplates/websites</exclude-pattern>
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern> <exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
<exclude-pattern type="relative">*/nltechno*</exclude-pattern> <exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern> <exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<!-- List of all tests --> <!-- List of all tests -->

View File

@ -150,6 +150,7 @@ if (dol_strlen($search_year)) {
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )"; $sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
} }
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$debit = 0; $debit = 0;

View File

@ -142,13 +142,12 @@ $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code "; $sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )"; $sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
if (dol_strlen($search_year)) { if (dol_strlen($search_year)) {
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year); $date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year); $date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
$sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )"; $sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
} }
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
$sql.= $db->order($sortfield, $sortorder); $sql.= $db->order($sortfield, $sortorder);
$debit = 0; $debit = 0;

View File

@ -538,7 +538,7 @@ class AccountancyExport
//print substr(length_accountg($line->numero_compte), 0, 2) . $separator; //print substr(length_accountg($line->numero_compte), 0, 2) . $separator;
print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"' . $separator; print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"' . $separator;
print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator; print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator;
print price2num($line->montant).$separator; print price2num(abs($line->montant)).$separator;
print $line->sens.$separator; print $line->sens.$separator;
print $date . $separator; print $date . $separator;
//print 'EUR'; //print 'EUR';

View File

@ -142,12 +142,12 @@ class AccountancySystem
$result = $this->rowid; $result = $this->rowid;
} else { } else {
$result = - 2; $result = - 2;
$this->error = "AccountancySystem::Create Erreur $result"; $this->error = "AccountancySystem::Create Error $result";
dol_syslog($this->error, LOG_ERR); dol_syslog($this->error, LOG_ERR);
} }
} else { } else {
$result = - 1; $result = - 1;
$this->error = "AccountancySystem::Create Erreur $result"; $this->error = "AccountancySystem::Create Error $result";
dol_syslog($this->error, LOG_ERR); dol_syslog($this->error, LOG_ERR);
} }

View File

@ -341,7 +341,7 @@ if ($result) {
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);

View File

@ -273,7 +273,7 @@ if ($result) {
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);

View File

@ -340,7 +340,7 @@ if ($result) {
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);

View File

@ -56,7 +56,7 @@ class AdherentType extends CommonObject
/** /**
* @var string * @var string
* @deprecated Use label * @deprecated Use label
* @see label * @see $label
*/ */
public $libelle; public $libelle;

View File

@ -86,7 +86,8 @@ class Members extends DolibarrApi
* @param int $limit Limit for list * @param int $limit Limit for list
* @param int $page Page number * @param int $page Page number
* @param string $typeid ID of the type of member * @param string $typeid ID of the type of member
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma.
* Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))"
* @return array Array of member objects * @return array Array of member objects
* *
* @throws RestException * @throws RestException

View File

@ -113,7 +113,7 @@ if ($id > 0)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border tableforfield centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';

View File

@ -358,7 +358,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -240,7 +240,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); //if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@ -339,7 +339,7 @@ if (! empty($arrayfields['t.libelle']['checked']))
if (! empty($arrayfields['d.bank']['checked'])) if (! empty($arrayfields['d.bank']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $form->select_comptes($search_account, 'search_account', 0, '', 1); $form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>'; print '</td>';
} }

View File

@ -134,8 +134,7 @@ $head=agenda_prepare_head();
dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), -1, 'action'); dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), -1, 'action');
print $langs->trans("AgendaAutoActionDesc")."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("AgendaAutoActionDesc")." ".$langs->trans("OnlyActiveElementsAreShown", 'modules.php').'</span><br>';
print $langs->trans("OnlyActiveElementsAreShown", 'modules.php').'<br>';
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table

View File

@ -140,7 +140,7 @@ $head=agenda_prepare_head();
dol_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action'); dol_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action');
print $langs->trans("AgendaExtSitesDesc")."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("AgendaExtSitesDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";

View File

@ -84,7 +84,7 @@ $head=agenda_prepare_head();
dol_fiche_head($head, 'xcal', $langs->trans("Agenda"), -1, 'action'); dol_fiche_head($head, 'xcal', $langs->trans("Agenda"), -1, 'action');
print $langs->trans("AgendaSetupOtherDesc")."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("AgendaSetupOtherDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2008-2018 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -36,7 +36,8 @@ $action = GETPOST('action', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$arrayofparameters=array( $arrayofparameters=array(
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
); );
@ -84,7 +85,11 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
print '</td><td>'; print '</td><td>';
if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{
print $langs->trans("AlwaysActive");
}
elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
{ {
print $form->selectyesno($key, $conf->global->$key, 1); print $form->selectyesno($key, $conf->global->$key, 1);
} }
@ -114,7 +119,11 @@ else
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
print '</td><td>'; print '</td><td>';
if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{
print $langs->trans("AlwaysActive");
}
elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
{ {
print yn($conf->global->$key); print yn($conf->global->$key);
} }

View File

@ -46,7 +46,7 @@ class PrestaShopWebservice
/** @var array compatible versions of PrestaShop Webservice */ /** @var array compatible versions of PrestaShop Webservice */
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0'; const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
const PSCOMPATIBLEVERSIONMAX = '1.6.99.99'; const PSCOMPATIBLEVERSIONMAX = '1.7.99.99';
/** /**
@ -128,6 +128,7 @@ class PrestaShopWebservice
CURLOPT_HTTPHEADER => array( 'Expect:' ) CURLOPT_HTTPHEADER => array( 'Expect:' )
); );
dol_syslog("curl_init url=".$url);
$session = curl_init($url); $session = curl_init($url);
$curl_options = array(); $curl_options = array();
@ -142,6 +143,7 @@ class PrestaShopWebservice
if (!isset($curl_options[$defkey])) if (!isset($curl_options[$defkey]))
$curl_options[$defkey] = $curl_params[$defkey]; $curl_options[$defkey] = $curl_params[$defkey];
dol_syslog("curl curl_options = ".var_export($curl_options, true));
curl_setopt_array($session, $curl_options); curl_setopt_array($session, $curl_options);
$response = curl_exec($session); $response = curl_exec($session);
@ -309,7 +311,9 @@ class PrestaShopWebservice
if (isset($options['id'])) if (isset($options['id']))
$url .= '/'.$options['id']; $url .= '/'.$options['id'];
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); // @CHANGE LDR
//$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop');
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date');
foreach ($params as $p) foreach ($params as $p)
foreach ($options as $k => $o) foreach ($options as $k => $o)
if (strpos($k, $p) !== false) if (strpos($k, $p) !== false)
@ -388,6 +392,49 @@ class PrestaShopWebservice
self::checkStatusCode($request['status_code']);// check the response validity self::checkStatusCode($request['status_code']);// check the response validity
return self::parseXML($request['response']); return self::parseXML($request['response']);
} }
/**
* Delete (DELETE) a resource.
* Unique parameter must take : <br><br>
* 'resource' => Resource name<br>
* 'id' => ID or array which contains IDs of a resource(s) you want to delete<br><br>
* <code>
* <?php
* require_once('./PrestaShopWebservice.php');
* try
* {
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
* $xml = $ws->delete(array('resource' => 'orders', 'id' => 1));
* // Following code will not be executed if an exception is thrown.
* echo 'Successfully deleted.';
* }
* catch (PrestaShopWebserviceException $ex)
* {
* echo 'Error : '.$ex->getMessage();
* }
* ?>
* </code>
*
* @param array $options Array representing resource to delete.
* @return boolean True
*/
public function delete($options)
{
if (isset($options['url']))
$url = $options['url'];
elseif (isset($options['resource']) && isset($options['id']))
if (is_array($options['id']))
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
else
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
if (isset($options['id_shop']))
$url .= '&id_shop='.$options['id_shop'];
if (isset($options['id_group_shop']))
$url .= '&id_group_shop='.$options['id_group_shop'];
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
self::checkStatusCode($request['status_code']);// check the response validity
return true;
}
} }
/** /**

View File

@ -44,7 +44,6 @@ class Dolistore
// setups // setups
public $url; // the url of this page public $url; // the url of this page
public $shop_url; // the url of the shop public $shop_url; // the url of the shop
public $vat_rate; // the vat rate used in the shop (prices are provided without vat)
public $lang; // the integer representing the lang in the store public $lang; // the integer representing the lang in the store
public $debug_api; // usefull if no dialog public $debug_api; // usefull if no dialog
@ -60,12 +59,11 @@ class Dolistore
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace'; $this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product='; $this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
$this->vat_rate = 1.2; // 20% de TVA
$this->debug_api = $debug; $this->debug_api = $debug;
$langtmp = explode('_', $langs->defaultlang); $langtmp = explode('_', $langs->defaultlang);
$lang = $langtmp[0]; $lang = $langtmp[0];
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1 $lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1
if (! in_array($lang, array_keys($lang_array))) $lang = 'en'; if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
$this->lang = $lang_array[$lang]; $this->lang = $lang_array[$lang];
} }
@ -74,12 +72,50 @@ class Dolistore
* Load data from remote Dolistore market place. * Load data from remote Dolistore market place.
* This fills ->categories * This fills ->categories
* *
* @param array $options Options
* @return void * @return void
*/ */
public function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) public function getRemoteCategories()
{ {
global $conf, $langs; global $conf;
try {
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
dol_syslog("Call API with MAIN_MODULE_DOLISTORE_API_SRV = ".$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
// $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data.
// Here we set the option array for the Webservice : we want categories resources
$opt = array();
$opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc';
// Call
dol_syslog("Call API with opt = ".var_export($opt, true));
$xml = $this->api->get($opt);
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
elseif ($trace[0]['args'][0] == 401) die('Bad auth key');
else
{
print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'<br>';
print $e->getMessage();
}
}
}
/**
* Load data from remote Dolistore market place.
* This fills ->products
*
* @param array $options Options. If 'categorie' is defined, we filter products on this category id
* @return void
*/
public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0, 'search' => ''))
{
global $conf;
$this->start = $options['start']; $this->start = $options['start'];
$this->end = $options['end']; $this->end = $options['end'];
@ -103,25 +139,26 @@ class Dolistore
// make a search to limit the id returned. // make a search to limit the id returned.
if ($this->search != '') { if ($this->search != '') {
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; // It seems for search, key start with
// Call // Call
//var_dump($this->api);
dol_syslog("Call API with opt = ".var_export($opt, true));
dol_syslog("Call API with opt2 = ".var_export($opt2, true)); dol_syslog("Call API with opt2 = ".var_export($opt2, true));
$xml = $this->api->get($opt2); $xml = $this->api->get($opt2);
$products = array(); $products = array();
foreach ($xml->products->children() as $product) { foreach ($xml->products->children() as $product) {
$products[] = (int) $product['id']; $products[] = (int) $product['id'];
} }
$opt['filter[id]'] = '['.implode('|', $products).']'; $opt['filter[id]'] = '['.implode('|', $products).']';
} elseif ($this->categorie != 0) { } elseif ($this->categorie != 0) { // We filter on category, so we first get list of product id in this category
// $opt2['url'] is set by default to $this->url.'/api/'.$options['resource'];
$opt2['resource'] = 'categories'; $opt2['resource'] = 'categories';
$opt2['id'] = $this->categorie; $opt2['id'] = $this->categorie;
// Call // Call
dol_syslog("Call API with opt2 = ".var_export($opt2, true));
$xml = $this->api->get($opt2); $xml = $this->api->get($opt2);
$products = array(); $products = array();
foreach ($xml->category->associations->products->children() as $product) { foreach ($xml->category->associations->products->children() as $product) {
$products[] = (int) $product->id; $products[] = (int) $product->id;
@ -134,22 +171,10 @@ class Dolistore
$opt['limit'] = "$this->start,$this->end"; $opt['limit'] = "$this->start,$this->end";
// $opt['filter[id]'] contais list of product id that are result of search // $opt['filter[id]'] contais list of product id that are result of search
// Call API to get the detail // Call API to get the detail
dol_syslog("Call API with opt = ".var_export($opt, true)); dol_syslog("Call API with opt = ".var_export($opt, true));
dol_syslog("Call API with opt2 = ".var_export($opt2, true));
$xml = $this->api->get($opt); $xml = $this->api->get($opt);
$this->products = $xml->products->children(); $this->products = $xml->products->children();
// Here we set the option array for the Webservice : we want categories resources
$opt = array();
$opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc';
// Call
$xml = $this->api->get($opt);
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) { } catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors // Here we are dealing with errors
$trace = $e->getTrace(); $trace = $e->getTrace();
@ -186,15 +211,15 @@ class Dolistore
$cat = $this->categories[$i]; $cat = $this->categories[$i];
if ($cat->is_root_category == 1 && $parent == 0) { if ($cat->is_root_category == 1 && $parent == 0) {
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" ' $html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"' .'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'"'
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>'; .'>'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
$html .= self::get_categories($cat->id); $html .= self::get_categories($cat->id);
$html .= "</li>\n"; $html .= "</li>\n";
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
$select = ($cat->id == $this->categorie) ? ' selected' : ''; $select = ($cat->id == $this->categorie) ? ' selected' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"' $html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" ' .' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" '
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>'; .'>'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
$html .= self::get_categories($cat->id); $html .= self::get_categories($cat->id);
$html .= "</li>\n"; $html .= "</li>\n";
} else { } else {
@ -242,7 +267,7 @@ class Dolistore
// add image or default ? // add image or default ?
if ($product->id_default_image != '') { if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image; $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image;
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'. $images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version.'">'.
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>'; '<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else { } else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />'; $images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
@ -250,7 +275,7 @@ class Dolistore
// free or pay ? // free or pay ?
if ($product->price > 0) { if ($product->price > 0) {
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).'&nbsp;&euro;</h3>'; $price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>'; $download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} else { } else {
$price = '<h3>'.$langs->trans('Free').'</h3>'; $price = '<h3>'.$langs->trans('Free').'</h3>';
@ -283,10 +308,10 @@ class Dolistore
//output template //output template
$html .= '<tr class="app '.$parity.' '.$compatible.'"> $html .= '<tr class="app '.$parity.' '.$compatible.'">
<td class="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td> <td class="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang] <td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang - 1]
.'<br/><small>'.$version.'</small></h2> .'<br/><small>'.$version.'</small></h2>
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td> <small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang - 1].'</td>
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td> <td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>
<td class="margeCote center">'.$price.' <td class="margeCote center">'.$price.'
</td> </td>
<td class="margeCote">'.$download_link.'</td> <td class="margeCote">'.$download_link.'</td>

View File

@ -75,6 +75,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$debuginfo='';
/* /*
* Actions * Actions
@ -180,11 +182,13 @@ if ($action == 'confirm_collect')
$res = $object->doCollectOneCollector(); $res = $object->doCollectOneCollector();
if ($res > 0) if ($res > 0)
{ {
$debuginfo = $object->debuginfo;
setEventMessages($object->lastresult, null, 'mesgs'); setEventMessages($object->lastresult, null, 'mesgs');
} }
else else
{ {
setEventMessages($object->error, null, 'errors'); $debuginfo = $object->debuginfo;
setEventMessages($object->error, null, 'errors');
} }
$action = ''; $action = '';
@ -443,22 +447,45 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
$arrayoftypes=array( $arrayoftypes=array(
'from'=>'MailFrom', 'from'=>array('label'=>'MailFrom', 'data-placeholder'=>'SearchString'),
'to'=>'MailTo', 'to'=>array('label'=>'MailTo', 'data-placeholder'=>'SearchString'),
'cc'=>'Cc', 'cc'=>array('label'=>'Cc', 'data-placeholder'=>'SearchString'),
'bcc'=>'Bcc', 'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>'SearchString'),
'subject'=>'Subject', 'subject'=>array('label'=>'Subject', 'data-placeholder'=>'SearchString'),
'body'=>'Body', 'body'=>array('label'=>'Body', 'data-placeholder'=>'SearchString'),
'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value
'X1'=>'---', 'X1'=>'---',
'seen'=>'AlreadyRead', 'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1),
'unseen'=>'NotRead', 'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1),
'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>'NumberOfBytes'),
'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>'NumberOfBytes'),
'X2'=>'---', 'X2'=>'---',
'withtrackingid'=>'WithDolTrackingID', 'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1),
'withouttrackingid'=>'WithoutDolTrackingID' 'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1)
); );
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', '', 0, '', 2); print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', '', 0, '', 2);
print "\n";
print '<script>';
print 'jQuery("#filtertype").change(function() {
console.log("We change a filter");
if (jQuery("#filtertype option:selected").attr("data-noparam")) {
jQuery("#rulevalue").attr("placeholder", "");
jQuery("#rulevalue").text(""); jQuery("#rulevalue").prop("disabled", true);
}
else { jQuery("#rulevalue").prop("disabled", false); }
jQuery("#rulevalue").attr("placeholder", (jQuery("#filtertype option:selected").attr("data-placeholder")));
';
$noparam=array();
foreach($arrayoftypes as $key => $value)
{
if ($value['noparam']) $noparam[]=$key;
}
print '})';
print '</script>'."\n";
print '</td><td>'; print '</td><td>';
print '<input type="text" name="rulevalue">'; print '<input type="text" name="rulevalue" id="rulevalue">';
print '</td>'; print '</td>';
print '<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button" value="'.$langs->trans("Add").'"></td>'; print '<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button" value="'.$langs->trans("Add").'"></td>';
print '</tr>'; print '</tr>';
@ -470,7 +497,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $langs->trans($arrayoftypes[$rulefilter['type']]); print $langs->trans($arrayoftypes[$rulefilter['type']]['label']);
print '</td>'; print '</td>';
print '<td>'.$rulefilter['rulevalue'].'</td>'; print '<td>'.$rulefilter['rulevalue'].'</td>';
print '<td class="right">'; print '<td class="right">';
@ -492,8 +519,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Add operation // Add operation
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
$arrayoftypes=array('loadthirdparty'=>'LoadThirdPartyFromName', 'loadandcreatethirdparty'=>'LoadThirdPartyFromNameOrCreate', 'recordevent'=>'RecordEvent'); $arrayoftypes=array(
'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
'recordevent'=>'RecordEvent');
if ($conf->projet->enabled) $arrayoftypes['project']='CreateLeadAndThirdParty'; if ($conf->projet->enabled) $arrayoftypes['project']='CreateLeadAndThirdParty';
if ($conf->ticket->enabled) $arrayoftypes['ticket']='CreateTicketAndThirdParty';
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1); print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1);
print '</td><td>'; print '</td><td>';
print '<input type="text" name="operationparam">'; print '<input type="text" name="operationparam">';
@ -517,12 +548,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">'; print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">';
print '<td>'; print '<td>';
print $langs->trans($arrayoftypes[$ruleaction['type']]); print $langs->trans($arrayoftypes[$ruleaction['type']]);
if (in_array($ruleaction['type'], array('recordevent')))
{
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
}
print '</td>'; print '</td>';
print '<td>'.$ruleaction['actionparam'].'</td>'; print '<td>'.$ruleaction['actionparam'].'</td>';
print '<td class="right">'; // Move up/down
//print $ruleactionobj->getLibStatut(3);
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>';
print '</td>';
print '<td class="center linecolmove tdlineupdown">'; print '<td class="center linecolmove tdlineupdown">';
if ($i > 0) if ($i > 0)
{ {
@ -532,6 +564,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=down&amp;rowid='.$ruleaction['id'].'">'.img_down('default', 0, 'imgdownforline').'</a>'; print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=down&amp;rowid='.$ruleaction['id'].'">'.img_down('default', 0, 'imgdownforline').'</a>';
} }
print '</td>'; print '</td>';
// Delete
print '<td class="right">';
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>';
print '</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }
@ -540,6 +576,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</table>'; print '</table>';
if (! empty($conf->use_javascript_ajax)) { if (! empty($conf->use_javascript_ajax)) {
$urltorefreshaftermove = DOL_URL_ROOT.'/admin/emailcollector_card.php?id='.$id;
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
} }
@ -571,6 +608,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div>' . "\n"; print '</div>' . "\n";
} }
if (! empty($debuginfo))
{
print info_admin($debuginfo);
}
// Select mail models is same action as presend // Select mail models is same action as presend
if (GETPOST('modelselected')) { if (GETPOST('modelselected')) {
$action = 'presend'; $action = 'presend';

View File

@ -304,7 +304,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->emailcollector->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->emailcollector->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -131,11 +131,13 @@ if ($action == 'update')
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity); else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", '0', 'chaine', 0, '', $conf->entity); // If empty, we set to '0' ('000000' is for black) $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $_POST["THEME_ELDY_USE_HOVER"], 'chaine', 0, '', $conf->entity); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
if (GETPOST('THEME_ELDY_USE_CHECKED') == '') dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", '0', 'chaine', 0, '', $conf->entity); $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $_POST["THEME_ELDY_USE_CHECKED"], 'chaine', 0, '', $conf->entity); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"], 'chaine', 0, '', $conf->entity);
@ -239,14 +241,14 @@ if ($action == 'edit') // Edit
print '</tr>'; print '</tr>';
// Default language // Default language
print '<tr><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2); print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Multilingual GUI // Multilingual GUI
print '<tr><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1); print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -265,19 +267,19 @@ if ($action == 'edit') // Edit
print '</tr>'; print '</tr>';
// Disable javascript and ajax // Disable javascript and ajax
print '<tr><td>'.$langs->trans("DisableJavascript").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("DisableJavascript").'</td><td>';
print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1); print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Max size of lists // Max size of lists
print '<tr><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>'; print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Max size of short lists on customer card // Max size of short lists on customer card
print '<tr><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>'; print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -291,28 +293,28 @@ if ($action == 'edit') // Edit
*/ */
// First day for weeks // First day for weeks
print '<tr><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0); print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// DefaultWorkingDays // DefaultWorkingDays
print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5').'">'; print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5').'">';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// DefaultWorkingHours // DefaultWorkingHours
print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18').'">'; print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18').'">';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Firstname/Name // Firstname/Name
print '<tr><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); $array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0)); print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
print '</td>'; print '</td>';
@ -320,14 +322,14 @@ if ($action == 'edit') // Edit
print '</tr>'; print '</tr>';
// Hide unauthorized button // Hide unauthorized button
print '<tr><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1); print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Show logo // Show logo
print '<tr><td class="titlefield">'.$langs->trans("EnableShowLogo").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableShowLogo").'</td><td>';
print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1); print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -344,7 +346,7 @@ if ($action == 'edit') // Edit
*/ */
// Show bugtrack link // Show bugtrack link
print '<tr><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1); print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -352,7 +354,7 @@ if ($action == 'edit') // Edit
// Hide wiki link on login page // Hide wiki link on login page
$pictohelp='<span class="fa fa-question-circle"></span>'; $pictohelp='<span class="fa fa-question-circle"></span>';
print '<tr><td class="titlefield">'.$langs->trans("DisableLinkToHelp", $pictohelp).'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelp", $pictohelp).'</td><td>';
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1); print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@ -362,7 +364,7 @@ if ($action == 'edit') // Edit
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount')); $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
complete_substitutions_array($substitutionarray, $langs); complete_substitutions_array($substitutionarray, $langs);
print '<tr><td class="titlefield">'; print '<tr class="oddeven"><td class="titlefield">';
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach($substitutionarray as $key => $val) foreach($substitutionarray as $key => $val)
{ {
@ -390,7 +392,7 @@ if ($action == 'edit') // Edit
// Message on login page // Message on login page
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user')); $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
complete_substitutions_array($substitutionarray, $langs); complete_substitutions_array($substitutionarray, $langs);
print '<tr><td>'; print '<tr class="oddeven"><td>';
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach($substitutionarray as $key => $val) foreach($substitutionarray as $key => $val)
{ {
@ -403,14 +405,14 @@ if ($action == 'edit') // Edit
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Hide helpcenter link on login page // Hide helpcenter link on login page
print '<tr><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1); print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1);
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Background // Background
print '<tr><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">'; print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
print '<div class="centpercent inline-block">'; print '<div class="centpercent inline-block">';
print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground">'; print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground">';
if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) {

View File

@ -291,7 +291,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -888,7 +888,8 @@ if ($mode == 'marketplace')
{ {
// $options is array with filter criterias // $options is array with filter criterias
//var_dump($options); //var_dump($options);
$dolistore->getRemoteData($options); $dolistore->getRemoteCategories();
$dolistore->getRemoteProducts($options);
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>'; print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';

View File

@ -286,7 +286,8 @@ $configfileparameters=array(
'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"), 'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"),
'?dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)', '?dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)',
'dolibarr_main_data_root' => $langs->trans("DataRootServer"), 'dolibarr_main_data_root' => $langs->trans("DataRootServer"),
'separator1' => '', 'dolibarr_main_instance_unique_id' => $langs->trans("InstanceUniqueID"),
'separator1' => '',
'dolibarr_main_db_host' => $langs->trans("DatabaseServer"), 'dolibarr_main_db_host' => $langs->trans("DatabaseServer"),
'dolibarr_main_db_port' => $langs->trans("DatabasePort"), 'dolibarr_main_db_port' => $langs->trans("DatabasePort"),
'dolibarr_main_db_name' => $langs->trans("DatabaseName"), 'dolibarr_main_db_name' => $langs->trans("DatabaseName"),
@ -391,7 +392,20 @@ foreach($configfileparameters as $key => $value)
++$i; ++$i;
} }
} }
else print ${$newkey}; elseif ($newkey == 'dolibarr_main_instance_unique_id')
{
//print $conf->file->instance_unique_id;
global $dolibarr_main_cookie_cryptkey;
$valuetoshow = ${$newkey} ? ${$newkey} : $dolibarr_main_cookie_cryptkey;
print $valuetoshow;
if (empty($valuetoshow)) {
print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id');
}
}
else
{
print ${$newkey};
}
if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
print "</td>"; print "</td>";
} }

View File

@ -66,7 +66,7 @@ if ($action == 'updateMask') {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "TICKETSUP_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity);
} elseif ($action == 'setvar') { } elseif ($action == 'setvar') {
include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
@ -181,7 +181,7 @@ $page_name = "TicketSetup";
llxHeader('', $langs->trans($page_name), $help_url); llxHeader('', $langs->trans($page_name), $help_url);
// Subheader // Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
@ -256,7 +256,7 @@ foreach ($dirmodels as $reldir) {
print '</td>' . "\n"; print '</td>' . "\n";
print '<td align="center">'; print '<td align="center">';
if ($conf->global->TICKETSUP_ADDON == 'mod_' . $classname) { if ($conf->global->TICKET_ADDON == 'mod_' . $classname) {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} else { } else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&amp;value=mod_' . $classname . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>'; print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&amp;value=mod_' . $classname . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';

View File

@ -66,7 +66,7 @@ $help_url = "FR:Module_Ticket";
$page_name = "TicketSetup"; $page_name = "TicketSetup";
llxHeader('', $langs->trans($page_name), $help_url); llxHeader('', $langs->trans($page_name), $help_url);
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans("TicketSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("TicketSetup"), $linkback, 'title_setup');
$head = ticketAdminPrepareHead(); $head = ticketAdminPrepareHead();

View File

@ -103,7 +103,7 @@ if ($action == 'setvar') {
} }
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha'); $url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
if (!empty($mail_signature)) { if (!empty($url_interface)) {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
@ -113,7 +113,7 @@ if ($action == 'setvar') {
} }
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha'); $topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
if (!empty($mail_signature)) { if (!empty($topic_interface)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
@ -123,7 +123,7 @@ if ($action == 'setvar') {
} }
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha'); $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
if (!empty($mail_signature)) { if (!empty($text_home)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
@ -208,7 +208,7 @@ $page_name = "TicketSetup";
llxHeader('', $langs->trans($page_name), $help_url); llxHeader('', $langs->trans($page_name), $help_url);
// Subheader // Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');

View File

@ -113,7 +113,7 @@ jQuery(document).ready(function() {
print load_fiche_titre($langs->trans("Backup"), '', 'title_setup'); print load_fiche_titre($langs->trans("Backup"), '', 'title_setup');
//print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup'); //print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup');
print '<div class="center">'; print '<div class="center opacitymedium">';
print $langs->trans("BackupDesc", DOL_DATA_ROOT); print $langs->trans("BackupDesc", DOL_DATA_ROOT);
print '</div>'; print '</div>';
print '<br>'; print '<br>';

View File

@ -67,7 +67,7 @@ jQuery(document).ready(function() {
print load_fiche_titre($langs->trans("Restore"), '', 'title_setup'); print load_fiche_titre($langs->trans("Restore"), '', 'title_setup');
print '<div class="center">'; print '<div class="center opacitymedium">';
print $langs->trans("RestoreDesc", DOL_DATA_ROOT); print $langs->trans("RestoreDesc", DOL_DATA_ROOT);
print '</div>'; print '</div>';
print '<br>'; print '<br>';

View File

@ -137,7 +137,7 @@ $form = new Form($db);
$help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:M&oacute;dulo_Usuarios'; $help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:M&oacute;dulo_Usuarios';
llxHeader('', $langs->trans("UsersSetup"), $help_url); llxHeader('', $langs->trans("UsersSetup"), $help_url);
$linkback='<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("UsersSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("UsersSetup"), $linkback, 'title_setup');
@ -183,8 +183,6 @@ print '<br>';
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
$form=new Form($db);
// Defini tableau def des modeles // Defini tableau def des modeles
$def = array(); $def = array();
$sql = "SELECT nom"; $sql = "SELECT nom";

View File

@ -279,7 +279,7 @@ class DolibarrApi
/** /**
* Function to forge a SQL criteria * Function to forge a SQL criteria
* *
* @param array $matches Array of found string by regex search * @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL"
* @return string Forged criteria. Example: "t.field like 'abc%'" * @return string Forged criteria. Example: "t.field like 'abc%'"
*/ */
protected static function _forge_criteria_callback($matches) protected static function _forge_criteria_callback($matches)

View File

@ -117,7 +117,7 @@ if ($object->id)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border tableforfield centpercent">';
// Number of files // Number of files
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';

View File

@ -291,7 +291,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->asset->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->asset->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -299,7 +299,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->bom->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->bom->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array(); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -66,7 +66,7 @@ function bomAdminPrepareHead()
/** /**
* Prepare array of tabs for BillOfMaterials * Prepare array of tabs for BillOfMaterials
* *
* @param BillOfMaterials $object BillOfMaterials * @param BOM $object BillOfMaterials
* @return array Array of tabs * @return array Array of tabs
*/ */
function bomPrepareHead($object) function bomPrepareHead($object)

View File

@ -142,7 +142,11 @@ class Facturation
$this->montantRemise($montant_remise_ht); $this->montantRemise($montant_remise_ht);
$newcartarray=$_SESSION['poscart']; $newcartarray=$_SESSION['poscart'];
$i=count($newcartarray);
$i = 0;
if (!is_null($newcartarray) && !empty($newcartarray)) {
$i=count($newcartarray);
}
$newcartarray[$i]['id']=$i; $newcartarray[$i]['id']=$i;
$newcartarray[$i]['ref']=$product->ref; $newcartarray[$i]['ref']=$product->ref;
@ -281,7 +285,7 @@ class Facturation
* Getter for id * Getter for id
* *
* @param int $aId Id * @param int $aId Id
* @return id * @return int Id
*/ */
public function id($aId = null) public function id($aId = null)
{ {
@ -542,8 +546,8 @@ class Facturation
/** /**
* Get payment date * Get payment date
* *
* @param date $aPaiementLe Date * @param integer $aPaiementLe Date
* @return date Date * @return integer Date
*/ */
public function paiementLe($aPaiementLe = null) public function paiementLe($aPaiementLe = null)
{ {

View File

@ -983,19 +983,43 @@ class Categorie extends CommonObject
* fulllabel = nom avec chemin complet de la categorie * fulllabel = nom avec chemin complet de la categorie
* fullpath = chemin complet compose des id * fullpath = chemin complet compose des id
* *
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...). * @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree. * @param int|string|array $markafterid Keep only or removed all categories including the leaf $markafterid in category tree (exclude) or Keep only of category is inside the leaf starting with this id.
* @param int $keeponlyifinleafid Keep only of category is inside the leaf starting with this id. * $markafterid can be an :
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error * - int (id of category)
* - string (categories ids seprated by comma)
* - array (list of categories ids)
* @param int $include [=0] Removed or 1=Keep only
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
*/ */
public function get_full_arbo($type, $markafterid = 0, $keeponlyifinleafid = 0) public function get_full_arbo($type, $markafterid = 0, $include = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
if (! is_numeric($type)) $type = $this->MAP_ID[$type]; if (! is_numeric($type)) $type = $this->MAP_ID[$type];
$this->cats = array(); if (is_string($markafterid))
{
$markafterid = explode(',', $markafterid);
}
elseif (is_numeric($markafterid))
{
if ($markafterid > 0)
{
$markafterid = array($markafterid);
}
else
{
$markafterid = array();
}
}
elseif (!is_array($markafterid))
{
$markafterid = array();
}
$this->cats = array();
// Init this->motherof that is array(id_son=>id_parent, ...) // Init this->motherof that is array(id_son=>id_parent, ...)
$this->load_motherof(); $this->load_motherof();
@ -1040,39 +1064,22 @@ class Categorie extends CommonObject
$this->build_path_from_id_categ($key, 0); // Process a branch from the root category key (this category has no parent) $this->build_path_from_id_categ($key, 0); // Process a branch from the root category key (this category has no parent)
} }
// Exclude leaf including $markafterid from tree // Include or exclude leaf including $markafterid from tree
if ($markafterid) if (count($markafterid) > 0)
{ {
$keyfiltercatid = implode('|', $markafterid);
//print "Look to discard category ".$markafterid."\n"; //print "Look to discard category ".$markafterid."\n";
$keyfilter1='^'.$markafterid.'$'; $keyfilter1 = '^' . $keyfiltercatid . '$';
$keyfilter2='_'.$markafterid.'$'; $keyfilter2 = '_' . $keyfiltercatid . '$';
$keyfilter3='^'.$markafterid.'_'; $keyfilter3 = '^' . $keyfiltercatid . '_';
$keyfilter4='_'.$markafterid.'_'; $keyfilter4 = '_' . $keyfiltercatid . '_';
foreach($this->cats as $key => $val) foreach($this->cats as $key => $val)
{ {
if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) $test = (preg_match('/' . $keyfilter1 . '/', $val['fullpath']) || preg_match('/' . $keyfilter2 . '/', $val['fullpath'])
|| preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])) || preg_match('/' . $keyfilter3 . '/', $val['fullpath']) || preg_match('/' . $keyfilter4 . '/', $val['fullpath']));
{
unset($this->cats[$key]); if (($test && !$include) || (!$test && $include))
}
}
}
// Exclude leaf including $markafterid from tree
if ($keeponlyifinleafid)
{
//print "Look to discard category ".$keeponlyifinleafid."\n";
$keyfilter1='^'.$keeponlyifinleafid.'$';
$keyfilter2='_'.$keeponlyifinleafid.'$';
$keyfilter3='^'.$keeponlyifinleafid.'_';
$keyfilter4='_'.$keeponlyifinleafid.'_';
foreach($this->cats as $key => $val)
{
if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath'])
|| preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath']))
{
// We keep
}
else
{ {
unset($this->cats[$key]); unset($this->cats[$key]);
} }

View File

@ -33,10 +33,7 @@ $langs->loadLangs(array("admin","other","website"));
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
if (! ((GETPOST('testmenuhider', 'int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) $conf->dol_hide_leftmenu = 1; // Force hide of left menu.
{
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
}
$error=0; $error=0;
$website=GETPOST('website', 'alpha'); $website=GETPOST('website', 'alpha');

View File

@ -668,7 +668,7 @@ class Mailing extends CommonObject
* *
* @param int $statut Id statut * @param int $statut Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param strin $desc Desc error * @param string $desc Desc error
* @return string Label * @return string Label
*/ */
public static function libStatutDest($statut, $mode = 0, $desc = '') public static function libStatutDest($statut, $mode = 0, $desc = '')

View File

@ -623,7 +623,7 @@ if (empty($reshook))
{ {
$db->begin(); $db->begin();
$result=$object->cloture($user, 4, ''); $result=$object->cloture($user, Propal::STATUS_BILLED, '');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -155,7 +155,7 @@ if ($object->id > 0)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
// Files infos // Files infos
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td>'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td>'.count($filearray).'</td></tr>';

View File

@ -430,7 +430,7 @@ if ($resql)
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->propal->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if ($user->rights->propal->cloturer) $arrayofmassactions['closed']=$langs->trans("Close"); if ($user->rights->propal->cloturer) $arrayofmassactions['closed']=$langs->trans("Close");
if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -161,7 +161,7 @@ class Commande extends CommonOrder
/** /**
* @deprecated * @deprecated
* @see date * @see $date
*/ */
public $date_commande; public $date_commande;
@ -1075,7 +1075,7 @@ class Commande extends CommonOrder
*/ */
public function createFromClone($socid = 0) public function createFromClone($socid = 0)
{ {
global $user,$hookmanager; global $conf, $user,$hookmanager;
$error=0; $error=0;
@ -1085,69 +1085,88 @@ class Commande extends CommonOrder
foreach($this->lines as $line) foreach($this->lines as $line)
$line->fetch_optionals(); $line->fetch_optionals();
// Load source object // Load source object
$objFrom = clone $this; $objFrom = clone $this;
// Change socid if needed // Change socid if needed
if (! empty($socid) && $socid != $this->socid) if (! empty($socid) && $socid != $this->socid)
{
$objsoc = new Societe($this->db);
if ($objsoc->fetch($socid)>0)
{ {
$objsoc = new Societe($this->db); $this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
if ($objsoc->fetch($socid)>0) $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
{ $this->fk_project = 0;
$this->socid = $objsoc->id; $this->fk_delivery_address = 0;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = 0;
$this->fk_delivery_address = 0;
}
// TODO Change product price if multi-prices
} }
$this->id=0; // TODO Change product price if multi-prices
$this->ref = ''; }
$this->statut=self::STATUS_DRAFT;
// Clear fields $this->id=0;
$this->user_author_id = $user->id; $this->ref = '';
$this->user_valid = ''; $this->statut=self::STATUS_DRAFT;
$this->date = dol_now();
$this->date_commande = dol_now();
$this->date_creation = '';
$this->date_validation = '';
$this->ref_client = '';
// Create clone // Clear fields
$this->context['createfromclone'] = 'createfromclone'; $this->user_author_id = $user->id;
$result=$this->create($user); $this->user_valid = '';
if ($result < 0) $error++; $this->date = dol_now();
$this->date_commande = dol_now();
$this->date_creation = '';
$this->date_validation = '';
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = '';
if (! $error) // Create clone
$this->context['createfromclone'] = 'createfromclone';
$result=$this->create($user);
if ($result < 0) $error++;
if (! $error)
{
// copy internal contacts
if ($this->copy_linked_contact($objFrom, 'internal') < 0)
{ {
// Hook of thirdparty module $error++;
if (is_object($hookmanager))
{
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
} }
}
unset($this->context['createfromclone']); if (! $error)
{
// copy external contacts if same company
if ($this->socid == $objFrom->socid)
{
if ($this->copy_linked_contact($objFrom, 'external') < 0)
$error++;
}
}
// End if (! $error)
if (! $error) {
// Hook of thirdparty module
if (is_object($hookmanager))
{ {
$this->db->commit(); $parameters=array('objFrom'=>$objFrom);
return $this->id; $action='';
} $reshook=$hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
else if ($reshook < 0) $error++;
{
$this->db->rollback();
return -1;
} }
}
unset($this->context['createfromclone']);
// End
if (! $error)
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -1;
}
} }
@ -1312,7 +1331,7 @@ class Commande extends CommonOrder
* @param double $pu_ht_devise Unit price in currency * @param double $pu_ht_devise Unit price in currency
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* *
* @see add_product * @see add_product()
* *
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
@ -3886,7 +3905,7 @@ class OrderLine extends CommonOrderLine
* Id of parent order * Id of parent order
* @var int * @var int
* @deprecated Use fk_commande * @deprecated Use fk_commande
* @see fk_commande * @see $fk_commande
*/ */
public $commande_id; public $commande_id;
@ -3913,7 +3932,7 @@ class OrderLine extends CommonOrderLine
/** /**
* @deprecated * @deprecated
* @see remise_percent, fk_remise_except * @see $remise_percent, $fk_remise_except
*/ */
public $remise; public $remise;

View File

@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';

View File

@ -434,7 +434,7 @@ if ($resql)
); );
if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->commande->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->commande->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@ -497,12 +497,12 @@ if ($resql)
print '<td>'; print '<td>';
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{ {
print $form->selectyesno('valdate_invoices', 0, 1, 1); print $form->selectyesno('validate_invoices', 0, 1, 1);
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
} }
else else
{ {
print $form->selectyesno('valdate_invoices', 0, 1); print $form->selectyesno('validate_invoices', 0, 1);
} }
if (! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").'</span>'; if (! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").'</span>';
else print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("OptionToSetOrderBilledNotEnabled").'</span>'; else print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("OptionToSetOrderBilledNotEnabled").'</span>';

View File

@ -282,7 +282,7 @@ if ($mode == 'customer')
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled") Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled")
); );
print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4); print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'int'), -4);
} }
if ($mode == 'supplier') if ($mode == 'supplier')
{ {

View File

@ -564,7 +564,7 @@ if ($resql)
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
//if ($user->rights->bank->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); //if ($user->rights->bank->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -639,11 +639,12 @@ else
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>'; print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td>'; print '<td>';
$accountingjournal = new AccountingJournal($db); if ($object->fk_accountancy_journal > 0) {
$accountingjournal->fetch($object->fk_accountancy_journal); $accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($object->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
}
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) {
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>'; print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>';
print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' .dol_print_size($totalsize, 1, 1).'</td></tr>'; print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' .dol_print_size($totalsize, 1, 1).'</td></tr>';
print "</table>\n"; print "</table>\n";

View File

@ -220,7 +220,7 @@ $arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"), // 'presend'=>$langs->trans("SendByMail"),
// 'builddoc'=>$langs->trans("PDFMerge"), // 'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->banque->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->banque->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@ -407,18 +407,17 @@ foreach ($accounts as $key=>$type)
$found++; $found++;
$obj = new Account($db); $result = $objecttmp->fetch($key);
$obj->fetch($key);
$solde = $obj->solde(1); $solde = $objecttmp->solde(1);
if (! empty($lastcurrencycode) && $lastcurrencycode != $obj->currency_code) if (! empty($lastcurrencycode) && $lastcurrencycode != $objecttmp->currency_code)
{ {
$lastcurrencycode='various'; // We found several different currencies $lastcurrencycode='various'; // We found several different currencies
} }
if ($lastcurrencycode != 'various') if ($lastcurrencycode != 'various')
{ {
$lastcurrencycode=$obj->currency_code; $lastcurrencycode=$objecttmp->currency_code;
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -426,14 +425,14 @@ foreach ($accounts as $key=>$type)
// Ref // Ref
if (! empty($arrayfields['b.ref']['checked'])) if (! empty($arrayfields['b.ref']['checked']))
{ {
print '<td class="nowrap">'.$obj->getNomUrl(1).'</td>'; print '<td class="nowrap">'.$objecttmp->getNomUrl(1).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Label // Label
if (! empty($arrayfields['b.label']['checked'])) if (! empty($arrayfields['b.label']['checked']))
{ {
print '<td>'.$obj->label.'</td>'; print '<td>'.$objecttmp->label.'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -441,7 +440,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['accountype']['checked'])) if (! empty($arrayfields['accountype']['checked']))
{ {
print '<td>'; print '<td>';
print $obj->type_lib[$obj->type]; print $objecttmp->type_lib[$objecttmp->type];
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -449,7 +448,7 @@ foreach ($accounts as $key=>$type)
// Number // Number
if (! empty($arrayfields['b.number']['checked'])) if (! empty($arrayfields['b.number']['checked']))
{ {
print '<td>'.$obj->number.'</td>'; print '<td>'.$objecttmp->number.'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -460,12 +459,12 @@ foreach ($accounts as $key=>$type)
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $obj->account_number, 1); $accountingaccount->fetch('', $objecttmp->account_number, 1);
print $accountingaccount->getNomUrl(0, 1, 1, '', 1); print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
} }
else else
{ {
print $obj->account_number; print $objecttmp->account_number;
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
@ -478,7 +477,7 @@ foreach ($accounts as $key=>$type)
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($obj->fk_accountancy_journal); $accountingjournal->fetch($objecttmp->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1); print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
} }
else else
@ -493,7 +492,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['b.currency_code']['checked'])) if (! empty($arrayfields['b.currency_code']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print $obj->currency_code; print $objecttmp->currency_code;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -502,11 +501,11 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['toreconcile']['checked'])) if (! empty($arrayfields['toreconcile']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
if ($obj->rappro) if ($objecttmp->rappro)
{ {
$result=$obj->load_board($user, $obj->id); $result=$objecttmp->load_board($user, $objecttmp->id);
if ($result<0) { if ($result<0) {
setEventMessages($obj->error, $obj->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else { } else {
print $result->nbtodo; print $result->nbtodo;
if ($result->nbtodolate) print ' &nbsp; ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; if ($result->nbtodolate) print ' &nbsp; ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
@ -520,14 +519,14 @@ foreach ($accounts as $key=>$type)
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook // Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
if (! empty($arrayfields['b.datec']['checked'])) if (! empty($arrayfields['b.datec']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print dol_print_date($obj->date_creation, 'dayhour'); print dol_print_date($objecttmp->date_creation, 'dayhour');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -535,7 +534,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['b.tms']['checked'])) if (! empty($arrayfields['b.tms']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
print dol_print_date($obj->date_update, 'dayhour'); print dol_print_date($objecttmp->date_update, 'dayhour');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -543,7 +542,7 @@ foreach ($accounts as $key=>$type)
// Status // Status
if (! empty($arrayfields['b.clos']['checked'])) if (! empty($arrayfields['b.clos']['checked']))
{ {
print '<td class="center">'.$obj->getLibStatut(5).'</td>'; print '<td class="center">'.$objecttmp->getLibStatut(5).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -551,7 +550,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['balance']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).'</a>'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield']; if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
@ -563,15 +562,15 @@ foreach ($accounts as $key=>$type)
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{ {
$selected=0; $selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1; if (in_array($objecttmp->id, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; print '<input id="cb'.$objecttmp->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objecttmp->id.'"'.($selected?' checked="checked"':'').'>';
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
print '</tr>'; print '</tr>';
$total[$obj->currency_code] += $solde; $total[$objecttmp->currency_code] += $solde;
$i++; $i++;
} }

View File

@ -131,7 +131,7 @@ if ($object->id)
$totalsize+=$file['size']; $totalsize+=$file['size'];
} }
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';

View File

@ -320,7 +320,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -100,7 +100,7 @@ if ($object->id)
} }
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';

View File

@ -1391,7 +1391,7 @@ if (empty($reshook))
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle); $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
if ($object->situation_counter == 1) $lines[$i]->situation_percent = 0; if ($object->situation_counter == 1) $lines[$i]->situation_percent = 0;
if ($lines[$i]->subprice < 0) if ($lines[$i]->subprice < 0 && empty($conf->global->INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN))
{ {
// Negative line, we create a discount line // Negative line, we create a discount line
$discount = new DiscountAbsolute($db); $discount = new DiscountAbsolute($db);
@ -2588,22 +2588,47 @@ if ($action == 'create')
if (empty($socid)) if (empty($socid))
$soc = $objectsrc->thirdparty; $soc = $objectsrc->thirdparty;
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:0)); $dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice);
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice);
if (!empty($conf->multicurrency->enabled)) if ($element == 'expedition') {
{ $ref_client = (! empty($objectsrc->ref_customer)?$objectsrc->ref_customer:'');
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; $elem = $subelem = $objectsrc->origin;
$expeoriginid = $objectsrc->origin_id;
dol_include_once('/'.$elem.'/class/'.$subelem.'.class.php');
$classname = ucfirst($subelem);
$expesrc = new $classname($db);
$expesrc->fetch($expeoriginid);
$cond_reglement_id = (! empty($expesrc->cond_reglement_id)?$expesrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$mode_reglement_id = (! empty($expesrc->mode_reglement_id)?$expesrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$fk_account = (! empty($expesrc->fk_account)?$expesrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
$remise_percent = (! empty($expesrc->remise_percent)?$expesrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($expesrc->remise_absolue)?$expesrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
//Replicate extrafields
$expesrc->fetch_optionals($expeoriginid);
$object->array_options=$expesrc->array_options;
} }
else
{
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:0));
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
// Replicate extrafields if (!empty($conf->multicurrency->enabled))
$objectsrc->fetch_optionals($originid); {
$object->array_options = $objectsrc->array_options; if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
}
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options = $objectsrc->array_options;
}
} }
} }
else else
@ -4280,7 +4305,7 @@ elseif ($id > 0 || ! empty($ref))
print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits');
else else
print $langs->trans('AlreadyPaid'); print $langs->trans('AlreadyPaid');
print ' :</td><td class="right"'.(($totalpaye > 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . '</td><td>&nbsp;</td></tr>'; print ' :</td><td class="right'.(($totalpaye > 0)?' amountalreadypaid':'').'">' . price($totalpaye) . '</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = $resteapayer; $resteapayeraffiche = $resteapayer;
$cssforamountpaymentcomplete = 'amountpaymentcomplete'; $cssforamountpaymentcomplete = 'amountpaymentcomplete';
@ -4359,14 +4384,13 @@ elseif ($id > 0 || ! empty($ref))
// Billed // Billed
print '<tr><td colspan="' . $nbcols . '" class="right">' . $langs->trans("Billed") . ' :</td><td class="right">' . price($object->total_ttc) . '</td><td>&nbsp;</td></tr>'; print '<tr><td colspan="' . $nbcols . '" class="right">' . $langs->trans("Billed") . ' :</td><td class="right">' . price($object->total_ttc) . '</td><td>&nbsp;</td></tr>';
// Remainder to pay // Remainder to pay
print '<tr><td colspan="' . $nbcols . '" class="right">'; print '<tr><td colspan="' . $nbcols . '" class="right">';
print $langs->trans('RemainderToPay'); print $langs->trans('RemainderToPay');
if ($resteapayeraffiche < 0) if ($resteapayeraffiche < 0)
print ' ('.$langs->trans('ExcessReceived').')'; print ' ('.$langs->trans('ExcessReceived').')';
print ' :</td>'; print ' :</td>';
print '<td class="right"'.($resteapayeraffiche?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>' . price($resteapayeraffiche) . '</td>'; print '<td class="right'.($resteapayeraffiche?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">' . price($resteapayeraffiche) . '</td>';
print '<td class="nowrap">&nbsp;</td></tr>'; print '<td class="nowrap">&nbsp;</td></tr>';
} }
else // Credit note else // Credit note
@ -4387,7 +4411,7 @@ elseif ($id > 0 || ! empty($ref))
if ($resteapayeraffiche > 0) if ($resteapayeraffiche > 0)
print ' ('.$langs->trans('ExcessPaid').')'; print ' ('.$langs->trans('ExcessPaid').')';
print ' :</td>'; print ' :</td>';
print '<td class="right"'.($resteapayeraffiche?' class="amountremaintopayback"':(' class="'.$cssforamountpaymentcomplete.'"')).'>' . price($sign * $resteapayeraffiche) . '</td>'; print '<td class="right'.($resteapayeraffiche?' amountremaintopayback':(' '.$cssforamountpaymentcomplete)).'">' . price($sign * $resteapayeraffiche) . '</td>';
print '<td class="nowrap">&nbsp;</td></tr>'; print '<td class="nowrap">&nbsp;</td></tr>';
// Sold credit note // Sold credit note

View File

@ -936,7 +936,7 @@ class Invoices extends DolibarrApi
*/ */
public function markAsCreditAvailable($id) public function markAsCreditAvailable($id)
{ {
if(! DolibarrApiAccess::$user->rights->facture->creer) { if( ! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -949,89 +949,145 @@ class Invoices extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$result = $this->invoice->fetch_thirdparty(); if ($this->invoice->paye) {
if( ! $result ) { throw new RestException(500, 'Alreay payed');
throw new RestException(404, 'Thirdparty not found');
} }
if (! $this->invoice->paye) // protection against multiple submit $this->invoice->fetch($id);
{ $this->invoice->fetch_thirdparty();
$this->db->begin();
$this->invoice->fetch_lines(); // Check if there is already a discount (protection to avoid duplicate creation when resubmit post)
$discountcheck=new DiscountAbsolute($this->db);
$result=$discountcheck->fetch(0, $this->invoice->id);
$amount_ht = $amount_tva = $amount_ttc = array(); $canconvert=0;
if ($this->invoice->type == Facture::TYPE_DEPOSIT && empty($discountcheck->id)) $canconvert=1; // we can convert deposit into discount if deposit is payed (completely, partially or not at all) and not already converted (see real condition into condition used to show button converttoreduc)
if (($this->invoice->type == Facture::TYPE_CREDIT_NOTE || $this->invoice->type == Facture::TYPE_STANDARD) && $this->invoice->paye == 0 && empty($discountcheck->id)) $canconvert=1; // we can convert credit note into discount if credit note is not payed back and not already converted and amount of payment is 0 (see real condition into condition used to show button converttoreduc)
if ($canconvert)
{
$this->db->begin();
// Loop on each vat rate $amount_ht = $amount_tva = $amount_ttc = array();
$i=0; $multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
$amount_ht = array();
$amount_tva = array();
$amount_ttc = array();
foreach($this->invoice->lines as $line)
{
$amount_ht[$line->tva_tx]+=$line->total_ht;
$amount_tva[$line->tva_tx]+=$line->total_tva;
$amount_ttc[$line->tva_tx]+=$line->total_ttc;
$i++;
}
// Insert one discount by VAT rate category // Loop on each vat rate
$discount = new DiscountAbsolute($this->db); $i = 0;
if ($this->invoice->type == 2) $discount->description='(CREDIT_NOTE)'; foreach ($this->invoice->lines as $line)
elseif ($this->invoice->type == 3) $discount->description='(DEPOSIT)'; {
else { if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9
$this->error="CantConvertToReducAnInvoiceOfThisType"; { // no need to create discount if amount is null
return -1; $amount_ht[$line->tva_tx] += $line->total_ht;
} $amount_tva[$line->tva_tx] += $line->total_tva;
$discount->tva_tx=abs($this->invoice->total_ttc); $amount_ttc[$line->tva_tx] += $line->total_ttc;
$discount->fk_soc=$this->invoice->socid; $multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
$discount->fk_facture_source=$this->invoice->id; $multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
$i++;
}
}
$error=0; // Insert one discount by VAT rate category
foreach($amount_ht as $tva_tx => $xxx) $discount = new DiscountAbsolute($this->db);
{ if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) {
$discount->amount_ht=abs($amount_ht[$tva_tx]); $discount->description = '(CREDIT_NOTE)';
$discount->amount_tva=abs($amount_tva[$tva_tx]); }
$discount->amount_ttc=abs($amount_ttc[$tva_tx]); elseif ($this->invoice->type == Facture::TYPE_DEPOSIT) {
$discount->tva_tx=abs($tva_tx); $discount->description = '(DEPOSIT)';
}
elseif ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION) {
$discount->description = '(EXCESS RECEIVED)';
}
else {
throw new RestException(500, 'Cant convert to reduc an Invoice of this type');
}
$result=$discount->create(DolibarrApiAccess::$user); $discount->fk_soc = $this->invoice->socid;
if ($result < 0) $discount->fk_facture_source = $this->invoice->id;
{
$error++;
break;
}
}
if (! $error) $error = 0;
{
// Classe facture
$result=$this->invoice->set_paid(DolibarrApiAccess::$user);
if ($result > 0)
{
//$mesg='OK'.$discount->id;
$this->db->commit();
}
else
{
$this->db->rollback();
throw new RestException(500, 'Could not set paid');
}
}
else
{
$this->db->rollback();
throw new RestException(500, 'Discount creation error');
}
}
$result = $this->invoice->fetch($id); if ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION)
if( ! $result ) { {
throw new RestException(404, 'Invoice not found'); // If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
}
if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) { // Total payments
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); $sql = 'SELECT SUM(pf.amount) as total_paiements';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
$sql.= ' WHERE pf.fk_facture = '.$this->invoice->id;
$sql.= ' AND pf.fk_paiement = p.rowid';
$sql.= ' AND p.entity IN ('.getEntity('invoice').')';
$resql = $this->db->query($sql);
if (! $resql) dol_print_error($this->db);
$res = $this->db->fetch_object($resql);
$total_paiements = $res->total_paiements;
// Total credit note and deposit
$total_creditnote_and_deposit = 0;
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
$sql .= " re.description, re.fk_facture_source";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
$sql .= " WHERE fk_facture = " . $this->invoice->id;
$resql = $this->db->query($sql);
if (!empty($resql)) {
while ($obj = $this->db->fetch_object($resql)) $total_creditnote_and_deposit += $obj->amount_ttc;
} else dol_print_error($this->db);
$discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $this->invoice->total_ttc;
$discount->amount_tva = 0;
$discount->tva_tx = 0;
$result = $discount->create(DolibarrApiAccess::$user);
if ($result < 0)
{
$error++;
}
}
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE || $this->invoice->type == Facture::TYPE_DEPOSIT)
{
foreach ($amount_ht as $tva_tx => $xxx)
{
$discount->amount_ht = abs($amount_ht[$tva_tx]);
$discount->amount_tva = abs($amount_tva[$tva_tx]);
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
$discount->tva_tx = abs($tva_tx);
$result = $discount->create(DolibarrApiAccess::$user);
if ($result < 0)
{
$error++;
break;
}
}
}
if (empty($error))
{
if($this->invoice->type != Facture::TYPE_DEPOSIT) {
// Classe facture
$result = $this->invoice->set_paid(DolibarrApiAccess::$user);
if ($result >= 0)
{
$this->db->commit();
}
else
{
$this->db->rollback();
throw new RestException(500, 'Could not set paid');
}
} else {
$this->db->commit();
}
}
else
{
$this->db->rollback();
throw new RestException(500, 'Discount creation error');
}
} }
return $this->_cleanObjectDatas($this->invoice); return $this->_cleanObjectDatas($this->invoice);

View File

@ -165,7 +165,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';

View File

@ -1305,7 +1305,7 @@ else
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer) if ($action != 'editconditions' && $user->rights->facture->creer)
print '<td class="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>'; print '<td class="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -1329,7 +1329,7 @@ else
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer) if ($action != 'editmode' && $user->rights->facture->creer)
print '<td class="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&amp;facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>'; print '<td class="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&amp;facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -1463,7 +1463,7 @@ else
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Frequency'); print $langs->trans('Frequency');
print '</td>'; print '</td>';
if ($action != 'editfrequency' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer) if ($action != 'editfrequency' && $user->rights->facture->creer)
print '<td class="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&amp;facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>'; print '<td class="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&amp;facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';

View File

@ -82,6 +82,7 @@ $search_montant_localtax2=GETPOST('search_montant_localtax2', 'alpha');
$search_montant_ttc=GETPOST('search_montant_ttc', 'alpha'); $search_montant_ttc=GETPOST('search_montant_ttc', 'alpha');
$search_status=GETPOST('search_status', 'intcomma'); $search_status=GETPOST('search_status', 'intcomma');
$search_paymentmode=GETPOST('search_paymentmode', 'int'); $search_paymentmode=GETPOST('search_paymentmode', 'int');
$search_paymentterms=GETPOST('search_paymentterms', 'int');
$search_town=GETPOST('search_town', 'alpha'); $search_town=GETPOST('search_town', 'alpha');
$search_zip=GETPOST('search_zip', 'alpha'); $search_zip=GETPOST('search_zip', 'alpha');
$search_state=trim(GETPOST("search_state")); $search_state=trim(GETPOST("search_state"));
@ -162,6 +163,7 @@ $arrayfields=array(
'country.code_iso'=>array('label'=>"Country", 'checked'=>0), 'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1), 'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1),
'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1),
'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), 'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0), 'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1")), 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1")),
@ -214,6 +216,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_montant_ttc=''; $search_montant_ttc='';
$search_status=''; $search_status='';
$search_paymentmode=''; $search_paymentmode='';
$search_paymentterms='';
$search_town=''; $search_town='';
$search_zip=""; $search_zip="";
$search_state=""; $search_state="";
@ -359,7 +362,7 @@ $thirdpartystatic=new Societe($db);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.paye as paye, f.fk_statut,';
@ -451,6 +454,7 @@ if ($search_status != '-1' && $search_status != '')
} }
} }
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms);
$sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year); $sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year);
$sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim); $sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim);
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
@ -468,7 +472,7 @@ $sql.=$hookmanager->resPrint;
if (! $sall) if (! $sall)
{ {
$sql.= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,'; $sql.= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total, f.tva, f.total_ttc,';
$sql.= ' f.localtax1, f.localtax2,'; $sql.= ' f.localtax1, f.localtax2,';
$sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.paye, f.fk_statut,';
@ -562,6 +566,7 @@ if ($resql)
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_status != '') $param.='&search_status='.urlencode($search_status);
if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode);
if ($search_paymentterms > 0) $param.='&search_paymentterms='.urlencode($search_paymentterms);
if ($show_files) $param.='&show_files='.urlencode($show_files); if ($show_files) $param.='&show_files='.urlencode($show_files);
if ($option) $param.="&search_option=".urlencode($option); if ($option) $param.="&search_option=".urlencode($option);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
@ -776,6 +781,13 @@ if ($resql)
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10); $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10);
print '</td>'; print '</td>';
} }
// Payment terms
if (! empty($arrayfields['f.fk_cond_reglement']['checked']))
{
print '<td class="liste_titre" align="left">';
$form->select_conditions_paiements($search_paymentterms, 'search_paymentterms', -1, 1, 1);
print '</td>';
}
if (! empty($arrayfields['f.total_ht']['checked'])) if (! empty($arrayfields['f.total_ht']['checked']))
{ {
// Amount // Amount
@ -869,6 +881,7 @@ if ($resql)
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_cond_reglement", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder);
@ -1081,6 +1094,15 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Payment terms
if (! empty($arrayfields['f.fk_cond_reglement']['checked']))
{
print '<td>';
$form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Amount HT // Amount HT
if (! empty($arrayfields['f.total_ht']['checked'])) if (! empty($arrayfields['f.total_ht']['checked']))
{ {

View File

@ -773,7 +773,7 @@ class RemiseCheque extends CommonObject
* Reopen linked invoices and create a new negative payment. * Reopen linked invoices and create a new negative payment.
* *
* @param int $bank_id Id of bank transaction line concerned * @param int $bank_id Id of bank transaction line concerned
* @param date $rejection_date Date to use on the negative payment * @param integer $rejection_date Date to use on the negative payment
* @return int Id of negative payment line created * @return int Id of negative payment line created
*/ */
public function rejectCheck($bank_id, $rejection_date) public function rejectCheck($bank_id, $rejection_date)

View File

@ -58,13 +58,13 @@ class Paiement extends CommonObject
/** /**
* @deprecated * @deprecated
* @see amount, amounts * @see $amount, $amounts
*/ */
public $total; public $total;
/** /**
* @deprecated * @deprecated
* @see amount, amounts * @see $amount, $amounts
*/ */
public $montant; public $montant;

View File

@ -26,7 +26,7 @@
/** /**
* \file htdocs/compta/paiement/list.php * \file htdocs/compta/paiement/list.php
* \ingroup compta * \ingroup compta
* \brief Page liste des paiements des factures clients * \brief Payment page for customer invoices
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -37,9 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('bills', 'compta', 'companies')); $langs->loadLangs(array('bills', 'banks', 'compta', 'companies'));
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
// Security check
$facid = GETPOST('facid', 'int'); $facid = GETPOST('facid', 'int');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$userid = GETPOST('userid', 'int'); $userid = GETPOST('userid', 'int');
@ -47,6 +50,7 @@ $day = GETPOST('day', 'int');
$month = GETPOST('month', 'int'); $month = GETPOST('month', 'int');
$year = GETPOST('year', 'int'); $year = GETPOST('year', 'int');
// Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $facid, ''); $result = restrictedArea($user, 'facture', $facid, '');
@ -83,7 +87,7 @@ $arrayfields=array();
* Actions * Actions
*/ */
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{ {
$search_ref=""; $search_ref="";
$search_account=""; $search_account="";
@ -94,22 +98,22 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$day=''; $day='';
$year=''; $year='';
$month=''; $month='';
$search_array_options=array();
} }
/* /*
* View * View
*/ */
llxHeader('', $langs->trans('ListPayment'));
$form=new Form($db); $form=new Form($db);
$formother=new FormOther($db); $formother=new FormOther($db);
if (GETPOST("orphelins")) llxHeader('', $langs->trans('ListPayment'));
if (GETPOST("orphelins", "alpha"))
{ {
// Paiements lies a aucune facture (pour aide au diagnostic) // Payments not linked to an invoice. Should not happend. For debug only.
$sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,";
$sql.= " p.statut, p.num_paiement,"; $sql.= " p.statut, p.num_paiement,";
$sql.= " c.code as paiement_code"; $sql.= " c.code as paiement_code";
@ -197,7 +201,6 @@ $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0;
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
@ -213,6 +216,7 @@ if ($resql)
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
@ -228,18 +232,18 @@ if ($resql)
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">'; print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">'; print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
$formother->select_year($year?$year:-1, 'year', 1, 20, 5); $formother->select_year($year?$year:-1, 'year', 1, 20, 5);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">'; print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1); $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">'; print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
print '</td>'; print '</td>';
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
@ -264,7 +268,7 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.libelle", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.libelle", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder);
@ -283,6 +287,8 @@ if ($resql)
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$i = 0;
$totalarray=array();
while ($i < min($num, $limit)) while ($i < min($num, $limit))
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
@ -290,35 +296,39 @@ if ($resql)
$paymentstatic->id=$objp->rowid; $paymentstatic->id=$objp->rowid;
$paymentstatic->ref=$objp->ref; $paymentstatic->ref=$objp->ref;
$companystatic->id=$objp->socid;
$companystatic->name=$objp->name;
$companystatic->email=$objp->email;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $paymentstatic->getNomUrl(1); print $paymentstatic->getNomUrl(1);
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
// Date // Date
$dateformatforpayment = 'day'; $dateformatforpayment = 'day';
if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour'; if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour';
print '<td align="center">'.dol_print_date($db->jdate($objp->dp), $dateformatforpayment).'</td>'; print '<td align="center">'.dol_print_date($db->jdate($objp->dp), $dateformatforpayment).'</td>';
if (! $i) $totalarray['nbfield']++;
// Thirdparty // Thirdparty
print '<td>'; print '<td>';
if ($objp->socid > 0) if ($objp->socid > 0)
{ {
$companystatic->id=$objp->socid;
$companystatic->name=$objp->name;
$companystatic->email=$objp->email;
print $companystatic->getNomUrl(1, '', 24); print $companystatic->getNomUrl(1, '', 24);
} }
else print '&nbsp;';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
// Type // Type
print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).'</td>'; print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).'</td>';
if (! $i) $totalarray['nbfield']++;
// Payment number // Payment number
print '<td>'.$objp->num_paiement.'</td>'; print '<td>'.$objp->num_paiement.'</td>';
if (! $i) $totalarray['nbfield']++;
// Account // Account
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
@ -338,11 +348,15 @@ if ($resql)
print $accountstatic->getNomUrl(1); print $accountstatic->getNomUrl(1);
} }
else print '&nbsp;';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
} }
// Amount // Amount
print '<td class="right">'.price($objp->amount).'</td>'; print '<td class="right">'.price($objp->amount).'</td>';
if (! $i) $totalarray['nbfield']++;
$totalarray['pos'][7]='amount';
$totalarray['val']['amount'] += $objp->amount;
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{ {
@ -351,13 +365,39 @@ if ($resql)
print $paymentstatic->LibStatut($objp->statut, 5); print $paymentstatic->LibStatut($objp->statut, 5);
if ($objp->statut == 0) print '</a>'; if ($objp->statut == 0) print '</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
} }
print '<td>&nbsp;</td>'; print '<td></td>';
print '</tr>'; if (! $i) $totalarray['nbfield']++;
print '</tr>';
$i++; $i++;
} }
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
print "</table>\n"; print "</table>\n";
print "</div>"; print "</div>";
print "</form>\n"; print "</form>\n";

View File

@ -1592,6 +1592,9 @@ class BonPrelevement extends CommonObject
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$CrLf = "\n"; $CrLf = "\n";
$Rowing = sprintf("%06d", $row_idfac); $Rowing = sprintf("%06d", $row_idfac);

View File

@ -114,7 +114,7 @@ if ($object->id)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
print '</table>'; print '</table>';

View File

@ -121,7 +121,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
$result=$object->delete($user); $result=$object->delete($user);
if ($result > 0) if ($result > 0)
{ {
header("Location: index.php"); header("Location: list.php");
exit; exit;
} }
else else
@ -665,7 +665,7 @@ if ($id > 0)
$cssforamountpaymentcomplete = 'amountpaymentcomplete'; $cssforamountpaymentcomplete = 'amountpaymentcomplete';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>"; print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
print '<td class="right"'.($resteapayer?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>'.price($resteapayer)."</td></tr>\n"; print '<td class="right'.($resteapayer?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n";
print "</table>"; print "</table>";
$db->free($resql); $db->free($resql);

View File

@ -145,7 +145,7 @@ if ($object->id)
} }
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';

View File

@ -131,7 +131,7 @@ if ($object->id)
} }
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';

View File

@ -154,7 +154,7 @@ abstract class ActionsContactCardCommon
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
// State // State
if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement, $this->object->country_code); if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
else $this->tpl['select_state'] = $countrynotdefined; else $this->tpl['select_state'] = $countrynotdefined;
// Public or private // Public or private
@ -289,7 +289,6 @@ abstract class ActionsContactCardCommon
$this->object->address = $_POST["address"]; $this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"]; $this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"]; $this->object->town = $_POST["town"];
$this->object->fk_departement = $_POST["state_id"];
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$this->object->state_id = $_POST["state_id"]; $this->object->state_id = $_POST["state_id"];
$this->object->phone_pro = $_POST["phone_pro"]; $this->object->phone_pro = $_POST["phone_pro"];

View File

@ -356,7 +356,6 @@ if (empty($reshook))
$object->zip = GETPOST("zipcode", 'alpha'); $object->zip = GETPOST("zipcode", 'alpha');
$object->town = GETPOST("town", 'alpha'); $object->town = GETPOST("town", 'alpha');
$object->state_id = GETPOST("state_id", 'int'); $object->state_id = GETPOST("state_id", 'int');
$object->fk_departement = GETPOST("state_id", 'int'); // For backward compatibility
$object->country_id = GETPOST("country_id", 'int'); $object->country_id = GETPOST("country_id", 'int');
$object->email = GETPOST("email", 'alpha'); $object->email = GETPOST("email", 'alpha');

View File

@ -338,7 +338,6 @@ class Contact extends CommonObject
$this->zip=(empty($this->zip)?'':$this->zip); $this->zip=(empty($this->zip)?'':$this->zip);
$this->town=(empty($this->town)?'':$this->town); $this->town=(empty($this->town)?'':$this->town);
$this->country_id=($this->country_id > 0?$this->country_id:$this->country_id); $this->country_id=($this->country_id > 0?$this->country_id:$this->country_id);
$this->state_id=($this->state_id > 0?$this->state_id:$this->fk_departement);
if (empty($this->statut)) $this->statut = 0; if (empty($this->statut)) $this->statut = 0;
$this->db->begin(); $this->db->begin();
@ -712,7 +711,7 @@ class Contact extends CommonObject
$sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,"; $sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,";
$sql.= " c.address, c.statut, c.zip, c.town,"; $sql.= " c.address, c.statut, c.zip, c.town,";
$sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_pays as country_id,";
$sql.= " c.fk_departement,"; $sql.= " c.fk_departement as state_id,";
$sql.= " c.birthday,"; $sql.= " c.birthday,";
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook, c.linkedin,"; $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook, c.linkedin,";
$sql.= " c.photo,"; $sql.= " c.photo,";
@ -763,11 +762,8 @@ class Contact extends CommonObject
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification); $this->date_modification = $this->db->jdate($obj->date_modification);
$this->fk_departement = $obj->fk_departement; // deprecated $this->state_id = $obj->state_id;
$this->state_id = $obj->fk_departement;
$this->departement_code = $obj->state_code; // deprecated
$this->state_code = $obj->state_code; $this->state_code = $obj->state_code;
$this->departement = $obj->state; // deprecated
$this->state = $obj->state; $this->state = $obj->state;
$this->country_id = $obj->country_id; $this->country_id = $obj->country_id;

View File

@ -124,7 +124,7 @@ if ($object->id)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border tableforfield centpercent">';
// Company // Company
/* /*

View File

@ -446,7 +446,7 @@ $arrayofmassactions = array(
// 'builddoc'=>$langs->trans("PDFMerge"), // 'builddoc'=>$langs->trans("PDFMerge"),
); );
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -165,7 +165,7 @@ class Contrat extends CommonObject
/** /**
* @deprecated Use fk_project instead * @deprecated Use fk_project instead
* @see fk_project * @see $fk_project
*/ */
public $fk_projet; public $fk_projet;
@ -305,7 +305,7 @@ class Contrat extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @param string $comment Comment * @param string $comment Comment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see closeAll * @see ()
*/ */
public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '') public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '')
{ {
@ -361,7 +361,7 @@ class Contrat extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @param string $comment Comment * @param string $comment Comment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see activateAll * @see activateAll()
*/ */
public function closeAll(User $user, $notrigger = 0, $comment = '') public function closeAll(User $user, $notrigger = 0, $comment = '')
{ {

View File

@ -178,7 +178,7 @@ if ($object->id)
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
print '</table>'; print '</table>';

View File

@ -7,6 +7,7 @@
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop> * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -368,7 +369,7 @@ $arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@ -802,6 +803,10 @@ while ($i < min($num, $limit))
} }
$db->free($resql); $db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -313,7 +313,7 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
//if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); //if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -28,7 +28,7 @@
// $object must be defined (object is loaded in this file with fetch) // $object must be defined (object is loaded in this file with fetch)
// Save selection // Save selection
if (GETPOST('formfilteraction') == 'listafterchangingselectedfields') if (GETPOST('formfilteraction', 'none') == 'listafterchangingselectedfields')
{ {
$tabparam=array(); $tabparam=array();

View File

@ -539,7 +539,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
{ {
$orders = GETPOST('toselect', 'array'); $orders = GETPOST('toselect', 'array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('valdate_invoices', 'int'); $validate_invoices = GETPOST('validate_invoices', 'int');
$TFact = array(); $TFact = array();
$TFactThird = array(); $TFactThird = array();

View File

@ -136,6 +136,10 @@ if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOL
{ {
$arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):'')); $arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
} }
if (! empty($conf->ticket->enabled) && empty($conf->global->MAIN_SEARCHFORM_TICKET_DISABLED) && $user->rights->ticket->read)
{
$arrayresult['searchintotickets']=array('position'=>220, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
}
/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag /* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag

View File

@ -1303,9 +1303,9 @@ class CMailFile
* This function has been modified as provided by SirSir to allow multiline responses when * This function has been modified as provided by SirSir to allow multiline responses when
* using SMTP Extensions. * using SMTP Extensions.
* *
* @param Socket $socket Socket * @param resource $socket Socket
* @param string $response Response string * @param string $response Response string
* @return boolean true if success * @return boolean true if success
*/ */
public function server_parse($socket, $response) public function server_parse($socket, $response)
{ {

View File

@ -1069,4 +1069,54 @@ abstract class CommonDocGenerator
} }
else return false; else return false;
} }
/**
* Print standard column content
*
* @param PDF $pdf Pdf object
* @param float $tab_top Tab top position
* @param float $tab_height Default tab height
* @param Translate $outputlangs Output language
* @param int $hidetop Hide top
* @return float Height of col tab titles
*/
public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
{
global $hookmanager;
foreach ($this->cols as $colKey => $colDef) {
$parameters = array(
'colKey' => $colKey,
'pdf' => $pdf,
'outputlangs' => $outputlangs,
'tab_top' => $tab_top,
'tab_height' => $tab_height,
'hidetop' => $hidetop
);
$reshook = $hookmanager->executeHooks('pdfTabTitles', $parameters, $this); // Note that $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} elseif (empty($reshook)) {
if (!$this->getColumnStatus($colKey)) continue;
// get title label
$colDef['title']['label'] = !empty($colDef['title']['label']) ? $colDef['title']['label'] : $outputlangs->transnoentities($colDef['title']['textkey']);
// Add column separator
if (!empty($colDef['border-left'])) {
$pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height);
}
if (empty($hidetop)) {
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
}
}
}
return $this->tabTitleHeight;
}
} }

View File

@ -3286,7 +3286,7 @@ abstract class CommonObject
* @param string $targettype Object target type * @param string $targettype Object target type
* @param int $rowid Row id of line to delete. If defined, other parameters are not used. * @param int $rowid Row id of line to delete. If defined, other parameters are not used.
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* @see add_object_linked, updateObjectLinked, fetchObjectLinked * @see add_object_linked(), updateObjectLinked(), fetchObjectLinked()
*/ */
public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '') public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '')
{ {
@ -4039,7 +4039,7 @@ abstract class CommonObject
$i++; $i++;
} }
print "</tbody>\n"; print "</tbody><!-- end printObjectLines() -->\n";
} }
/** /**

View File

@ -39,7 +39,7 @@ abstract class CommonObjectLine extends CommonObject
* Id of the line * Id of the line
* @var int * @var int
* @deprecated Try to use id property as possible (even if field into database is still rowid) * @deprecated Try to use id property as possible (even if field into database is still rowid)
* @see id * @see $id
*/ */
public $rowid; public $rowid;

View File

@ -41,7 +41,7 @@ abstract class CommonOrderLine extends CommonObjectLine
* Product ref * Product ref
* @var string * @var string
* @deprecated Use product_ref * @deprecated Use product_ref
* @see product_ref * @see $product_ref
*/ */
public $ref; public $ref;
@ -55,7 +55,7 @@ abstract class CommonOrderLine extends CommonObjectLine
* Product label * Product label
* @var string * @var string
* @deprecated Use product_label * @deprecated Use product_label
* @see product_label * @see $product_label
*/ */
public $libelle; public $libelle;
@ -80,7 +80,7 @@ abstract class CommonOrderLine extends CommonObjectLine
/** /**
* Unit price * Unit price
* @deprecated * @deprecated
* @see subprice * @see $subprice
*/ */
public $price; public $price;

View File

@ -447,7 +447,7 @@ class Conf
if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum"; if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint'; if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint';
if (empty($conf->global->TICKETSUP_ADDON)) $this->global->TICKETSUP_ADDON='mod_ticket_simple'; if (empty($conf->global->TICKET_ADDON)) $this->global->TICKET_ADDON='mod_ticket_simple';
// Security // Security
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator
@ -659,8 +659,8 @@ class Conf
if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1; if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1;
$this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com';
$this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
// For backward compatibility // For backward compatibility
if (isset($this->product)) $this->produit=$this->product; if (isset($this->product)) $this->produit=$this->product;

View File

@ -82,7 +82,7 @@ class CoreObject extends CommonObject
* *
* @param string $field name of field * @param string $field name of field
* @param string $type type of field to test * @param string $type type of field to test
* @return value of field or false * @return boolean value of field or false
*/ */
private function checkFieldType($field, $type) private function checkFieldType($field, $type)
{ {

View File

@ -54,7 +54,7 @@ class Cstate // extends CommonObject
/** /**
* @var string * @var string
* @deprecated * @deprecated
* @see name * @see $name
*/ */
public $nom=''; public $nom='';

View File

@ -257,7 +257,7 @@ class DolGraph
* *
* @param array $data Data * @param array $data Data
* @return void * @return void
* @see draw_jflot for syntax of data array * @see draw_jflot() for syntax of data array
*/ */
public function SetData($data) public function SetData($data)
{ {

View File

@ -1180,6 +1180,8 @@ class ExtraFields
// 2 : key fields name (if differ of rowid) // 2 : key fields name (if differ of rowid)
// 3 : key field parent (for dependent lists) // 3 : key field parent (for dependent lists)
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
// 5 : id category type
// 6 : ids categories list separated by comma for category root
$keyList=(empty($InfoFieldList[2])?'rowid':$InfoFieldList[2].' as rowid'); $keyList=(empty($InfoFieldList[2])?'rowid':$InfoFieldList[2].' as rowid');
@ -1198,136 +1200,130 @@ class ExtraFields
$keyList.= ', '.$parentField; $keyList.= ', '.$parentField;
} }
$fields_label = explode('|', $InfoFieldList[1]); $filter_categorie = false;
if (is_array($fields_label)) if (count($InfoFieldList) > 5) {
{ if ($InfoFieldList[0] == 'categorie') {
$keyList .=', '; $filter_categorie = true;
$keyList .= implode(', ', $fields_label); }
} }
$sqlwhere=''; if ($filter_categorie === false) {
$sql = 'SELECT '.$keyList; $fields_label = explode('|', $InfoFieldList[1]);
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0]; if (is_array($fields_label)) {
if (!empty($InfoFieldList[4])) $keyList .= ', ';
{ $keyList .= implode(', ', $fields_label);
// can use curent entity filter }
if (strpos($InfoFieldList[4], '$ENTITY$')!==false) {
$InfoFieldList[4]=str_replace('$ENTITY$', $conf->entity, $InfoFieldList[4]);
}
// can use SELECT request
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
$InfoFieldList[4]=str_replace('$SEL$', 'SELECT', $InfoFieldList[4]);
}
// current object id can be use into filter $sqlwhere = '';
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { $sql = 'SELECT ' . $keyList;
$InfoFieldList[4]=str_replace('$ID$', $objectid, $InfoFieldList[4]); $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
} else { if (!empty($InfoFieldList[4])) {
$InfoFieldList[4]=str_replace('$ID$', '0', $InfoFieldList[4]); // can use curent entity filter
} if (strpos($InfoFieldList[4], '$ENTITY$') !== false) {
//We have to join on extrafield table $InfoFieldList[4] = str_replace('$ENTITY$', $conf->entity, $InfoFieldList[4]);
if (strpos($InfoFieldList[4], 'extra')!==false) }
{ // can use SELECT request
$sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra'; if (strpos($InfoFieldList[4], '$SEL$') !== false) {
$sqlwhere.= ' WHERE extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4]; $InfoFieldList[4] = str_replace('$SEL$', 'SELECT', $InfoFieldList[4]);
} }
else
{
$sqlwhere.= ' WHERE '.$InfoFieldList[4];
}
}
else
{
$sqlwhere.= ' WHERE 1=1';
}
// Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array('tablewithentity')))
{
$sqlwhere.= ' AND entity = '.$conf->entity;
}
$sql.=$sqlwhere;
//print $sql;
$sql .= ' ORDER BY ' . implode(', ', $fields_label); // current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
$InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
} else {
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
}
//We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra') !== false) {
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
$sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4];
} else {
$sqlwhere .= ' WHERE ' . $InfoFieldList[4];
}
} else {
$sqlwhere .= ' WHERE 1=1';
}
// Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array('tablewithentity'))) {
$sqlwhere .= ' AND entity = ' . $conf->entity;
}
$sql .= $sqlwhere;
//print $sql;
dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); $sql .= ' ORDER BY ' . implode(', ', $fields_label);
$resql = $this->db->query($sql);
if ($resql)
{
$out.='<option value="0">&nbsp;</option>';
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$labeltoshow='';
$obj = $this->db->fetch_object($resql);
// Several field into label (eq table:code|libelle:rowid) dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
$notrans = false; $resql = $this->db->query($sql);
$fields_label = explode('|', $InfoFieldList[1]); if ($resql) {
if (is_array($fields_label)) $out .= '<option value="0">&nbsp;</option>';
{ $num = $this->db->num_rows($resql);
$notrans = true; $i = 0;
foreach ($fields_label as $field_toshow) while ($i < $num) {
{ $labeltoshow = '';
$labeltoshow.= $obj->$field_toshow.' '; $obj = $this->db->fetch_object($resql);
}
}
else
{
$labeltoshow=$obj->{$InfoFieldList[1]};
}
$labeltoshow=dol_trunc($labeltoshow, 45);
if ($value == $obj->rowid) // Several field into label (eq table:code|libelle:rowid)
{ $notrans = false;
foreach ($fields_label as $field_toshow) $fields_label = explode('|', $InfoFieldList[1]);
{ if (is_array($fields_label)) {
$translabel=$langs->trans($obj->$field_toshow); $notrans = true;
if ($translabel!=$obj->$field_toshow) { foreach ($fields_label as $field_toshow) {
$labeltoshow=dol_trunc($translabel, 18).' '; $labeltoshow .= $obj->$field_toshow . ' ';
}else { }
$labeltoshow=dol_trunc($obj->$field_toshow, 18).' '; } else {
} $labeltoshow = $obj->{$InfoFieldList[1]};
} }
$out.='<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; $labeltoshow = dol_trunc($labeltoshow, 45);
}
else
{
if (! $notrans)
{
$translabel=$langs->trans($obj->{$InfoFieldList[1]});
if ($translabel!=$obj->{$InfoFieldList[1]}) {
$labeltoshow=dol_trunc($translabel, 18);
}
else {
$labeltoshow=dol_trunc($obj->{$InfoFieldList[1]}, 18);
}
}
if (empty($labeltoshow)) $labeltoshow='(not defined)';
if ($value==$obj->rowid)
{
$out.='<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
}
if (!empty($InfoFieldList[3]) && $parentField) if ($value == $obj->rowid) {
{ foreach ($fields_label as $field_toshow) {
$parent = $parentName.':'.$obj->{$parentField}; $translabel = $langs->trans($obj->$field_toshow);
} if ($translabel != $obj->$field_toshow) {
$labeltoshow = dol_trunc($translabel, 18) . ' ';
} else {
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
}
}
$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
} else {
if (!$notrans) {
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
if ($translabel != $obj->{$InfoFieldList[1]}) {
$labeltoshow = dol_trunc($translabel, 18);
} else {
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
}
}
if (empty($labeltoshow)) $labeltoshow = '(not defined)';
if ($value == $obj->rowid) {
$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
}
$out.='<option value="'.$obj->rowid.'"'; if (!empty($InfoFieldList[3]) && $parentField) {
$out.= ($value==$obj->rowid?' selected':''); $parent = $parentName . ':' . $obj->{$parentField};
$out.= (!empty($parent)?' parent="'.$parent.'"':''); }
$out.='>'.$labeltoshow.'</option>';
}
$i++; $out .= '<option value="' . $obj->rowid . '"';
} $out .= ($value == $obj->rowid ? ' selected' : '');
$this->db->free($resql); $out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
} $out .= '>' . $labeltoshow . '</option>';
else { }
print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
} $i++;
}
$this->db->free($resql);
} else {
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
}
} else {
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$out .= '<option value="0">&nbsp;</option>';
foreach ($data as $data_key => $data_value) {
$out .= '<option value="' . $data_key . '"';
$out .= ($value == $data_key ? ' selected' : '');
$out .= '>' . $data_value . '</option>';
}
}
} }
$out.='</select>'; $out.='</select>';
} }
@ -1367,6 +1363,8 @@ class ExtraFields
// 2 : key fields name (if differ of rowid) // 2 : key fields name (if differ of rowid)
// 3 : key field parent (for dependent lists) // 3 : key field parent (for dependent lists)
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
// 5 : id category type
// 6 : ids categories list separated by comma for category root
$keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid'); $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid');
if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) { if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) {
@ -1381,166 +1379,173 @@ class ExtraFields
} }
} }
$fields_label = explode('|', $InfoFieldList[1]); $filter_categorie = false;
if (is_array($fields_label)) { if (count($InfoFieldList) > 5) {
$keyList .= ', '; if ($InfoFieldList[0] == 'categorie') {
$keyList .= implode(', ', $fields_label); $filter_categorie = true;
} }
}
$sqlwhere = ''; if ($filter_categorie === false) {
$sql = 'SELECT ' . $keyList; $fields_label = explode('|', $InfoFieldList[1]);
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; if (is_array($fields_label)) {
if (! empty($InfoFieldList[4])) { $keyList .= ', ';
$keyList .= implode(', ', $fields_label);
}
// can use SELECT request $sqlwhere = '';
if (strpos($InfoFieldList[4], '$SEL$')!==false) { $sql = 'SELECT ' . $keyList;
$InfoFieldList[4]=str_replace('$SEL$', 'SELECT', $InfoFieldList[4]); $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
} if (!empty($InfoFieldList[4])) {
// current object id can be use into filter // can use SELECT request
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { if (strpos($InfoFieldList[4], '$SEL$') !== false) {
$InfoFieldList[4]=str_replace('$ID$', $objectid, $InfoFieldList[4]); $InfoFieldList[4] = str_replace('$SEL$', 'SELECT', $InfoFieldList[4]);
} elseif (preg_match("#^.*list.php$#", $_SERVER["DOCUMENT_URI"])) { }
// Pattern for word=$ID$
$word = '\b[a-zA-Z0-9-\.-_]+\b=\$ID\$';
// Removing space arount =, ( and ) // current object id can be use into filter
$InfoFieldList[4]=preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]); if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
$InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
} elseif (preg_match("#^.*list.php$#", $_SERVER["DOCUMENT_URI"])) {
// Pattern for word=$ID$
$word = '\b[a-zA-Z0-9-\.-_]+\b=\$ID\$';
$nbPreg = 1; // Removing space arount =, ( and )
// While we have parenthesis $InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
while ($nbPreg!=0) {
// Init des compteurs
$nbPregRepl = $nbPregSel = 0;
// On retire toutes les parenthèses sans = avant
$InfoFieldList[4]=preg_replace('#([^=])(\([^)^(]*(' . $word . ')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl);
// On retire les espaces autour des = et parenthèses
$InfoFieldList[4]=preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
// On retire toutes les parenthèses avec = avant
$InfoFieldList[4]=preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*(' . $word . ')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel);
// On retire les espaces autour des = et parenthèses
$InfoFieldList[4]=preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
// Calcul du compteur général pour la boucle $nbPreg = 1;
$nbPreg = $nbPregRepl + $nbPregSel; // While we have parenthesis
} while ($nbPreg != 0) {
// Init des compteurs
$nbPregRepl = $nbPregSel = 0;
// On retire toutes les parenthèses sans = avant
$InfoFieldList[4] = preg_replace('#([^=])(\([^)^(]*(' . $word . ')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl);
// On retire les espaces autour des = et parenthèses
$InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
// On retire toutes les parenthèses avec = avant
$InfoFieldList[4] = preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*(' . $word . ')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel);
// On retire les espaces autour des = et parenthèses
$InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]);
// Si l'on a un AND ou un OR, avant ou après // Calcul du compteur général pour la boucle
preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); $nbPreg = $nbPregRepl + $nbPregSel;
while(!empty($matchCondition[0])) { }
// If the two sides differ but are not empty
if (! empty($matchCondition[1]) && ! empty($matchCondition[3]) && $matchCondition[1] != $matchCondition[3] ) {
// Nobody sain would do that without parentheses
$InfoFieldList[4]=str_replace('$ID$', '0', $InfoFieldList[4]);
}
else {
if (! empty($matchCondition[1])) {
$boolCond =(( $matchCondition[1] == "AND" )?' AND 1 ':' OR 0 ');
$InfoFieldList[4]=str_replace($matchCondition[0], $boolCond.$matchCondition[3], $InfoFieldList[4]);
}
elseif (! empty($matchCondition[3])) {
$boolCond =(( $matchCondition[3] == "AND" )?' 1 AND ':' 0 OR');
$InfoFieldList[4]=str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]);
}
else {
$InfoFieldList[4] = 1;
}
}
// Si l'on a un AND ou un OR, avant ou après // Si l'on a un AND ou un OR, avant ou après
preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
} while (!empty($matchCondition[0])) {
} // If the two sides differ but are not empty
else { if (!empty($matchCondition[1]) && !empty($matchCondition[3]) && $matchCondition[1] != $matchCondition[3]) {
$InfoFieldList[4]=str_replace('$ID$', '0', $InfoFieldList[4]); // Nobody sain would do that without parentheses
} $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
} else {
if (!empty($matchCondition[1])) {
$boolCond = (($matchCondition[1] == "AND") ? ' AND 1 ' : ' OR 0 ');
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]);
} elseif (!empty($matchCondition[3])) {
$boolCond = (($matchCondition[3] == "AND") ? ' 1 AND ' : ' 0 OR');
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]);
} else {
$InfoFieldList[4] = 1;
}
}
// We have to join on extrafield table // Si l'on a un AND ou un OR, avant ou après
if (strpos($InfoFieldList[4], 'extra') !== false) { preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition);
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra'; }
$sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4]; } else {
} else { $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
$sqlwhere .= ' WHERE ' . $InfoFieldList[4]; }
}
} else {
$sqlwhere .= ' WHERE 1=1';
}
// Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array ('tablewithentity')))
{
$sqlwhere .= ' AND entity = ' . $conf->entity;
}
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
// print $sql;
$sql .= $sqlwhere; // We have to join on extrafield table
dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); if (strpos($InfoFieldList[4], 'extra') !== false) {
$resql = $this->db->query($sql); $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
if ($resql) { $sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4];
$num = $this->db->num_rows($resql); } else {
$i = 0; $sqlwhere .= ' WHERE ' . $InfoFieldList[4];
}
} else {
$sqlwhere .= ' WHERE 1=1';
}
// Some tables may have field, some other not. For the moment we disable it.
if (in_array($InfoFieldList[0], array('tablewithentity'))) {
$sqlwhere .= ' AND entity = ' . $conf->entity;
}
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
// print $sql;
$data=array(); $sql .= $sqlwhere;
dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ( $i < $num ) { $data = array();
$labeltoshow = '';
$obj = $this->db->fetch_object($resql);
$notrans = false; while ($i < $num) {
// Several field into label (eq table:code|libelle:rowid) $labeltoshow = '';
$fields_label = explode('|', $InfoFieldList[1]); $obj = $this->db->fetch_object($resql);
if (is_array($fields_label)) {
$notrans = true;
foreach ($fields_label as $field_toshow) {
$labeltoshow .= $obj->$field_toshow . ' ';
}
} else {
$labeltoshow = $obj->{$InfoFieldList[1]};
}
$labeltoshow = dol_trunc($labeltoshow, 45);
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { $notrans = false;
foreach ($fields_label as $field_toshow) { // Several field into label (eq table:code|libelle:rowid)
$translabel = $langs->trans($obj->$field_toshow); $fields_label = explode('|', $InfoFieldList[1]);
if ($translabel != $obj->$field_toshow) { if (is_array($fields_label)) {
$labeltoshow = dol_trunc($translabel, 18) . ' '; $notrans = true;
} else { foreach ($fields_label as $field_toshow) {
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; $labeltoshow .= $obj->$field_toshow . ' ';
} }
} } else {
$labeltoshow = $obj->{$InfoFieldList[1]};
}
$labeltoshow = dol_trunc($labeltoshow, 45);
$data[$obj->rowid]=$labeltoshow; if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
} else { foreach ($fields_label as $field_toshow) {
if (! $notrans) { $translabel = $langs->trans($obj->$field_toshow);
$translabel = $langs->trans($obj->{$InfoFieldList[1]}); if ($translabel != $obj->$field_toshow) {
if ($translabel != $obj->{$InfoFieldList[1]}) { $labeltoshow = dol_trunc($translabel, 18) . ' ';
$labeltoshow = dol_trunc($translabel, 18); } else {
} else { $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18); }
} }
}
if (empty($labeltoshow))
$labeltoshow = '(not defined)';
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { $data[$obj->rowid] = $labeltoshow;
$data[$obj->rowid]=$labeltoshow; } else {
} if (!$notrans) {
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
if ($translabel != $obj->{$InfoFieldList[1]}) {
$labeltoshow = dol_trunc($translabel, 18);
} else {
$labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18);
}
}
if (empty($labeltoshow))
$labeltoshow = '(not defined)';
if (! empty($InfoFieldList[3]) && $parentField) { if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
$parent = $parentName . ':' . $obj->{$parentField}; $data[$obj->rowid] = $labeltoshow;
} }
$data[$obj->rowid]=$labeltoshow; if (!empty($InfoFieldList[3]) && $parentField) {
} $parent = $parentName . ':' . $obj->{$parentField};
}
$i ++; $data[$obj->rowid] = $labeltoshow;
} }
$this->db->free($resql);
$out=$form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); $i++;
} else { }
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; $this->db->free($resql);
}
$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
} else {
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
}
} else {
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
}
} }
} }
elseif ($type == 'link') elseif ($type == 'link')

View File

@ -586,7 +586,7 @@ class Form
$disabled=0; $disabled=0;
$ret='<div class="centpercent center">'; $ret='<div class="centpercent center">';
$ret.='<select class="flat'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionselect" name="massaction"'.($disabled?' disabled="disabled"':'').'>'; $ret.='<select class="flat'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionselect valignmiddle" name="massaction"'.($disabled?' disabled="disabled"':'').'>';
// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks. // Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks.
$parameters=array(); $parameters=array();
@ -596,12 +596,13 @@ class Form
$ret.='<option value="0"'.($disabled?' disabled="disabled"':'').'>-- '.$langs->trans("SelectAction").' --</option>'; $ret.='<option value="0"'.($disabled?' disabled="disabled"':'').'>-- '.$langs->trans("SelectAction").' --</option>';
foreach($arrayofaction as $code => $label) foreach($arrayofaction as $code => $label)
{ {
$ret.='<option value="'.$code.'"'.($disabled?' disabled="disabled"':'').'>'.$label.'</option>'; $ret.='<option value="'.$code.'"'.($disabled?' disabled="disabled"':'').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';
} }
} }
$ret.=$hookmanager->resPrint; $ret.=$hookmanager->resPrint;
$ret.='</select>'; $ret.='</select>';
$ret.=ajax_combobox('.massactionselect');
// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button // Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button
$ret.='<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER. $ret.='<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.
$ret.='<input type="submit" disabled name="confirmmassaction" class="button'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">'; $ret.='<input type="submit" disabled name="confirmmassaction" class="button'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
@ -2321,7 +2322,7 @@ class Form
* constructProductListOption. * constructProductListOption.
* This define value for &$opt and &$optJson. * This define value for &$opt and &$optJson.
* *
* @param resultset $objp Resultset of fetch * @param resource $objp Resultset of fetch
* @param string $opt Option (var used for returned value in string option format) * @param string $opt Option (var used for returned value in string option format)
* @param string $optJson Option (var used for returned value in json format) * @param string $optJson Option (var used for returned value in json format)
* @param int $price_level Price level * @param int $price_level Price level
@ -3801,16 +3802,21 @@ class Form
/** /**
* Return list of categories having choosed type * Return list of categories having choosed type
* *
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated. * @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element) * @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
* @param string $htmlname HTML field name * @param string $htmlname HTML field name
* @param int $maxlength Maximum length for labels * @param int $maxlength Maximum length for labels
* @param int $excludeafterid Exclude all categories after this leaf in category tree. * @param int|string|array $markafterid Keep only or removed all categories including the leaf $markafterid in category tree (exclude) or Keep only of category is inside the leaf starting with this id.
* @param int $outputmode 0=HTML select string, 1=Array * $markafterid can be an :
* - int (id of category)
* - string (categories ids seprated by comma)
* - array (list of categories ids)
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $include [=0] Removed or 1=Keep only
* @return string * @return string
* @see select_categories() * @see select_categories()
*/ */
public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $excludeafterid = 0, $outputmode = 0) public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $markafterid = 0, $outputmode = 0, $include = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -3850,7 +3856,7 @@ class Form
else else
{ {
$cat = new Categorie($this->db); $cat = new Categorie($this->db);
$cate_arbo = $cat->get_full_arbo($type, $excludeafterid); $cate_arbo = $cat->get_full_arbo($type, $markafterid, $include);
} }
$output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">'; $output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
@ -5153,7 +5159,7 @@ class Form
* @param datetime $adddateof Add a link "Date of invoice" using the following date. * @param datetime $adddateof Add a link "Date of invoice" using the following date.
* @return string|void Nothing or string if nooutput is 1 * @return string|void Nothing or string if nooutput is 1
* @deprecated * @deprecated
* @see form_date, select_month, select_year, select_dayofweek * @see form_date(), select_month(), select_year(), select_dayofweek()
*/ */
public function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '') public function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '')
{ {
@ -5828,7 +5834,7 @@ class Form
* Note: Do not apply langs->trans function on returned content, content may be entity encoded twice. * Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
* *
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect * @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
* @param array $array Array (key => value) * @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>...))
* @param string|string[] $id Preselected key or preselected keys for multiselect * @param string|string[] $id Preselected key or preselected keys for multiselect
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or '&nbsp;' if 1, key is -1 and value is text if string), <0 to add an empty value with key that is this value. * @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or '&nbsp;' if 1, key is -1 and value is text if string), <0 to add an empty value with key that is this value.
* @param int $key_in_label 1 to show key into label with format "[key] value" * @param int $key_in_label 1 to show key into label with format "[key] value"
@ -5889,7 +5895,8 @@ class Form
{ {
foreach($array as $key => $value) foreach($array as $key => $value)
{ {
$array[$key]=$langs->trans($value); if (! is_array($value)) $array[$key]=$langs->trans($value);
else $array[$key]['label']=$langs->trans($value['label']);
} }
} }
@ -5897,8 +5904,11 @@ class Form
if ($sort == 'ASC') asort($array); if ($sort == 'ASC') asort($array);
elseif ($sort == 'DESC') arsort($array); elseif ($sort == 'DESC') arsort($array);
foreach($array as $key => $value) foreach($array as $key => $tmpvalue)
{ {
if (is_array($tmpvalue)) $value=$tmpvalue['label'];
else $value = $tmpvalue;
$disabled=''; $style=''; $disabled=''; $style='';
if (! empty($disablebademail)) if (! empty($disablebademail))
{ {
@ -5926,6 +5936,13 @@ class Form
$out.=$style.$disabled; $out.=$style.$disabled;
if ($id != '' && $id == $key && ! $disabled) $out.=' selected'; // To preselect a value if ($id != '' && $id == $key && ! $disabled) $out.=' selected'; // To preselect a value
if ($nohtmlescape) $out.=' data-html="'.dol_escape_htmltag($selectOptionValue).'"'; if ($nohtmlescape) $out.=' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
if (is_array($tmpvalue))
{
foreach($tmpvalue as $keyforvalue => $valueforvalue)
{
if (preg_match('/^data-/', $keyforvalue)) $out.=' '.$keyforvalue.'="'.$valueforvalue.'"';
}
}
$out.='>'; $out.='>';
//var_dump($selectOptionValue); //var_dump($selectOptionValue);
$out.=$selectOptionValue; $out.=$selectOptionValue;
@ -6056,7 +6073,7 @@ class Form
* @param string $placeholder String to use as placeholder * @param string $placeholder String to use as placeholder
* @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string * @return string HTML select string
* @see selectArrayAjax, ajax_combobox in ajax.lib.php * @see selectArrayAjax(), ajax_combobox() in ajax.lib.php
*/ */
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
{ {
@ -6304,7 +6321,6 @@ class Form
else $array[$key]['checked']=0; else $array[$key]['checked']=0;
} }
} }
//var_dump($array);
$lis=''; $lis='';
$listcheckedstring=''; $listcheckedstring='';
@ -6774,8 +6790,6 @@ class Form
return $resultyesno; return $resultyesno;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of export templates * Return list of export templates
@ -7291,8 +7305,10 @@ class Form
global $conf, $langs; global $conf, $langs;
$out='<div class="nowrap">'; $out='<div class="nowrap">';
$out.='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; //$out.='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
$out.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; //$out.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
$out.='<button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
$out.='<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
$out.='</div>'; $out.='</div>';
return $out; return $out;

View File

@ -224,9 +224,9 @@ class FormAccounting extends Form
/** /**
* Return select filter with date of transaction * Return select filter with date of transaction
* *
* @param string $htmlname Name of select field * @param string $htmlname Name of select field
* @param string $selectedkey Value * @param string $selectedkey Value
* @return string HTML edit field * @return string HTML edit field
*/ */
public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
{ {
@ -247,7 +247,7 @@ class FormAccounting extends Form
} }
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
$options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext'); $options[$obj->import_key] = $obj->import_key;
} }
return Form::selectarray($htmlname, $options, $selectedkey); return Form::selectarray($htmlname, $options, $selectedkey);

View File

@ -215,7 +215,7 @@ class FormCompany
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show * @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
* @param string $htmlname Id of department. If '', we want only the string with <option> * @param string $htmlname Id of department. If '', we want only the string with <option>
* @return string String with HTML select * @return string String with HTML select
* @see select_country * @see select_country()
*/ */
public function select_state($selected = '', $country_codeid = 0, $htmlname = 'state_id') public function select_state($selected = '', $country_codeid = 0, $htmlname = 'state_id')
{ {

View File

@ -1139,7 +1139,7 @@ class FormFile
} }
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table width="100%" id="tablelines" class="'.(($useinecm && $useinecm != 6)?'liste noborder':'liste').'">'."\n"; print '<table width="100%" id="tablelines" class="liste noborder nobottom">'."\n";
if (! empty($addfilterfields)) if (! empty($addfilterfields))
{ {
@ -1156,10 +1156,10 @@ class FormFile
print '<tr class="liste_titre nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
//print $url.' sortfield='.$sortfield.' sortorder='.$sortorder; //print $url.' sortfield='.$sortfield.' sortorder='.$sortorder;
print_liste_field_titre('Documents2', $url, "name", "", $param, '', $sortfield, $sortorder, ' left'); print_liste_field_titre('Documents2', $url, "name", "", $param, '', $sortfield, $sortorder, 'left ');
print_liste_field_titre('Size', $url, "size", "", $param, '', $sortfield, $sortorder, ' right'); print_liste_field_titre('Size', $url, "size", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('Date', $url, "date", "", $param, '', $sortfield, $sortorder, ' center'); print_liste_field_titre('Date', $url, "date", "", $param, '', $sortfield, $sortorder, 'center ');
if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) print_liste_field_titre('', $url, "", "", $param, '', $sortfield, $sortorder, ' center'); // Preview if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) print_liste_field_titre('', $url, "", "", $param, '', $sortfield, $sortorder, 'center '); // Preview
print_liste_field_titre(''); print_liste_field_titre('');
print_liste_field_titre(''); print_liste_field_titre('');
if (! $disablemove) print_liste_field_titre(''); if (! $disablemove) print_liste_field_titre('');
@ -1432,7 +1432,7 @@ class FormFile
* @param string $url Full url to use for click links ('' = autodetect) * @param string $url Full url to use for click links ('' = autodetect)
* @param int $addfilterfields Add line with filters * @param int $addfilterfields Add line with filters
* @return int <0 if KO, nb of files shown if OK * @return int <0 if KO, nb of files shown if OK
* @see list_of_documents * @see list_of_documents()
*/ */
public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0) public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
{ {
@ -1734,7 +1734,7 @@ class FormFile
print '<form action="' . $_SERVER['PHP_SELF'] . ($param?'?'.$param:'') . '" method="POST">'; print '<form action="' . $_SERVER['PHP_SELF'] . ($param?'?'.$param:'') . '" method="POST">';
print '<table width="100%" class="liste">'; print '<table width="100%" class="liste noborder nobottom">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre( print_liste_field_titre(
$langs->trans("Links"), $langs->trans("Links"),
@ -1742,9 +1742,10 @@ class FormFile
"name", "name",
"", "",
$param, $param,
'class="left"', '',
$sortfield, $sortfield,
$sortorder $sortorder,
''
); );
print_liste_field_titre( print_liste_field_titre(
"", "",
@ -1752,7 +1753,10 @@ class FormFile
"", "",
"", "",
"", "",
'class="right"' '',
'',
'',
'right '
); );
print_liste_field_titre( print_liste_field_titre(
$langs->trans("Date"), $langs->trans("Date"),
@ -1760,9 +1764,10 @@ class FormFile
"date", "date",
"", "",
$param, $param,
'class="center"', '',
$sortfield, $sortfield,
$sortorder $sortorder,
'center '
); );
print_liste_field_titre( print_liste_field_titre(
'', '',
@ -1770,7 +1775,10 @@ class FormFile
"", "",
"", "",
$param, $param,
'class="center"' '',
'',
'',
'center '
); );
print_liste_field_titre('', '', ''); print_liste_field_titre('', '', '');
print '</tr>'; print '</tr>';

View File

@ -9,6 +9,7 @@
* Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com> * Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -326,7 +327,7 @@ class FormOther
* @param int $showempty Add also an empty line * @param int $showempty Add also an empty line
* @param string $morecss More CSS * @param string $morecss More CSS
* @return string Html combo list code * @return string Html combo list code
* @see select_all_categories * @see select_all_categories()
*/ */
public function select_categories($type, $selected = 0, $htmlname = 'search_categ', $nocateg = 0, $showempty = 1, $morecss = '') public function select_categories($type, $selected = 0, $htmlname = 'search_categ', $nocateg = 0, $showempty = 1, $morecss = '')
{ {
@ -617,7 +618,7 @@ class FormOther
* @param string $color String with hex (FFFFFF) or comma RGB ('255,255,255') * @param string $color String with hex (FFFFFF) or comma RGB ('255,255,255')
* @param string $textifnotdefined Text to show if color not defined * @param string $textifnotdefined Text to show if color not defined
* @return string HTML code for color thumb * @return string HTML code for color thumb
* @see selectColor * @see selectColor()
*/ */
public static function showColor($color, $textifnotdefined = '') public static function showColor($color, $textifnotdefined = '')
{ {
@ -660,7 +661,7 @@ class FormOther
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
* @param string $morecss Add css style into input field * @param string $morecss Add css style into input field
* @return string * @return string
* @see showColor * @see showColor()
*/ */
public static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '') public static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '')
{ {
@ -1232,4 +1233,44 @@ class FormOther
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
/**
* Return an html string with a select combo box to choose yes or no
*
* @param string $htmlname Name of html select field
* @param string $value Pre-selected value
* @param int $option 0 return automatic/manual, 1 return 1/0
* @param bool $disabled true or false
* @param int $useempty 1=Add empty line
* @return string See option
*/
public function selectAutoManual($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0)
{
global $langs;
$automatic="automatic"; $manual="manual";
if ($option)
{
$automatic="1";
$manual="0";
}
$disabled = ($disabled ? ' disabled' : '');
$resultautomanual = '<select class="flat width100" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
if ($useempty) $resultautomanual .= '<option value="-1"'.(($value < 0)?' selected':'').'>&nbsp;</option>'."\n";
if (("$value" == 'automatic') || ($value == 1))
{
$resultautomanual .= '<option value="'.$automatic.'" selected>'.$langs->trans("Automatic").'</option>'."\n";
$resultautomanual .= '<option value="'.$manual.'">'.$langs->trans("Manual").'</option>'."\n";
}
else
{
$selected=(($useempty && $value != '0' && $value != 'manual')?'':' selected');
$resultautomanual .= '<option value="'.$automatic.'">'.$langs->trans("Automatic").'</option>'."\n";
$resultautomanual .= '<option value="'.$manual.'"'.$selected.'>'.$langs->trans("Manual").'</option>'."\n";
}
$resultautomanual .= '</select>'."\n";
return $resultautomanual;
}
} }

View File

@ -167,6 +167,85 @@ class FormTicket
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("Ref") . '</span></td><td><input size="18" type="text" name="ref" value="' . (GETPOST("ref", 'alpha') ? GETPOST("ref", 'alpha') : $defaultref) . '"></td></tr>'; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("Ref") . '</span></td><td><input size="18" type="text" name="ref" value="' . (GETPOST("ref", 'alpha') ? GETPOST("ref", 'alpha') : $defaultref) . '"></td></tr>';
} }
// TITLE
if ($this->withemail) {
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">' . $langs->trans("Email") . '</span></label></td><td>';
print '<input class="text minwidth200" id="email" name="email" value="' . (GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $subject) . '" />';
print '</td></tr>';
}
// Si origin du ticket
if (isset($this->param['origin']) && $this->param['originid'] > 0) {
// Parse element/subelement (ex: project_task)
$element = $subelement = $this->param['origin'];
if (preg_match('/^([^_]+)_([^_]+)/i', $this->param['origin'], $regs)) {
$element = $regs[1];
$subelement = $regs[2];
}
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
$classname = ucfirst($subelement);
$objectsrc = new $classname($this->db);
$objectsrc->fetch(GETPOST('originid', 'int'));
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
$objectsrc->fetch_lines();
}
$objectsrc->fetch_thirdparty();
$newclassname = $classname;
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2"><input name="' . $subelement . 'id" value="' . GETPOST('originid') . '" type="hidden" />' . $objectsrc->getNomUrl(1) . '</td></tr>';
}
// Type
print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">' . $langs->trans("TicketTypeRequest") . '</span></label></td><td>';
$this->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $this->type_code), 'type_code', '', '2');
print '</td></tr>';
// Severity
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">' . $langs->trans("TicketSeverity") . '</span></label></td><td>';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2');
print '</td></tr>';
// Group
print '<tr><td><span class="fieldrequired"><label for="selectcategory_code">' . $langs->trans("TicketGroup") . '</span></label></td><td>';
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2');
print '</td></tr>';
// Subject
if ($this->withtitletopic) {
print '<tr><td><label for="subject"><span class="fieldrequired">' . $langs->trans("Subject") . '</span></label></td><td>';
// Réponse à un ticket : affichage du titre du thread en readonly
if ($this->withtopicreadonly) {
print $langs->trans('SubjectAnswerToTicket') . ' ' . $this->topic_title;
print '</td></tr>';
} else {
if ($this->withthreadid > 0) {
$subject = $langs->trans('SubjectAnswerToTicket') . ' ' . $this->withthreadid . ' : ' . $this->topic_title . '';
}
print '<input class="text" size="50" id="subject" name="subject" value="' . (GETPOST('subject', 'alpha') ? GETPOST('subject', 'alpha') : $subject) . '" />';
print '</td></tr>';
}
}
// MESSAGE
$msg = GETPOSTISSET('message') ? GETPOST('message', 'none') : '';
print '<tr><td><label for="message"><span class="fieldrequired">' . $langs->trans("Message") . '</span></label></td><td>';
// If public form, display more information
$toolbarname = 'dolibarr_notes';
if ($this->ispublic)
{
$toolbarname = 'dolibarr_details';
print '<div class="warning">' . ($conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe')) . '</div>';
}
include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$uselocalbrowser = true;
$doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser);
$doleditor->Create();
print '</td></tr>';
// FK_USER_CREATE // FK_USER_CREATE
if ($this->withusercreate > 0 && $this->fk_user_create) { if ($this->withusercreate > 0 && $this->fk_user_create) {
print '<tr><td class="titlefield">' . $langs->trans("CreatedBy") . '</td><td>'; print '<tr><td class="titlefield">' . $langs->trans("CreatedBy") . '</td><td>';
@ -269,85 +348,6 @@ class FormTicket
} }
} }
// TITLE
if ($this->withemail) {
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">' . $langs->trans("Email") . '</span></label></td><td>';
print '<input class="text minwidth200" id="email" name="email" value="' . (GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $subject) . '" />';
print '</td></tr>';
}
// Si origin du ticket
if (isset($this->param['origin']) && $this->param['originid'] > 0) {
// Parse element/subelement (ex: project_task)
$element = $subelement = $this->param['origin'];
if (preg_match('/^([^_]+)_([^_]+)/i', $this->param['origin'], $regs)) {
$element = $regs[1];
$subelement = $regs[2];
}
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
$classname = ucfirst($subelement);
$objectsrc = new $classname($this->db);
$objectsrc->fetch(GETPOST('originid', 'int'));
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
$objectsrc->fetch_lines();
}
$objectsrc->fetch_thirdparty();
$newclassname = $classname;
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2"><input name="' . $subelement . 'id" value="' . GETPOST('originid') . '" type="hidden" />' . $objectsrc->getNomUrl(1) . '</td></tr>';
}
// Type
print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">' . $langs->trans("TicketTypeRequest") . '</span></label></td><td>';
$this->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $this->type_code), 'type_code', '', '2');
print '</td></tr>';
// Severity
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">' . $langs->trans("TicketSeverity") . '</span></label></td><td>';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2');
print '</td></tr>';
// Group
print '<tr><td><span class="fieldrequired"><label for="selectcategory_code">' . $langs->trans("TicketGroup") . '</span></label></td><td>';
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2');
print '</td></tr>';
// TITLE
if ($this->withtitletopic) {
print '<tr><td><label for="subject"><span class="fieldrequired">' . $langs->trans("Subject") . '</span></label></td><td>';
// Réponse à un ticket : affichage du titre du thread en readonly
if ($this->withtopicreadonly) {
print $langs->trans('SubjectAnswerToTicket') . ' ' . $this->topic_title;
print '</td></tr>';
} else {
if ($this->withthreadid > 0) {
$subject = $langs->trans('SubjectAnswerToTicket') . ' ' . $this->withthreadid . ' : ' . $this->topic_title . '';
}
print '<input class="text" size="50" id="subject" name="subject" value="' . (GETPOST('subject', 'alpha') ? GETPOST('subject', 'alpha') : $subject) . '" />';
print '</td></tr>';
}
}
// MESSAGE
$msg = GETPOSTISSET('message') ? GETPOST('message', 'none') : '';
print '<tr><td><label for="message"><span class="fieldrequired">' . $langs->trans("Message") . '</span></label></td><td>';
// If public form, display more information
$toolbarname = 'dolibarr_notes';
if ($this->ispublic)
{
$toolbarname = 'dolibarr_details';
print '<div class="warning">' . ($conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe')) . '</div>';
}
include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$uselocalbrowser = true;
$doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser);
$doleditor->Create();
print '</td></tr>';
if (! empty($conf->projet->enabled) && ! $this->ispublic) if (! empty($conf->projet->enabled) && ! $this->ispublic)
{ {
$formproject=new FormProjets($this->db); $formproject=new FormProjets($this->db);
@ -662,7 +662,7 @@ class FormTicket
$ticketstat->loadCacheSeveritiesTickets(); $ticketstat->loadCacheSeveritiesTickets();
print '<select id="select' . $htmlname . '" class="flat minwidth150'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">'; print '<select id="select' . $htmlname . '" class="flat minwidth100'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
if ($empty) { if ($empty) {
print '<option value="">&nbsp;</option>'; print '<option value="">&nbsp;</option>';
} }
@ -831,7 +831,8 @@ class FormTicket
print '<table class="border" width="' . $width . '">'; print '<table class="border" width="' . $width . '">';
// External users can't send message email // External users can't send message email
if ($user->rights->ticket->write && !$user->socid) { if ($user->rights->ticket->write && !$user->socid)
{
print '<tr><td width="30%"></td><td colspan="2">'; print '<tr><td width="30%"></td><td colspan="2">';
$checkbox_selected = ( GETPOST('send_email') == "1" ? ' checked' : ''); $checkbox_selected = ( GETPOST('send_email') == "1" ? ' checked' : '');
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> '; print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';

View File

@ -1759,7 +1759,7 @@ class SMTPs
* This function has been modified as provided by SirSir to allow multiline responses when * This function has been modified as provided by SirSir to allow multiline responses when
* using SMTP Extensions * using SMTP Extensions
* *
* @param Handler $socket Socket handler * @param resource $socket Socket handler
* @param string $response Response. Example: "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3" * @param string $response Response. Example: "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3"
* @return boolean True or false * @return boolean True or false
*/ */

View File

@ -152,7 +152,7 @@ class vCard
/** /**
* mise en forme de l'anniversaire * mise en forme de l'anniversaire
* *
* @param timestamp $date Date * @param integer $date Date
* @return void * @return void
*/ */
public function setBirthday($date) public function setBirthday($date)

Some files were not shown because too many files have changed in this diff Show More