';
- print '| '.$langs->trans("LatestCustomerTemplateInvoices", ($num <= $MAXLIST ? "" : $MAXLIST)).' | '.$langs->trans("AllCustomerTemplateInvoices").''.$num.' | ';
+ print ' | ';
print ' ';
}
diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php
index 370bfe9a8b9..c8b27fa4744 100644
--- a/htdocs/compta/facture/invoicetemplate_list.php
+++ b/htdocs/compta/facture/invoicetemplate_list.php
@@ -33,10 +33,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
-if (!empty($conf->projet->enabled)) {
- require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
- //require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
-}
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
@@ -54,6 +51,8 @@ $cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search
+$socid = GETPOST('socid', 'int');
+
// Security check
$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int'));
$lineid = GETPOST('lineid', 'int');
@@ -62,7 +61,6 @@ if ($user->socid) $socid = $user->socid;
$objecttype = 'facture_rec';
if ($action == "create" || $action == "add") $objecttype = '';
$result = restrictedArea($user, 'facture', $id, $objecttype);
-$projectid = GETPOST('projectid', 'int');
$search_ref = GETPOST('search_ref');
$search_societe = GETPOST('search_societe');
@@ -146,6 +144,13 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+if ($socid > 0) {
+ $tmpthirdparty = new Societe($db);
+ $res = $tmpthirdparty->fetch($socid);
+ if ($res > 0) $search_societe = $tmpthirdparty->name;
+}
+
+
/*
* Actions
@@ -218,6 +223,7 @@ $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['
/*
* List mode
*/
+
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,";
$sql .= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
$sql .= " f.datec, f.tms,";
@@ -243,6 +249,7 @@ if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
+if ($socid) $sql .= ' AND s.rowid = '.(int) $socid;
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_montant_ht != '') $sql .= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql .= natural_search('f.tva', $search_montant_vat, 1);
@@ -286,7 +293,7 @@ if ($resql)
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
- if ($socid) $param .= '&socid='.urlencode($socid);
+ if ($socid > 0) $param .= '&socid='.urlencode($socid);
if ($search_day) $param .= '&search_day='.urlencode($search_day);
if ($search_month) $param .= '&search_month='.urlencode($search_month);
if ($search_year) $param .= '&search_year='.urlencode($search_year);
@@ -299,12 +306,11 @@ if ($resql)
if ($search_montant_vat != '') $param .= '&search_montant_vat='.urlencode($search_montant_vat);
if ($search_montant_ttc != '') $param .= '&search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_payment_mode != '') $param .= '&search_payment_mode='.urlencode($search_payment_mode);
- if ($search_payment_type != '') $param .= '&search_payment_type='.urlencode($search_payment_type);
+ if ($search_payment_term != '') $param .= '&search_payment_term='.urlencode($search_payment_term);
if ($search_recurring != '' && $search_recurrning != '-1') $param .= '&search_recurring='.urlencode($search_recurring);
if ($search_frequency > 0) $param .= '&search_frequency='.urlencode($search_frequency);
if ($search_unit_frequency != '') $param .= '&search_unit_frequency='.urlencode($search_unit_frequency);
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
- if ($option) $param .= "&option=".urlencode($option);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -326,12 +332,16 @@ if ($resql)
print '';
print '';
- print_barre_liste($langs->trans("RepeatableInvoices"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit);
+ $title = $langs->trans("RepeatableInvoices");
+
+ print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit);
print ''.$langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'
';
$i = 0;
+ $moreforfilter = '';
+
print '';
print ' '."\n";
@@ -467,7 +477,6 @@ if ($resql)
print '';
print "\n";
-
print '';
if (!empty($arrayfields['f.titre']['checked'])) print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder);
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 447f5f47ecc..c9a77e5cc26 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -455,7 +455,7 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye";
$sql .= ", s.nom as name";
$sql .= ", s.rowid as socid";
- $sql .= ", s.code_fournisseur, s.code_compta_fournisseur";
+ $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.email";
$sql .= ", SUM(pf.amount) as am";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
@@ -503,10 +503,14 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->
$thirdpartystatic->id = $obj->socid;
$thirdpartystatic->name = $obj->name;
+ $thirdpartystatic->email = $obj->email;
+ $thirdpartystatic->country_id = 0;
+ $thirdpartystatic->country_code = '';
+ $thirdpartystatic->client = 0;
$thirdpartystatic->fournisseur = 1;
- //$thirdpartystatic->code_client = $obj->code_client;
+ $thirdpartystatic->code_client = '';
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
- //$thirdpartystatic->code_compta = $obj->code_compta;
+ $thirdpartystatic->code_compta = '';
$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print ' | ';
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index 4682fb62af3..aba3b665981 100644
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -277,7 +277,7 @@ if ($action == 'create')
if (! empty($conf->banque->enabled))
{
print ' | | '.$langs->trans("BankAccount").' | ';
- $form->select_comptes($_POST["accountid"], "accountid", 0, "courant=1", 1); // Affiche liste des comptes courant
+ $form->select_comptes(GETPOST("accountid", 'int'), "accountid", 0, "courant=1", 2); // List of bank account available
print ' | ';
}
diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php
index 6c1816589f4..2194fa7caab 100644
--- a/htdocs/compta/tva/document.php
+++ b/htdocs/compta/tva/document.php
@@ -70,8 +70,7 @@ if (! $sortfield) $sortfield="name";
$object = new Tva($db);
if ($id > 0) $object->fetch($id);
-$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
-$modulepart='tax';
+$upload_dir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($object->ref);
/*
@@ -144,7 +143,7 @@ if ($object->id)
dol_fiche_end();
- $modulepart = 'tax';
+ $modulepart = 'tax-vat';
$permission = $user->rights->tax->charges->creer;
$permtoedit = $user->rights->fournisseur->facture->creer;
$param = '&id=' . $object->id;
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 328507f6722..41834b8d0f6 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -741,7 +741,7 @@ while ($i < min($num, $limit))
// Date
if (!empty($arrayfields['c.date_contrat']['checked']))
{
- print ''.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzuser').' | ';
+ print ''.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').' | ';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php
index ed267493e97..94983ef6bff 100644
--- a/htdocs/core/boxes/box_task.php
+++ b/htdocs/core/boxes/box_task.php
@@ -127,15 +127,17 @@ class box_task extends ModeleBoxes
$boxcontent .= '';
$boxcontent .= ''."\n";
$boxcontent .= ''."\n";
- $boxcontent .= '';
- // set cookie by js
- $boxcontent .= '';
+ ';
+ // set cookie by js
+ $boxcontent .= '';
+ }
$this->info_box_contents[0][] = array(
'tr'=>'class="nohover showiffilter'.$this->boxcode.' hideobject"',
'td' => 'class="nohover"',
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 6012e33fb96..d09bfbade6b 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -788,81 +788,84 @@ abstract class CommonDocGenerator
{
// phpcs:enable
global $conf;
- foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
- {
- if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
+
+ if (is_array($extrafields->attributes[$object->table_element]['label'])) {
+ foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
{
- $object->array_options['options_'.$key] = price2num($object->array_options['options_'.$key]);
- $object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
- //Add value to store price with currency
- $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
- }
- elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select')
- {
- $object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
- }
- elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
- $valArray=explode(',', $object->array_options['options_'.$key]);
- $output=array();
- foreach($extrafields->attributes[$object->table_element]['param'][$key]['options'] as $keyopt=>$valopt) {
- if (in_array($keyopt, $valArray)) {
- $output[]=$valopt;
+ if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
+ {
+ $object->array_options['options_'.$key] = price2num($object->array_options['options_'.$key]);
+ $object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
+ //Add value to store price with currency
+ $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
+ }
+ elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select')
+ {
+ $object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
+ }
+ elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
+ $valArray=explode(',', $object->array_options['options_'.$key]);
+ $output=array();
+ foreach($extrafields->attributes[$object->table_element]['param'][$key]['options'] as $keyopt=>$valopt) {
+ if (in_array($keyopt, $valArray)) {
+ $output[]=$valopt;
+ }
}
+ $object->array_options['options_'.$key] = implode(', ', $output);
}
- $object->array_options['options_'.$key] = implode(', ', $output);
- }
- elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'date')
- {
- if (strlen($object->array_options['options_'.$key])>0)
+ elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'date')
{
- $date = $object->array_options['options_'.$key];
- $object->array_options['options_'.$key] = dol_print_date($date, 'day'); // using company output language
- $object->array_options['options_'.$key.'_locale'] = dol_print_date($date, 'day', 'tzserver', $outputlangs); // using output language format
- $object->array_options['options_'.$key.'_rfc'] = dol_print_date($date, 'dayrfc'); // international format
- }
- else
- {
- $object->array_options['options_'.$key] = '';
- $object->array_options['options_'.$key.'_locale'] = '';
- $object->array_options['options_'.$key.'_rfc'] = '';
- }
- $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
- $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
- }
- elseif($extrafields->attributes[$object->table_element]['label'][$key] == 'datetime')
- {
- $datetime = $object->array_options['options_'.$key];
- $object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour'):''); // using company output language
- $object->array_options['options_'.$key.'_locale'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour', 'tzserver', $outputlangs):''); // using output language format
- $object->array_options['options_'.$key.'_rfc'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhourrfc'):''); // international format
- $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
- $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
- }
- elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'link')
- {
- $id = $object->array_options['options_'.$key];
- if ($id != "")
- {
- $param = $extrafields->attributes[$object->table_element]['param'][$key];
- $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
- $InfoFieldList = explode(":", $param_list[0]);
- $classname=$InfoFieldList[0];
- $classpath=$InfoFieldList[1];
- if (! empty($classpath))
+ if (strlen($object->array_options['options_'.$key])>0)
{
- dol_include_once($InfoFieldList[1]);
- if ($classname && class_exists($classname))
+ $date = $object->array_options['options_'.$key];
+ $object->array_options['options_'.$key] = dol_print_date($date, 'day'); // using company output language
+ $object->array_options['options_'.$key.'_locale'] = dol_print_date($date, 'day', 'tzserver', $outputlangs); // using output language format
+ $object->array_options['options_'.$key.'_rfc'] = dol_print_date($date, 'dayrfc'); // international format
+ }
+ else
+ {
+ $object->array_options['options_'.$key] = '';
+ $object->array_options['options_'.$key.'_locale'] = '';
+ $object->array_options['options_'.$key.'_rfc'] = '';
+ }
+ $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
+ $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
+ }
+ elseif($extrafields->attributes[$object->table_element]['label'][$key] == 'datetime')
+ {
+ $datetime = $object->array_options['options_'.$key];
+ $object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour'):''); // using company output language
+ $object->array_options['options_'.$key.'_locale'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour', 'tzserver', $outputlangs):''); // using output language format
+ $object->array_options['options_'.$key.'_rfc'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhourrfc'):''); // international format
+ $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
+ $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
+ }
+ elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'link')
+ {
+ $id = $object->array_options['options_'.$key];
+ if ($id != "")
+ {
+ $param = $extrafields->attributes[$object->table_element]['param'][$key];
+ $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
+ $InfoFieldList = explode(":", $param_list[0]);
+ $classname=$InfoFieldList[0];
+ $classpath=$InfoFieldList[1];
+ if (! empty($classpath))
{
- $tmpobject = new $classname($this->db);
- $tmpobject->fetch($id);
- // completely replace the id with the linked object name
- $object->array_options['options_'.$key] = $tmpobject->name;
+ dol_include_once($InfoFieldList[1]);
+ if ($classname && class_exists($classname))
+ {
+ $tmpobject = new $classname($this->db);
+ $tmpobject->fetch($id);
+ // completely replace the id with the linked object name
+ $object->array_options['options_'.$key] = $tmpobject->name;
+ }
}
}
}
- }
- $array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
+ $array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
+ }
}
return $array_to_fill;
diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php
index d89db86aa10..66f1a99c394 100644
--- a/htdocs/core/class/discount.class.php
+++ b/htdocs/core/class/discount.class.php
@@ -604,14 +604,14 @@ class DiscountAbsolute
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
$sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id;
- $sql .= ' AND (f.type = 2 OR f.type = 0)'; // Find discount coming from credit note or excess received
+ $sql .= ' AND f.type IN (' . $invoice::TYPE_STANDARD . ', ' . $invoice::TYPE_CREDIT_NOTE . ', ' . $invoice::TYPE_SITUATION . ')'; // Find discount coming from credit note or excess received
}
elseif ($invoice->element == 'invoice_supplier')
{
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f';
$sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$invoice->id;
- $sql .= ' AND (f.type = 2 OR f.type = 0)'; // Find discount coming from credit note or excess paid
+ $sql .= ' AND f.type IN (' . $invoice::TYPE_STANDARD . ', ' . $invoice::TYPE_CREDIT_NOTE . ')'; // Find discount coming from credit note or excess paid
}
else
{
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index df9d4798c63..10ee91ad50f 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -455,9 +455,10 @@ class FormCompany extends Form
* @param int $country_codeid 0=list for all countries, otherwise list only country requested
* @param string $filter Add a SQL filter on list
* @param string $htmlname HTML name of select
+ * @param string $morecss More CSS
* @return string String with HTML select
*/
- public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code')
+ public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code', $morecss = '')
{
// phpcs:enable
global $conf, $langs, $user;
@@ -479,7 +480,7 @@ class FormCompany extends Form
if ($resql)
{
$out .= '';
- $out .= '
|