diff --git a/dev/tools/github_authors_peryear.sh b/dev/tools/github_authors_and_commits_peryear.sh
similarity index 100%
rename from dev/tools/github_authors_peryear.sh
rename to dev/tools/github_authors_and_commits_peryear.sh
diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 1f987f61602..ec24af642fd 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -119,8 +119,8 @@ class AccountancyExport
self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'),
- self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinum_v3'),
- self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
+ self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinumv3'),
+ self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinumv5'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
);
@@ -516,14 +516,19 @@ class AccountancyExport
}
/**
- * Export format : Quadratus
+ * Export format : Quadratus (Format ASCII)
+ * Format since 2015 compatible QuadraCOMPTA
+ * Last review for this format : 2021/09/13 Alexandre Spangaro (aspangaro@open-dsi.fr)
+ *
+ * Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html
+ * In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)"
*
* @param array $TData data
* @return void
*/
public function exportQuadratus(&$TData)
{
- global $conf;
+ global $conf, $db;
$end_line = "\r\n";
@@ -536,6 +541,44 @@ class AccountancyExport
$code_compta = $data->subledger_account;
}
+ $Tab = array();
+
+ if (!empty($data->subledger_account)) {
+ $Tab['type_ligne'] = 'C';
+ $Tab['num_compte'] = str_pad(self::trunc($data->subledger_account, 8), 8);
+ $Tab['lib_compte'] = str_pad(self::trunc($data->subledger_label, 30), 30);
+
+ if ($data->doc_type == 'customer_invoice') {
+ $Tab['lib_alpha'] = strtoupper(str_pad('C'.self::trunc($data->subledger_label, 6), 6));
+ $Tab['filler'] = str_repeat(' ', 52);
+ $Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, 8), 8);
+ } elseif ($data->doc_type == 'supplier_invoice') {
+ $Tab['lib_alpha'] = strtoupper(str_pad('F'.self::trunc($data->subledger_label, 6), 6));
+ $Tab['filler'] = str_repeat(' ', 52);
+ $Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, 8), 8);
+ } else {
+ $Tab['filler'] = str_repeat(' ', 59);
+ $Tab['coll_compte'] = str_pad(' ', 8);
+ }
+
+ $Tab['filler2'] = str_repeat(' ', 110);
+ $Tab['Maj'] = 2; // Partial update (alpha key, label, address, collectif, RIB)
+
+ if ($data->doc_type == 'customer_invoice') {
+ $Tab['type_compte'] = 'C';
+ } elseif ($data->doc_type == 'supplier_invoice') {
+ $Tab['coll_compte'] = 'F';
+ } else {
+ $Tab['coll_compte'] = 'G';
+ }
+
+ $Tab['filler3'] = str_repeat(' ', 235);
+
+ $Tab['end_line'] = $end_line;
+
+ print implode($Tab);
+ }
+
$Tab = array();
$Tab['type_ligne'] = 'M';
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index 55700fe8439..1e7c38b2607 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -369,9 +369,9 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print ''.$langs->trans("DescVentilDoneCustomer").' ';
- print '
';
print '';
print $langs->trans("LinkedToDolibarrUser");
@@ -641,7 +641,9 @@ if ($rowid > 0) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
} else {
if ($object->user_id) {
- $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
+ $linkeduser = new User($db);
+ $linkeduser->fetch($object->user_id);
+ print $linkeduser->getNomUrl(-1);
} else {
print ''.$langs->trans("NoDolibarrAccess").' ';
}
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index cd530994b9b..ab6112c0fed 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -71,6 +71,9 @@ if (empty($action) && empty($id) && empty($ref)) {
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
+if ($object->id > 0) {
+ $object->calculateCosts();
+}
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
@@ -311,8 +314,6 @@ if (($id || $ref) && $action == 'edit') {
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
- $res = $object->fetch_optionals();
-
$head = bomPrepareHead($object);
print dol_get_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom');
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 19938a049a9..91eb752451b 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -98,7 +98,7 @@ class BOM extends CommonObject
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'),
- 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
+ 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'),
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
@@ -381,7 +381,7 @@ class BOM extends CommonObject
if ($result > 0 && !empty($this->table_element_line)) {
$this->fetchLines();
}
- $this->calculateCosts();
+ //$this->calculateCosts(); // This consume a high number of subrequests. Do not call it into fetch but when you need it.
return $result;
}
@@ -1035,7 +1035,8 @@ class BOM extends CommonObject
}
/**
- * BOM costs calculation based on cost_price or pmp of each BOM line
+ * BOM costs calculation based on cost_price or pmp of each BOM line.
+ * Set the property ->total_cost and ->unit_cost of BOM.
*
* @return void
*/
@@ -1045,30 +1046,36 @@ class BOM extends CommonObject
$this->unit_cost = 0;
$this->total_cost = 0;
- require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
- $productFournisseur = new ProductFournisseur($this->db);
-
- foreach ($this->lines as &$line) {
+ if (is_array($this->lines) && count($this->lines)) {
+ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
+ $productFournisseur = new ProductFournisseur($this->db);
$tmpproduct = new Product($this->db);
- $result = $tmpproduct->fetch($line->fk_product);
- if ($result < 0) {
- $this->error = $tmpproduct->error;
- return -1;
- }
- $line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
- if (empty($line->unit_cost)) {
- if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
- $line->unit_cost = $productFournisseur->fourn_unitprice;
+
+ foreach ($this->lines as &$line) {
+ $tmpproduct->cost_price = 0;
+ $tmpproduct->pmp = 0;
+
+ $result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading
+ if ($result < 0) {
+ $this->error = $tmpproduct->error;
+ return -1;
}
+ $line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
+ if (empty($line->unit_cost)) {
+ if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
+ $line->unit_cost = $productFournisseur->fourn_unitprice;
+ }
+ }
+
+ $line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
+
+ $this->total_cost += $line->total_cost;
}
- $line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
- $this->total_cost += $line->total_cost;
- }
-
- $this->total_cost = price2num($this->total_cost, 'MT');
- if ($this->qty) {
- $this->unit_cost = price2num($this->total_cost / $this->qty, 'MU');
+ $this->total_cost = price2num($this->total_cost, 'MT');
+ if ($this->qty) {
+ $this->unit_cost = price2num($this->total_cost / $this->qty, 'MU');
+ }
}
}
}
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 461002029ae..bc9b77cc881 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1226,12 +1226,16 @@ if ($action == 'create') {
// Object linked
if (!empty($origin) && !empty($originid)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- print ' '.$langs->trans("LinkedObject").' ';
- print ''.dolGetElementUrl($originid, $origin, 1).' ';
- print ' ';
- print ' ';
- print ' ';
- print ' ';
+
+ if (! in_array($origin, array('societe', 'project', 'task', 'user'))) {
+ // We do not use link for object that already contains a hard coded
+ print ''.$langs->trans("LinkedObject").' ';
+ print ''.dolGetElementUrl($originid, $origin, 1).' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ }
}
$reg = array();
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 6bfa9de9926..5aabfc22bd1 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -735,13 +735,14 @@ class ActionComm extends CommonObject
/**
* Load object from database
*
- * @param int $id Id of action to get
- * @param string $ref Ref of action to get
- * @param string $ref_ext Ref ext to get
- * @param string $email_msgid Email msgid
- * @return int <0 if KO, >0 if OK
+ * @param int $id Id of action to get
+ * @param string $ref Ref of action to get
+ * @param string $ref_ext Ref ext to get
+ * @param string $email_msgid Email msgid
+ * @param string $loadresources 1=Load also resources
+ * @return int <0 if KO, >0 if OK
*/
- public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '')
+ public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '', $loadresources = 1)
{
global $langs;
@@ -858,7 +859,11 @@ class ActionComm extends CommonObject
$this->event_paid = $obj->event_paid;
$this->status = $obj->status;
- $this->fetchResources();
+ $this->fetch_optionals();
+
+ if ($loadresources) {
+ $this->fetchResources();
+ }
}
$this->db->free($resql);
} else {
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 95a1418b644..c96f24760c0 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -2583,7 +2583,7 @@ if ($action == 'create') {
// Create an invoice and classify billed
if ($object->statut == Propal::STATUS_SIGNED) {
if (!empty($conf->facture->enabled) && $usercancreateinvoice) {
- print ''.$langs->trans("AddBill").' ';
+ print ''.$langs->trans("CreateBill").' ';
}
$arrayofinvoiceforpropal = $object->getInvoiceArrayList();
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 02889c4c4ef..a28838756d9 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2267,7 +2267,6 @@ class Facture extends CommonInvoice
$sql .= ' SET fk_facture = NULL, fk_facture_line = NULL';
$sql .= ' WHERE fk_facture_line IN ('.$this->db->sanitize(join(',', $list_rowid_det)).')';
- dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if (!$this->db->query($sql)) {
$this->error = $this->db->error()." sql=".$sql;
$this->errors[] = $this->error;
@@ -2276,6 +2275,30 @@ class Facture extends CommonInvoice
}
}
+ // Remove other links to the deleted invoice
+
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.'eventorganization_conferenceorboothattendee';
+ $sql .= ' SET fk_invoice = NULL';
+ $sql .= ' WHERE fk_invoice = '.((int) $rowid);
+
+ if (!$this->db->query($sql)) {
+ $this->error = $this->db->error()." sql=".$sql;
+ $this->errors[] = $this->error;
+ $this->db->rollback();
+ return -5;
+ }
+
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time';
+ $sql .= ' SET invoice_id = NULL, invoice_line_id = NULL';
+ $sql .= ' WHERE invoice_id = '.((int) $rowid);
+
+ if (!$this->db->query($sql)) {
+ $this->error = $this->db->error()." sql=".$sql;
+ $this->errors[] = $this->error;
+ $this->db->rollback();
+ return -5;
+ }
+
// If we decrease stock on invoice validation, we increase back if a warehouse id was provided
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
@@ -2299,17 +2322,13 @@ class Facture extends CommonInvoice
// Invoice line extrafileds
$main = MAIN_DB_PREFIX.'facturedet';
$ef = $main."_extrafields";
- $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")";
+ $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")";
// Delete invoice line
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.((int) $rowid);
- dol_syslog(get_class($this)."::delete", LOG_DEBUG);
-
if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact()) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid);
- dol_syslog(get_class($this)."::delete", LOG_DEBUG);
-
$resql = $this->db->query($sql);
if ($resql) {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php
index 5f2d4d9a2cd..b52e4a3f554 100644
--- a/htdocs/compta/paiement/list.php
+++ b/htdocs/compta/paiement/list.php
@@ -6,7 +6,7 @@
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2015 Juanjo Menent
* Copyright (C) 2017 Alexandre Spangaro
- * Copyright (C) 2018 Ferran Marcet
+ * Copyright (C) 2018-2021 Ferran Marcet
* Copyright (C) 2018 Charlene Benke
* Copyright (C) 2020 Tobias Sekan
*
@@ -31,13 +31,6 @@
*/
require '../../main.inc.php';
-
-// Security check
-if ($user->socid) {
- $socid = $user->socid;
-}
-$result = restrictedArea($user, 'facture', $facid, '');
-
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@@ -60,6 +53,10 @@ $day = GETPOST('day', 'int');
$month = GETPOST('month', 'int');
$year = GETPOST('year', 'int');
+// Security check
+if ($user->socid) $socid = $user->socid;
+$result = restrictedArea($user, 'facture', $facid, '');
+
$search_ref = GETPOST("search_ref", "alpha");
$search_company = GETPOST("search_company", 'alpha');
$search_paymenttype = GETPOST("search_paymenttype");
@@ -277,6 +274,11 @@ $param .= (GETPOST("orphelins") ? "&orphelins=1" : '');
$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : '');
$param .= ($search_company ? "&search_company=".urlencode($search_company) : '');
$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : '');
+$param .= ($search_paymenttype ? "&search_paymenttype=".urlencode($search_paymenttype) : '');
+$param .= ($search_account ? "&search_account=".urlencode($search_account) : '');
+$param .= ($day ? "&day=".urlencode($day) : '');
+$param .= ($month ? "&month=".urlencode($month) : '');
+$param .= ($year ? "&year=".urlencode($year) : '');
$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : '');
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index efb8f03736e..b16b1640555 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -1284,7 +1284,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($objsoc->id > 0) {
$morehtmlref .= $objsoc->getNomUrl(1, 'contact');
} else {
- $morehtmlref .= $langs->trans("ContactNotLinkedToCompany");
+ $morehtmlref .= ''.$langs->trans("ContactNotLinkedToCompany").' ';
}
}
$morehtmlref .= '';
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 909178d4fb1..641c2f80902 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -447,6 +447,9 @@ abstract class CommonDocGenerator
$array_key.'_bank_iban'=>$bank_account->iban,
$array_key.'_bank_bic'=>$bank_account->bic,
+ $array_key.'_bank_label'=>$bank_account->label,
+ $array_key.'_bank_number'=>$bank_account->number,
+ $array_key.'_bank_proprio'=>$bank_account->proprio,
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
$array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index eb6ac7e882b..1f0edd23401 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1263,7 +1263,7 @@ abstract class CommonObject
if ($source == 'external' || $source == 'thirdparty') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople t on ec.fk_socpeople = t.rowid";
}
- $sql .= " WHERE ec.element_id =".$this->id;
+ $sql .= " WHERE ec.element_id =".((int) $this->id);
$sql .= " AND ec.fk_c_type_contact=tc.rowid";
$sql .= " AND tc.element='".$this->db->escape($this->element)."'";
if ($code) {
@@ -1724,6 +1724,18 @@ abstract class CommonObject
return 0;
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Load the project with id $this->fk_project into this->project
+ *
+ * @return int <0 if KO, >=0 if OK
+ */
+ public function fetch_project()
+ {
+ // phpcs:enable
+ return $this->fetch_projet();
+ }
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load the project with id $this->fk_project into this->project
@@ -7284,7 +7296,11 @@ abstract class CommonObject
dol_include_once($InfoFieldList[1]);
if ($classname && class_exists($classname)) {
$object = new $classname($this->db);
- $object->fetch($value);
+ if ($object->element === 'product') { // Special cas for product because default valut of fetch are wrong
+ $object->fetch($value, '', '', '', 0, 1, 1);
+ } else {
+ $object->fetch($value);
+ }
$value = $object->getNomUrl($getnomurlparam, $getnomurlparam2);
}
} else {
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 7137d843ba7..221e641ad8d 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -6769,13 +6769,15 @@ class Form
// Search data
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t";
- if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) {
- $tmparray = explode('@', $objecttmp->ismultientitymanaged);
- $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0];
- }
- if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
- if (!$user->rights->societe->client->voir && !$user->socid) {
- $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (isset($objecttmp->ismultientitymanaged)) {
+ if (!is_numeric($objecttmp->ismultientitymanaged)) {
+ $tmparray = explode('@', $objecttmp->ismultientitymanaged);
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX.$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];
+ }
+ if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
+ if (!$user->rights->societe->client->voir && !$user->socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
}
}
@@ -6786,17 +6788,24 @@ class Form
$sql .= $hookmanager->resPrint;
} else {
$sql .= " WHERE 1=1";
- if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) {
- $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
- }
- if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) {
- $sql .= ' AND parenttable.entity = t.'.$tmparray[0];
- }
- if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
- if ($objecttmp->element == 'societe') {
- $sql .= " AND t.rowid = ".((int) $user->socid);
- } else {
- $sql .= " AND t.fk_soc = ".((int) $user->socid);
+ if (isset($objecttmp->ismultientitymanaged)) {
+ if ($objecttmp->ismultientitymanaged == 1) {
+ $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
+ }
+ if (!is_numeric($objecttmp->ismultientitymanaged)) {
+ $sql .= " AND parenttable.entity = t.".$tmparray[0];
+ }
+ if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
+ if ($objecttmp->element == 'societe') {
+ $sql .= " AND t.rowid = ".((int) $user->socid);
+ } else {
+ $sql .= " AND t.fk_soc = ".((int) $user->socid);
+ }
+ }
+ if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
+ if (!$user->rights->societe->client->voir && !$user->socid) {
+ $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
+ }
}
}
if ($searchkey != '') {
diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php
index 8e03f158a02..13619fe5aa3 100644
--- a/htdocs/core/class/html.formadmin.class.php
+++ b/htdocs/core/class/html.formadmin.class.php
@@ -73,6 +73,18 @@ class FormAdmin
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly);
+ // If the language to select is not inside the list of available language and empty value is not available, we must find
+ // an alternative as the language code to pre-select (to avoid to have first element in list pre-selected).
+ if ($selected && !in_array($selected, $langs_available) && empty($showempty)) {
+ $tmparray = explode('_', $selected);
+ if (!empty($tmparray[1])) {
+ $selected = getLanguageCodeFromCountryCode($tmparray[1]);
+ }
+ if (empty($selected)) {
+ $selected = $langs->defaultlang;
+ }
+ }
+
$out = '';
$out .= '';
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index 0e8fd3ee7b4..e2ce33cc45f 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -486,6 +486,11 @@ class Ldap
// For better compatibility with Samba4 AD
if ($this->serverType == "activedirectory") {
unset($info['cn']); // To avoid error : Operation not allowed on RDN (Code 67)
+
+ // To avoid error : LDAP Error: 53 (Unwilling to perform)
+ if (isset($info['unicodePwd'])) {
+ $info['unicodePwd'] = mb_convert_encoding("\"".$info['unicodePwd']."\"", "UTF-16LE", "UTF-8");
+ }
}
$result = @ldap_modify($this->connection, $dn, $info);
diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php
index db63b1a75d4..175c2fa1981 100644
--- a/htdocs/core/js/lib_head.js.php
+++ b/htdocs/core/js/lib_head.js.php
@@ -1128,7 +1128,7 @@ function price2numjs(amount) {
var res = Math.round10(amount, - rounding);
// Other solution is
// var res = dolroundjs(amount, rounding)
- console.log("res="+res)
+ console.log("price2numjs text="+amount+" return="+res);
return res;
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 9b3156f485c..3ae97098a79 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -8192,8 +8192,8 @@ function picto_from_langcode($codelang, $moreatt = '')
* Return default language from country code.
* Return null if not found.
*
- * @param string $countrycode Country code like 'US', 'FR', 'CA', 'ES', 'MX', ...
- * @return string Value of locale like 'en_US', 'fr_FR', ...
+ * @param string $countrycode Country code like 'US', 'FR', 'CA', 'ES', 'IN', 'MX', ...
+ * @return string Value of locale like 'en_US', 'fr_FR', ... or null if not found
*/
function getLanguageCodeFromCountryCode($countrycode)
{
@@ -8243,12 +8243,12 @@ function getLanguageCodeFromCountryCode($countrycode)
'ar-SY',
'ar-TN',
'ar-YE',
- 'as-IN',
+ //'as-IN', // Moved after en-IN
'ba-RU',
'be-BY',
'bg-BG',
'bn-BD',
- 'bn-IN',
+ //'bn-IN', // Moved after en-IN
'bo-CN',
'br-FR',
'ca-ES',
@@ -8269,6 +8269,8 @@ function getLanguageCodeFromCountryCode($countrycode)
'en-GB',
'en-IE',
'en-IN',
+ 'as-IN', // as-IN must be after en-IN (en in priority if country is IN)
+ 'bn-IN', // bn-IN must be after en-IN (en in priority if country is IN)
'en-JM',
'en-MY',
'en-NZ',
@@ -8406,7 +8408,7 @@ function getLanguageCodeFromCountryCode($countrycode)
$locale_language = locale_get_primary_language($locale);
$locale_region = locale_get_region($locale);
if (strtoupper($countrycode) == $locale_region) {
- //var_dump($locale.'-'.$locale_language.'-'.$locale_region);
+ //var_dump($locale.' - '.$locale_language.' - '.$locale_region);
return strtolower($locale_language).'_'.strtoupper($locale_region);
}
}
@@ -8846,7 +8848,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
if ($newcrit != '') {
$numnewcrit = price2num($newcrit);
if (is_numeric($numnewcrit)) {
- $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$db->sanitize($numnewcrit); // should be a numeric
+ $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.((float) $numnewcrit); // should be a numeric
} else {
$newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false
}
@@ -8905,7 +8907,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '');
if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field
- $newres .= $field." = ".(is_numeric(trim($tmpcrit)) ?trim($tmpcrit) : '0');
+ $newres .= $field." = ".(is_numeric(trim($tmpcrit)) ? ((float) trim($tmpcrit)) : '0');
} else {
$newres .= $field." LIKE '";
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 4c36244a5bf..da5d9388bd8 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -513,8 +513,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (!$user->rights->salaries->delete) {
$deleteok = 0;
}
- } elseif ($feature == 'salaries') {
- if (!$user->rights->salaries->delete) {
+ } elseif ($feature == 'adherent') {
+ if (!$user->rights->adherent->supprimer) {
$deleteok = 0;
}
} elseif (!empty($feature2)) { // This is for permissions on 2 levels
diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php
index e1af900371d..8d12fcd4da5 100644
--- a/htdocs/eventorganization/class/conferenceorbooth.class.php
+++ b/htdocs/eventorganization/class/conferenceorbooth.class.php
@@ -106,8 +106,8 @@ class ConferenceOrBooth extends ActionComm
'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"Help text", 'showoncombobox'=>'1',),
- 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'maxwidth500'),
- 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project'),
+ 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
+ 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'),
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
index f619b5459c3..572d6f13856 100644
--- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php
+++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
@@ -103,14 +103,15 @@ class ConferenceOrBoothAttendee extends CommonObject
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"),
- 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'Attendee', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'maxwidth500'),
- 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
- 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project'),
- 'email' => array('type'=>'mail', 'label'=>'Email', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
+ 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
+ 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
+ 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
+ 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',),
+ 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'),
'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",),
- 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
- 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
+ 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>3,),
+ 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>3,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>-1, 'visible'=>-2),
@@ -126,6 +127,7 @@ class ConferenceOrBoothAttendee extends CommonObject
public $fk_actioncomm;
public $email;
public $date_subscription;
+ public $fk_invoice;
public $amount;
public $note_public;
public $note_private;
@@ -634,6 +636,31 @@ class ConferenceOrBoothAttendee extends CommonObject
}
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Load the project with id $this->fk_project into this->project
+ *
+ * @return int <0 if KO, >=0 if OK
+ */
+ public function fetch_projet()
+ {
+ // phpcs:enable
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+
+ if (empty($this->fk_project) && !empty($this->fk_projet)) {
+ $this->fk_project = $this->fk_projet; // For backward compatibility
+ }
+ if (empty($this->fk_project)) {
+ return 0;
+ }
+
+ $project = new Project($this->db);
+ $result = $project->fetch($this->fk_project);
+
+ $this->projet = $project; // deprecated
+ $this->project = $project;
+ return $result;
+ }
/**
* Set draft status
@@ -836,6 +863,17 @@ class ConferenceOrBoothAttendee extends CommonObject
return $result;
}
+ /**
+ * Return the label of the status
+ *
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function getLabelStatus($mode = 0)
+ {
+ return $this->LibStatut($this->status, $mode);
+ }
+
/**
* Return the label of the status
*
diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php
index ea54d1e3d2f..0ca8697b9d0 100644
--- a/htdocs/eventorganization/conferenceorbooth_card.php
+++ b/htdocs/eventorganization/conferenceorbooth_card.php
@@ -152,8 +152,6 @@ if (empty($reshook)) {
/*
* View
- *
- * Put here all code to build page
*/
$form = new Form($db);
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index c46798b05b5..5f6e2820591 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -55,6 +55,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ''
$id = GETPOST('id', 'int');
$projectid = GETPOST('projectid', 'int');
+$projectref = GETPOST('ref');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@@ -152,12 +153,12 @@ if (!$permissiontoread) accessforbidden();
* Actions
*/
-if (preg_match('/^set/', $action) && $projectid > 0 && !empty($user->rights->eventorganization->write)) {
+if (preg_match('/^set/', $action) && ($projectid > 0 || $projectref) && !empty($user->rights->eventorganization->write)) {
$project = new Project($db);
//If "set" fields keys is in projects fields
$project_attr=preg_replace('/^set/', '', $action);
if (array_key_exists($project_attr, $project->fields)) {
- $result = $project->fetch($projectid);
+ $result = $project->fetch($projectid, $projectref);
if ($result < 0) {
setEventMessages(null, $project->errors, 'errors');
} else {
@@ -234,11 +235,13 @@ $now = dol_now();
$help_url = '';
$title = $langs->trans('ListOfConferencesOrBooths');
-if ($projectid > 0) {
+if ($projectid > 0 || $projectref) {
$project = new Project($db);
- $result = $project->fetch($projectid);
+ $result = $project->fetch($projectid, $projectref);
if ($result < 0) {
setEventMessages(null, $project->errors, 'errors');
+ } else {
+ $projectid = $project->id;
}
$result = $project->fetch_thirdparty();
if ($result < 0) {
@@ -430,8 +433,8 @@ if ($projectid > 0) {
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '';
print '';
- $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id;
- $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 'md5');
+ $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $project->id);
+ $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.((int) $project->id), 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '';
//print ' ';
@@ -447,8 +450,8 @@ if ($projectid > 0) {
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '';
print '
';
- $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$project->id.'&type=global';
- $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 'md5');
+ $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.((int) $project->id).'&type=global';
+ $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.((int) $project->id), 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '';
//print '
';
@@ -582,7 +585,7 @@ if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
- header("Location: ".dol_buildpath('/eventorganization/conferenceorbooth_card.php', 1).'?id='.$id);
+ header("Location: ".DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.((int) $id));
exit;
}
diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php
index 4206b802be3..0517210333f 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_card.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_card.php
@@ -48,7 +48,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$conf_or_booth_id = GETPOST('conforboothid', 'int');
$fk_project = GETPOST('fk_project', 'int');
-$withproject = GETPOST('withproject', 'int');
+$withproject = 1;
// Initialize technical objects
$object = new ConferenceOrBoothAttendee($db);
@@ -65,6 +65,7 @@ if ($conf_or_booth_id > 0) {
} else {
$object->fk_actioncomm = $confOrBooth->id;
$object->fk_project = $confOrBooth->fk_project;
+ $fk_project = $object->fk_project;
}
}
@@ -74,12 +75,24 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
-$search_all = GETPOST("search_all", 'alpha');
+$search_all = GETPOST('search_all', 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val) {
- if (GETPOST('search_'.$key, 'alpha')) {
+ if (GETPOST('search_'.$key, 'alpha') !== '') {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
+ if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
+ $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
+ $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
+ }
+}
+
+// List of fields to search into when doing a "search in all"
+$fieldstosearchall = array();
+foreach ($object->fields as $key => $val) {
+ if (!empty($val['searchall'])) {
+ $fieldstosearchall['t.'.$key] = $val['label'];
+ }
}
if (empty($action) && empty($id) && empty($ref)) {
@@ -174,8 +187,6 @@ if (empty($reshook)) {
/*
* View
- *
- * Put here all code to build page
*/
$form = new Form($db);
@@ -305,7 +316,7 @@ if (!empty($withproject)) {
print '
';
print '
';
- print '
';
+ print '';
// Description
print ''.$langs->trans("Description").' ';
@@ -319,7 +330,7 @@ if (!empty($withproject)) {
print " ";
}
- print '';
+ print ' ';
$typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
$htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
@@ -336,15 +347,15 @@ if (!empty($withproject)) {
print " ";
print '';
- print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
+ print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print ' ';
- print $form->editfieldval('PriceOfRegistration', 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
+ print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print " ";
print '';
- print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
+ print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print ' ';
- print $form->editfieldval('PriceOfBooth', 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
+ print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
print " ";
print ''.$langs->trans("EventOrganizationICSLink").' ';
@@ -353,7 +364,7 @@ if (!empty($withproject)) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message
- $message = 'entity : "");
+ $message = ' entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').' ';
print $message;
@@ -366,7 +377,7 @@ if (!empty($withproject)) {
//print '';
print ' ';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
- $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
+ $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '';
//print ' ';
@@ -383,7 +394,7 @@ if (!empty($withproject)) {
//print '';
print '
';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_register.php?id='.$projectstatic->id.'&type=global';
- $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
+ $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '';
//print '
';
@@ -565,6 +576,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '
';
print '
'."\n";
+ $keyforbreak = 'note_public';
+
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php
index d51a9014afb..801ecb1d69f 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_list.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_list.php
@@ -97,7 +97,7 @@ if (!$sortorder) {
}
// Initialize array of search criterias
-$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
+$search_all = GETPOST('search_all', 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
@@ -369,8 +369,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
}
-// Output page
-// --------------------------------------------------------------------
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
@@ -646,22 +644,25 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
- $param .= '&search_'.$key.'[]='.urlencode($skey);
+ if ($skey != '') {
+ $param .= '&search_'.$key.'[]='.urlencode($skey);
+ }
}
- } else {
+ } elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
if ($confOrBooth->id > 0) {
- $param .= '&conforboothid='.urlencode($confOrBooth->id).$withProjectUrl;
+ $param .= '&conforboothid='.urlencode($confOrBooth->id);
}
if ($projectstatic->id > 0) {
- $param .= '&fk_project='.urlencode($projectstatic->id).$withProjectUrl;
+ $param .= '&fk_project='.urlencode($projectstatic->id);
}
-
+$param .= $withProjectUrl;
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
+
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
@@ -694,6 +695,8 @@ print ' ';
print ' ';
print ' ';
print ' ';
+print ' ';
+print ' ';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd);
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 8c959116582..902914c4327 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -2553,7 +2553,7 @@ if ($action == 'create') {
// Presend form
$modelmail = 'shipping_send';
$defaulttopic = 'SendShippingRef';
- $diroutput = $conf->expedition->dir_output.'/sending';
+ $diroutput = $conf->expedition->dir_output;
$trackid = 'shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 85245b38e89..20dfd81f277 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1459,8 +1459,8 @@ class Expedition extends CommonObject
}
}
- // delete batch expedition line
- if (!$error && $conf->productbatch->enabled) {
+ // delete batch expedition line (we try deletion even if module not enabled in case of the module were enabled and disabled previously)
+ if (!$error) {
if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 50a59e0d2e4..3660b8a5cbe 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -402,16 +402,16 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
if ($sall) {
- $param .= "&sall=".urlencode($sall);
+ $param .= "&sall=".urlencode($sall);
}
if ($search_ref_exp) {
- $param .= "&search_ref_exp=".urlencode($search_ref_exp);
+ $param .= "&search_ref_exp=".urlencode($search_ref_exp);
}
if ($search_ref_liv) {
- $param .= "&search_ref_liv=".urlencode($search_ref_liv);
+ $param .= "&search_ref_liv=".urlencode($search_ref_liv);
}
if ($search_ref_customer) {
- $param .= "&search_ref_customer=".urlencode($search_ref_customer);
+ $param .= "&search_ref_customer=".urlencode($search_ref_customer);
}
if ($search_user > 0) {
$param .= '&search_user='.urlencode($search_user);
@@ -420,10 +420,10 @@ if ($search_sale > 0) {
$param .= '&search_sale='.urlencode($search_sale);
}
if ($search_company) {
- $param .= "&search_company=".urlencode($search_company);
+ $param .= "&search_company=".urlencode($search_company);
}
if ($search_tracking) {
- $param .= "&search_tracking=".urlencode($search_tracking);
+ $param .= "&search_tracking=".urlencode($search_tracking);
}
if ($search_town) {
$param .= '&search_town='.urlencode($search_town);
@@ -768,7 +768,7 @@ while ($i < min($num, $limit)) {
// Ref
if (!empty($arrayfields['e.ref']['checked'])) {
- print "";
+ print ' ';
print $shipment->getNomUrl(1);
print " \n";
if (!$i) {
@@ -788,7 +788,7 @@ while ($i < min($num, $limit)) {
// Third party
if (!empty($arrayfields['s.nom']['checked'])) {
- print '';
+ print ' ';
print $companystatic->getNomUrl(1);
print ' ';
if (!$i) {
@@ -806,7 +806,7 @@ while ($i < min($num, $limit)) {
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
- print '';
+ print ' ';
print $obj->zip;
print ' ';
if (!$i) {
@@ -815,7 +815,7 @@ while ($i < min($num, $limit)) {
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
- print "".$obj->state_name." \n";
+ print ''.$obj->state_name." \n";
if (!$i) {
$totalarray['nbfield']++;
}
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index fd393445187..4bca77809cb 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -2440,7 +2440,7 @@ class FactureFournisseur extends CommonInvoice
if ($facturestatic->hasDelay()) {
$response->nbtodolate++;
- $response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
+ $response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?search_option=late&mainmenu=billing&leftmenu=suppliers_bills';
}
}
$this->db->free($resql);
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 42e2f528bc6..db1497f5166 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -680,6 +680,7 @@ if (empty($reshook)) {
if ($socid > 0) {
$object->socid = GETPOST('socid', 'int');
}
+ $selectedLines = GETPOST('toselect', 'array');
$db->begin();
@@ -1112,6 +1113,10 @@ if (empty($reshook)) {
$num = count($lines);
for ($i = 0; $i < $num; $i++) { // TODO handle subprice < 0
+ if (!in_array($lines[$i]->id, $selectedLines)) {
+ continue; // Skip unselected lines
+ }
+
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
@@ -2348,9 +2353,6 @@ if ($action == 'create') {
print ' ';
print '';
- print "\n";
-
-
// Show origin lines
if (is_object($objectsrc)) {
print ' ';
@@ -2364,6 +2366,8 @@ if ($action == 'create') {
print '
';
}
+
+ print "\n";
} else {
if ($id > 0 || !empty($ref)) {
//
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 0d34a3790df..ac64a9af82e 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -119,7 +119,7 @@ $search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
$search_categ_sup = trim(GETPOST("search_categ_sup", 'int'));
-$option = GETPOST('option');
+$option = GETPOST('search_option');
if ($option == 'late') {
$search_status = '1';
}
@@ -803,7 +803,7 @@ if ($resql) {
$param .= '&show_files='.urlencode($show_files);
}
if ($option) {
- $param .= "&option=".urlencode($option);
+ $param .= "&search_option=".urlencode($option);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
@@ -1428,9 +1428,9 @@ if ($resql) {
// Date limit
if (!empty($arrayfields['f.date_lim_reglement']['checked'])) {
- print '
'.dol_print_date($datelimit, 'day');
+ print ' '.dol_print_date($datelimit, 'day');
if ($facturestatic->hasDelay()) {
- print img_warning($langs->trans('Late'));
+ print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
}
print ' ';
if (!$i) {
diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php
index 40d36e5e4f6..2ac24706cb6 100644
--- a/htdocs/fourn/paiement/list.php
+++ b/htdocs/fourn/paiement/list.php
@@ -47,6 +47,9 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 've
$socid = GETPOST('socid', 'int');
+// Security check
+if ($user->socid) $socid = $user->socid;
+
$search_ref = GETPOST('search_ref', 'alpha');
$search_day = GETPOST('search_day', 'int');
$search_month = GETPOST('search_month', 'int');
diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php
index e7a09abea6e..56ae2b29323 100644
--- a/htdocs/holiday/list.php
+++ b/htdocs/holiday/list.php
@@ -627,6 +627,12 @@ if ($resql) {
print '
';
}
+ // End date
+ if (!empty($arrayfields['cp.date_valid']['checked'])) {
+ print '';
+ print ' ';
+ }
+
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
@@ -687,6 +693,9 @@ if ($resql) {
if (!empty($arrayfields['cp.date_fin']['checked'])) {
print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center ');
}
+ if (!empty($arrayfields['cp.date_valid']['checked'])) {
+ print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
+ }
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@@ -816,6 +825,18 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
+ if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval
+ print '';
+ print dol_print_date($db->jdate($obj->date_valid), 'day');
+ print ' ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+ /*if (!empty($arrayfields['cp.date_approve']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_approve), 'day');
+ print ' ';
+ if (!$i) $totalarray['nbfield']++;
+ }*/
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql
index 69a41a5b3ef..bce46a70e49 100644
--- a/htdocs/install/mysql/data/llx_c_email_templates.sql
+++ b/htdocs/install/mysql/data/llx_c_email_templates.sql
@@ -35,12 +35,13 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__, \n\n__(YourCandidatureAnswerMessage)__ __ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n \n__(Sincerely)__ __USER_SIGNATURE__',null, 0);
-- Event organization
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__ __(Sincerely)__ __MYCOMPANY_NAME__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__, __(OrganizationEventConfRequestWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__, __(OrganizationEventBoothRequestWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+-- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__, __(OrganizationEventPaymentOfBoothWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__, __(OrganizationEventPaymentOfRegistrationWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__, __(OrganizationEventBulkMailToAttendees)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__, __(OrganizationEventBulkMailToSpeakers)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-- Partnership
INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipWillSoonBeCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipWillSoonBeCanceledTopic)__', 0, '\n __(Hello)__, \n__(YourPartnershipWillSoonBeCanceledContent)__
\n \n\n \n\n __(Sincerely)__ \n __[MAIN_INFO_SOCIETE_NOM]__ \n \n');
diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
index e9c8779ca4b..63f20198658 100644
--- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -268,12 +268,13 @@ ALTER TABLE llx_tva ALTER COLUMN paye SET DEFAULT 0;
-- Event organization
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__ __(Sincerely)__ __MYCOMPANY_NAME__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__, __(OrganizationEventConfRequestWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__, __(OrganizationEventBoothRequestWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+-- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__, __(OrganizationEventPaymentOfBoothWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__, __(OrganizationEventPaymentOfRegistrationWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__, __(OrganizationEventBulkMailToAttendees)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__, __(OrganizationEventBulkMailToSpeakers)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
ALTER TABLE llx_projet ADD COLUMN accept_conference_suggestions integer DEFAULT 0;
ALTER TABLE llx_projet ADD COLUMN accept_booth_suggestions integer DEFAULT 0;
@@ -402,6 +403,7 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
fk_soc integer,
fk_actioncomm integer,
fk_project integer NOT NULL,
+ fk_invoice integer NULL,
email varchar(100),
date_subscription datetime,
amount double DEFAULT NULL,
@@ -421,6 +423,7 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
-- VPGSQL8.2 ALTER TABLE llx_eventorganization_conferenceorboothattendee ALTER COLUMN fk_actioncomm DROP NOT NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
+ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
diff --git a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql
index 6d01cf4bba1..b505f8f6a31 100644
--- a/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql
+++ b/htdocs/install/mysql/tables/llx_eventorganization_conferenceorboothattendee.sql
@@ -21,6 +21,7 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
fk_soc integer,
fk_actioncomm integer,
fk_project integer NOT NULL,
+ fk_invoice integer NULL,
email varchar(100),
date_subscription datetime,
amount double DEFAULT NULL,
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index 771f0a83e7b..fc4b86a2cdb 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -343,7 +343,7 @@ Modelcsv_ciel=Export for Sage50, Ciel Compta or Compta Evo. (Format XIMPORT)
Modelcsv_quadratus=Export for Quadratus QuadraCompta
Modelcsv_ebp=Export for EBP
Modelcsv_cogilog=Export for Cogilog
-Modelcsv_agiris=Export for Agiris
+Modelcsv_agiris=Export for Agiris Isacompta
Modelcsv_LDCompta=Export for LD Compta (v9) (Test)
Modelcsv_LDCompta10=Export for LD Compta (v10 & higher)
Modelcsv_openconcerto=Export for OpenConcerto (Test)
@@ -351,9 +351,10 @@ Modelcsv_configurable=Export CSV Configurable
Modelcsv_FEC=Export FEC
Modelcsv_FEC2=Export FEC (With dates generation writing / document reversed)
Modelcsv_Sage50_Swiss=Export for Sage 50 Switzerland
-Modelcsv_winfic=Export Winfic - eWinfic - WinSis Compta
+Modelcsv_winfic=Export for Winfic - eWinfic - WinSis Compta
Modelcsv_Gestinumv3=Export for Gestinum (v3)
-Modelcsv_Gestinumv5Export for Gestinum (v5)
+Modelcsv_Gestinumv5=Export for Gestinum (v5)
+Modelcsv_charlemagne=Export for Aplim Charlemagne
ChartofaccountsId=Chart of accounts Id
## Tools - Init accounting account on product / service
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index ef1c1deb3b5..367f68e6a9b 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -896,6 +896,11 @@ Permission1002=Create/modify warehouses
Permission1003=Delete warehouses
Permission1004=Read stock movements
Permission1005=Create/modify stock movements
+Permission1011=View inventories
+Permission1012=Create new inventory
+Permission1014=Validate inventory
+Permission1015=Allow to change PMP value for a product
+Permission1016=Delete inventory
Permission1101=Read delivery receipts
Permission1102=Create/modify delivery receipts
Permission1104=Validate delivery receipts
diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang
index a0bb5ab3c2f..52b00c7e592 100644
--- a/htdocs/langs/en_US/eventorganization.lang
+++ b/htdocs/langs/en_US/eventorganization.lang
@@ -67,8 +67,8 @@ YourOrganizationEventConfRequestWasReceived = Your request for conference was re
YourOrganizationEventBoothRequestWasReceived = Your request for booth was received
EventOrganizationEmailAskConf = Request for conference
EventOrganizationEmailAskBooth = Request for booth
-EventOrganizationEmailSubsBooth = Subscription for booth
-EventOrganizationEmailSubsEvent = Subscription for an event
+EventOrganizationEmailBoothPayment = Payment of your booth
+EventOrganizationEmailRegistrationPayment = Registration for an event
EventOrganizationMassEmailAttendees = Communication to attendees
EventOrganizationMassEmailSpeakers = Communication to speakers
@@ -130,6 +130,12 @@ DateMustBeBeforeThan=%s must be before %s
DateMustBeAfterThan=%s must be after %s
NewSubscription=Registration
+OrganizationEventConfRequestWasReceived=Your suggestion for a conference has been received
+OrganizationEventBoothRequestWasReceived=Your request for a booth has been received
+OrganizationEventPaymentOfBoothWasReceived=Your payment for your booth has been recorded
+OrganizationEventPaymentOfRegistrationWasReceived=Your payment for your event registration has been recorded
+OrganizationEventBulkMailToAttendees=This is a remind about your participation in the event as an attendee
+OrganizationEventBulkMailToSpeakers=This is a reminder on your participation in the event as a speaker
#
# Vote page
@@ -149,3 +155,7 @@ PaymentConferenceAttendee = Conference attendee payment
PaymentBoothLocation = Booth location payment
RegistrationAndPaymentWereAlreadyRecorder=A registration and a payment were already recorded for the email %s
+EmailAttendee=Attendee email
+EmailCompanyForInvoice=Company email (for invoice, if different of attendee email)
+ErrorSeveralCompaniesWithEmailContactUs=Several companies with this email has been found so we can't validate automaticaly your registration. Please contact us at %s for a manual validation
+ErrorSeveralCompaniesWithNameContactUs=Several companies with this name has been found so we can't validate automaticaly your registration. Please contact us at %s for a manual validation
\ No newline at end of file
diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang
index e3b6bed94c8..ca962811831 100644
--- a/htdocs/langs/en_US/languages.lang
+++ b/htdocs/langs/en_US/languages.lang
@@ -6,6 +6,7 @@ Language_ar_MA=Arabic (Moroco)
Language_ar_SA=Arabic
Language_ar_TN=Arabic (Tunisia)
Language_ar_IQ=Arabic (Iraq)
+Language_as_IN=Assamese
Language_az_AZ=Azerbaijani
Language_bn_BD=Bengali
Language_bn_IN=Bengali (India)
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 1d975f5ab5a..9bcf6238b36 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1039,6 +1039,18 @@ if (!defined('NOLOGIN')) {
$user->rights->user->user->supprimer = 1;
$user->rights->user->self->creer = 1;
$user->rights->user->self->password = 1;
+
+ //Required if advanced permissions are used with MAIN_USE_ADVANCED_PERMS
+ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
+ $user->rights->user->user_advance->readperms = 1;
+ $user->rights->user->user_advance->write = 1;
+ $user->rights->user->self_advance->readperms = 1;
+ $user->rights->user->self_advance->writeperms = 1;
+ $user->rights->user->group_advance->read = 1;
+ $user->rights->user->group_advance->readperms = 1;
+ $user->rights->user->group_advance->write = 1;
+ $user->rights->user->group_advance->delete = 1;
+ }
}
/*
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index c93d5dd48e6..dd67a65238b 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -845,6 +845,17 @@ class MyObject extends CommonObject
return $result;
}
+ /**
+ * Return the label of the status
+ *
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function getLabelStatus($mode = 0)
+ {
+ return $this->LibStatut($this->status, $mode);
+ }
+
/**
* Return the label of the status
*
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index 2d7b89505bf..fe067eb7fc5 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -134,7 +134,7 @@ if (!$sortorder) {
}
// Initialize array of search criterias
-$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
+$search_all = GETPOST('search_all', 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
@@ -414,9 +414,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
- $param .= '&search_'.$key.'[]='.urlencode($skey);
+ if ($skey != '') {
+ $param .= '&search_'.$key.'[]='.urlencode($skey);
+ }
}
- } else {
+ } elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php
index 012b43ff61a..cfff1fb6181 100644
--- a/htdocs/mrp/mo_list.php
+++ b/htdocs/mrp/mo_list.php
@@ -84,7 +84,7 @@ if (!$sortorder) {
}
// Initialize array of search criterias
-$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
+$search_all = GETPOST('search_all', 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
@@ -270,8 +270,7 @@ $sql .= $hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY ";
-foreach($object->fields as $key => $val)
-{
+foreach($object->fields as $key => $val) {
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
@@ -343,9 +342,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
- $param .= '&search_'.$key.'[]='.urlencode($skey);
+ if ($skey != '') {
+ $param .= '&search_'.$key.'[]='.urlencode($skey);
+ }
}
- } else {
+ } elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php
index 8b8642c9f0c..11286c12d3d 100644
--- a/htdocs/partnership/class/partnership.class.php
+++ b/htdocs/partnership/class/partnership.class.php
@@ -121,6 +121,7 @@ class Partnership extends CommonObject
'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>63, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',),
'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>-2,),
'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>64, 'notnull'=>0, 'visible'=>-2,),
+ // fk_member and fk_soc are added into constructor
);
/**
@@ -197,9 +198,9 @@ class Partnership extends CommonObject
$this->db = $db;
if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
- $this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member');
+ $this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member', 'csslist'=>'tdoverflowmax150');
} else {
- $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company');
+ $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'csslist'=>'tdoverflowmax150');
}
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index bb80dcba862..d746bf4a812 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1008,7 +1008,6 @@ class Product extends CommonObject
$this->accountancy_code_sell_export = trim($this->accountancy_code_sell_export);
-
$this->db->begin();
$result = 0;
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 01a09a21335..9aaa0aa2c8c 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2013 Laurent Destailleur
+ * Copyright (C) 2004-2021 Laurent Destailleur
* Copyright (C) 2004 Eric Seigne
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2010-2012 Juanjo Menent
@@ -54,7 +54,9 @@ $cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'pricesuppliercard';
$socid = GETPOST('socid', 'int');
-$cost_price = GETPOST('cost_price', 'alpha');
+$cost_price = price2num(GETPOST('cost_price', 'alpha'), '', 2);
+$pmp = price2num(GETPOST('pmp', 'alpha'), '', 2);
+
$backtopage = GETPOST('backtopage', 'alpha');
$error = 0;
@@ -147,13 +149,29 @@ if (empty($reshook)) {
}
}
}
+ if ($action == 'setpmp') {
+ if ($id) {
+ $result = $object->fetch($id);
+ $object->pmp = price2num($pmp);
+ $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".((float) $object->pmp)." WHERE rowid = ".((int) $id);
+ $resql = $db->query($sql);
+ //$result = $object->update($object->id, $user);
+ if ($resql) {
+ setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
+ $action = '';
+ } else {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+ }
if ($action == 'confirm_remove_pf') {
if ($rowid) { // id of product supplier price to remove
$action = '';
$result = $object->remove_product_fournisseur_price($rowid);
if ($result > 0) {
- $db->query("DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = $rowid");
+ $db->query("DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".((int) $rowid));
setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs');
} else {
$error++;
@@ -425,11 +443,25 @@ if ($id > 0 || $ref) {
print ' ';
// PMP
- print ''.$form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")).' ';
+ $usercaneditpmp = 0;
+ if (!empty($conf->global->PRODUCT_CAN_EDIT_WAP)) {
+ $usercaneditpmp = $usercancreate;
+ }
+ print '';
+ $textdesc = $langs->trans("AverageUnitPricePMPDesc");
+ $text = $form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $textdesc, 1, 'help', '');
+ print $form->editfieldkey($text, 'pmp', $object->pmp, $object, $usercaneditpmp, 'amount:6');
+ print ' ';
+ print $form->editfieldval($text, 'pmp', ($object->pmp > 0 ? $object->pmp : ''), $object, $usercaneditpmp, 'amount:6');
+ if ($object->pmp > 0) {
+ print ' '.$langs->trans("HT");
+ }
+ /*
+ .$form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")).' ';
print '';
if ($object->pmp > 0) {
print price($object->pmp).' '.$langs->trans("HT");
- }
+ }*/
print ' ';
print ' ';
@@ -623,7 +655,7 @@ if ($id > 0 || $ref) {
// Currency
print ''.$langs->trans("Currency").' ';
print '';
- $currencycodetouse = GETPOST('multicurrency_code') ?GETPOST('multicurrency_code') : (isset($object->fourn_multicurrency_code) ? $object->fourn_multicurrency_code : '');
+ $currencycodetouse = GETPOST('multicurrency_code') ? GETPOST('multicurrency_code') : (isset($object->fourn_multicurrency_code) ? $object->fourn_multicurrency_code : '');
if (empty($currencycodetouse) && $object->fourn_multicurrency_tx == 1) {
$currencycodetouse = $conf->currency;
}
@@ -635,7 +667,7 @@ if ($id > 0 || $ref) {
// Currency price qty min
print ' '.$langs->trans("PriceQtyMinCurrency").' ';
- $pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ?GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : ''));
+ $pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ? GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : ''));
print ' ';
print ' ';
print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ?GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices
@@ -651,43 +683,45 @@ if ($id > 0 || $ref) {
print ' ';
$currencies = array();
- $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE entity = '.$conf->entity;
+ $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE entity = '.((int) $conf->entity);
$resql = $db->query($sql);
if ($resql) {
$currency = new MultiCurrency($db);
while ($obj = $db->fetch_object($resql)) {
$currency->fetch($obj->rowid);
- $currencies[$currency->code] = $currency->rate->rate;
+ $currencies[$currency->code] = ((float) $currency->rate->rate);
}
}
$currencies = json_encode($currencies);
print <<
@@ -712,7 +748,6 @@ END;
print '';
}
-
// Discount qty min
print ''.$langs->trans("DiscountQtyMin").' ';
print ' %';
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 60928ccd23f..5d394ce3135 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1524,7 +1524,7 @@ class Project extends CommonObject
}
}
- $clone_project->datec = $now;
+ $clone_project->date_c = $now;
if (!$clone_note) {
$clone_project->note_private = '';
diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php
index aa9d9a8a437..6f670af2bb6 100644
--- a/htdocs/projet/index.php
+++ b/htdocs/projet/index.php
@@ -223,7 +223,7 @@ if ($resql) {
print '';
print '
';
print '';
- print ''.$langs->trans("LatestModifiedProjects", $max).' ';
+ print ''.$langs->trans("LatestModifiedProjects", $max).' ';
print ' ';
$num = $db->num_rows($resql);
@@ -277,12 +277,22 @@ if ($resql) {
print '';
+ // Label
+ print '';
+ print $projectstatic->title;
+ print ' ';
+
+ // Thirdparty
print '';
if ($companystatic->id > 0) {
print $companystatic->getNomUrl(1, 'company', 16);
}
print ' ';
+
+ // Date
print ''.dol_print_date($db->jdate($obj->datem), 'day').' ';
+
+ // Status
print ''.$projectstatic->LibStatut($obj->status, 3).' ';
print '';
$i++;
diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php
index aaa8bd0cd89..76c5239fc17 100644
--- a/htdocs/projet/tasks/comment.php
+++ b/htdocs/projet/tasks/comment.php
@@ -47,13 +47,6 @@ $withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
$planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : '');
-// Security check
-$socid = 0;
-//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
-if (!$user->rights->projet->lire) {
- accessforbidden();
-}
-
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('projecttaskcommentcard', 'globalcard'));
@@ -79,10 +72,21 @@ if (!empty($project_ref) && !empty($withproject)) {
}
}
+
+if ($id > 0 || $ref) {
+ $object->fetch($id, $ref);
+}
+
+// Security check
+$socid = 0;
+
+restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
+
+
+
/*
* View
-*/
-
+ */
llxHeader('', $langs->trans("CommentPage"));
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index 3aa5c3b8830..1f74d1bbc75 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -40,17 +40,18 @@ $confirm = GETPOST('confirm', 'alpha');
$withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
-// Security check
-$socid = 0;
-//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
-//$result = restrictedArea($user, 'projet', $id, 'projet_task');
-if (!$user->rights->projet->lire) {
- accessforbidden();
-}
-
$object = new Task($db);
$projectstatic = new Project($db);
+if ($id > 0 || $ref) {
+ $object->fetch($id, $ref);
+}
+
+// Security check
+$socid = 0;
+
+restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
+
/*
* Actions
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index d9c49001dfc..3a56a7a018a 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -37,21 +37,13 @@ $langs->loadLangs(array('projects', 'other'));
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
-$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
+$mine = GETPOST('mode') == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
-// Security check
-$socid = 0;
-//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
-//$result=restrictedArea($user,'projet',$id,'');
-if (!$user->rights->projet->lire) {
- accessforbidden();
-}
-
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@@ -73,6 +65,17 @@ if (!$sortfield) {
$object = new Task($db);
$projectstatic = new Project($db);
+if ($id > 0 || $ref) {
+ $object->fetch($id, $ref);
+}
+
+// Security check
+$socid = 0;
+
+restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
+
+
+
/*
* Actions
*/
@@ -92,25 +95,21 @@ if (!empty($project_ref) && !empty($withproject)) {
}
if ($id > 0 || !empty($ref)) {
- if ($object->fetch($id, $ref) > 0) {
- if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
- $object->fetchComments();
- }
- $projectstatic->fetch($object->fk_project);
- if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
- $projectstatic->fetchComments();
- }
-
- if (!empty($projectstatic->socid)) {
- $projectstatic->fetch_thirdparty();
- }
-
- $object->project = clone $projectstatic;
-
- $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref);
- } else {
- dol_print_error($db);
+ if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
+ $object->fetchComments();
}
+ $projectstatic->fetch($object->fk_project);
+ if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
+ $projectstatic->fetchComments();
+ }
+
+ if (!empty($projectstatic->socid)) {
+ $projectstatic->fetch_thirdparty();
+ }
+
+ $object->project = clone $projectstatic;
+
+ $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref);
}
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index 4d581afc30a..3ad4aaa3b7b 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -31,7 +31,7 @@ $langs->load('projects');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
-$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
+$mine = GETPOST('mode') == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
@@ -82,6 +82,12 @@ if (!empty($project_ref) && !empty($withproject)) {
}
}
+if ($id > 0 || $ref) {
+ $object->fetch($id, $ref);
+}
+
+restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
+
$permissionnote = ($user->rights->projet->creer || $user->rights->projet->all->creer);
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 780d387512e..b31ba6f0e7b 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -46,13 +46,6 @@ $withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
$planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : '');
-// Security check
-$socid = 0;
-//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
-if (!$user->rights->projet->lire) {
- accessforbidden();
-}
-
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('projecttaskcard', 'globalcard'));
@@ -69,6 +62,17 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
+if ($id > 0 || $ref) {
+ $object->fetch($id, $ref);
+}
+
+// Security check
+$socid = 0;
+
+restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
+
+
+
/*
* Actions
*/
@@ -85,7 +89,6 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
}
if (!$error) {
- $object->fetch($id, $ref);
$object->oldcopy = clone $object;
$tmparray = explode('_', $_POST['task_parent']);
@@ -121,17 +124,15 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) {
}
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->supprimer) {
- if ($object->fetch($id, $ref) >= 0) {
- $result = $projectstatic->fetch($object->fk_project);
- $projectstatic->fetch_thirdparty();
+ $result = $projectstatic->fetch($object->fk_project);
+ $projectstatic->fetch_thirdparty();
- if ($object->delete($user) > 0) {
- header('Location: '.DOL_URL_ROOT.'/projet/tasks.php?restore_lastsearch_values=1&id='.$projectstatic->id.($withproject ? '&withproject=1' : ''));
- exit;
- } else {
- setEventMessages($object->error, $object->errors, 'errors');
- $action = '';
- }
+ if ($object->delete($user) > 0) {
+ header('Location: '.DOL_URL_ROOT.'/projet/tasks.php?restore_lastsearch_values=1&id='.$projectstatic->id.($withproject ? '&withproject=1' : ''));
+ exit;
+ } else {
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = '';
}
}
@@ -149,8 +150,6 @@ if (!empty($project_ref) && !empty($withproject)) {
// Build doc
if ($action == 'builddoc' && $user->rights->projet->creer) {
- $object->fetch($id, $ref);
-
// Save last template used to generate document
if (GETPOST('model')) {
$object->setDocModel($user, GETPOST('model', 'alpha'));
@@ -172,17 +171,15 @@ if ($action == 'builddoc' && $user->rights->projet->creer) {
if ($action == 'remove_file' && $user->rights->projet->creer) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- if ($object->fetch($id, $ref) >= 0) {
- $langs->load("other");
- $upload_dir = $conf->projet->dir_output;
- $file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file'));
+ $langs->load("other");
+ $upload_dir = $conf->projet->dir_output;
+ $file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file'));
- $ret = dol_delete_file($file);
- if ($ret) {
- setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
- } else {
- setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
- }
+ $ret = dol_delete_file($file);
+ if ($ret) {
+ setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
}
@@ -198,452 +195,450 @@ $formother = new FormOther($db);
$formfile = new FormFile($db);
if ($id > 0 || !empty($ref)) {
- if ($object->fetch($id, $ref) > 0) {
- $res = $object->fetch_optionals();
- if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
- $object->fetchComments();
+ $res = $object->fetch_optionals();
+ if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) {
+ $object->fetchComments();
+ }
+
+ $result = $projectstatic->fetch($object->fk_project);
+ if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
+ $projectstatic->fetchComments();
+ }
+ if (!empty($projectstatic->socid)) {
+ $projectstatic->fetch_thirdparty();
+ }
+
+ $object->project = clone $projectstatic;
+
+ //$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
+
+ if (!empty($withproject)) {
+ // Tabs for project
+ $tab = 'tasks';
+ $head = project_prepare_head($projectstatic);
+ print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
+
+ $param = ($mode == 'mine' ? '&mode=mine' : '');
+
+ // Project card
+
+ $linkback = ''.$langs->trans("BackToList").' ';
+
+ $morehtmlref = '';
+ // Title
+ $morehtmlref .= $projectstatic->title;
+ // Thirdparty
+ if ($projectstatic->thirdparty->id > 0) {
+ $morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
+ }
+ $morehtmlref .= '
';
+
+ // Define a complementary filter for search of next/prev ref.
+ if (!$user->rights->projet->all->lire) {
+ $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
+ $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
- $result = $projectstatic->fetch($object->fk_project);
- if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
- $projectstatic->fetchComments();
- }
- if (!empty($projectstatic->socid)) {
- $projectstatic->fetch_thirdparty();
- }
+ dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
- $object->project = clone $projectstatic;
+ print '';
+ print '
';
+ print '
';
- //$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
+ print '
';
- if (!empty($withproject)) {
- // Tabs for project
- $tab = 'tasks';
- $head = project_prepare_head($projectstatic);
- print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
-
- $param = ($mode == 'mine' ? '&mode=mine' : '');
-
- // Project card
-
- $linkback = ''.$langs->trans("BackToList").' ';
-
- $morehtmlref = '';
- // Title
- $morehtmlref .= $projectstatic->title;
- // Thirdparty
- if ($projectstatic->thirdparty->id > 0) {
- $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
+ // Usage
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
+ print '
';
+ print $langs->trans("Usage");
+ print ' ';
+ print '';
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
+ print ' usage_opportunity ? ' checked="checked"' : '')).'"> ';
+ $htmltext = $langs->trans("ProjectFollowOpportunity");
+ print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
+ print ' ';
}
- $morehtmlref .= '';
-
- // Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
- $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
- $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
+ if (empty($conf->global->PROJECT_HIDE_TASKS)) {
+ print ' usage_task ? ' checked="checked"' : '')).'"> ';
+ $htmltext = $langs->trans("ProjectFollowTasks");
+ print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
+ print ' ';
}
-
- dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
- print '';
- print '
';
- print '
';
-
- print '
';
-
- // Usage
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
- print '';
- print $langs->trans("Usage");
- print ' ';
- print '';
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
- print ' usage_opportunity ? ' checked="checked"' : '')).'"> ';
- $htmltext = $langs->trans("ProjectFollowOpportunity");
- print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
- print ' ';
- }
- if (empty($conf->global->PROJECT_HIDE_TASKS)) {
- print ' usage_task ? ' checked="checked"' : '')).'"> ';
- $htmltext = $langs->trans("ProjectFollowTasks");
- print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
- print ' ';
- }
- if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
- print ' usage_bill_time ? ' checked="checked"' : '')).'"> ';
- $htmltext = $langs->trans("ProjectBillTimeDescription");
- print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
- print ' ';
- }
- if (!empty($conf->eventorganization->enabled)) {
- print ' usage_organize_event ? ' checked="checked"' : '')).'"> ';
- $htmltext = $langs->trans("EventOrganizationDescriptionLong");
- print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
- }
- print ' ';
+ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
+ print ' usage_bill_time ? ' checked="checked"' : '')).'"> ';
+ $htmltext = $langs->trans("ProjectBillTimeDescription");
+ print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
+ print ' ';
}
-
- // Visibility
- print ''.$langs->trans("Visibility").' ';
- if ($projectstatic->public) {
- print $langs->trans('SharedProject');
- } else {
- print $langs->trans('PrivateProject');
+ if (!empty($conf->eventorganization->enabled)) {
+ print ' usage_organize_event ? ' checked="checked"' : '')).'"> ';
+ $htmltext = $langs->trans("EventOrganizationDescriptionLong");
+ print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
}
print ' ';
-
- // Date start - end
- print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").' ';
- $start = dol_print_date($projectstatic->date_start, 'day');
- print ($start ? $start : '?');
- $end = dol_print_date($projectstatic->date_end, 'day');
- print ' - ';
- print ($end ? $end : '?');
- if ($projectstatic->hasDelay()) {
- print img_warning("Late");
- }
- print ' ';
-
- // Budget
- print ''.$langs->trans("Budget").' ';
- if (strcmp($projectstatic->budget_amount, '')) {
- print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency);
- }
- print ' ';
-
- // Other attributes
- $cols = 2;
- //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
-
- print '
';
-
- print '
';
-
- print '
';
- print '
';
- print '
';
-
- print '
';
-
- // Description
- print ''.$langs->trans("Description").' ';
- print nl2br($projectstatic->description);
- print ' ';
-
- // Categories
- if ($conf->categorie->enabled) {
- print ''.$langs->trans("Categories").' ';
- print $form->showCategories($projectstatic->id, 'project', 1);
- print " ";
- }
-
- print '
';
-
- print '
';
- print '
';
- print '
';
-
- print '
';
-
- print dol_get_fiche_end();
-
- print ' ';
}
- /*
- * Actions
- */
- /*print '';
+ // Visibility
+ print '
'.$langs->trans("Visibility").' ';
+ if ($projectstatic->public) {
+ print $langs->trans('SharedProject');
+ } else {
+ print $langs->trans('PrivateProject');
+ }
+ print ' ';
- if ($user->rights->projet->all->creer || $user->rights->projet->creer)
- {
- if ($projectstatic->public || $userWrite > 0)
- {
- print '
'.$langs->trans('AddTask').' ';
+ // Date start - end
+ print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").' ';
+ $start = dol_print_date($projectstatic->date_start, 'day');
+ print ($start ? $start : '?');
+ $end = dol_print_date($projectstatic->date_end, 'day');
+ print ' - ';
+ print ($end ? $end : '?');
+ if ($projectstatic->hasDelay()) {
+ print img_warning("Late");
}
- else
- {
- print ''.$langs->trans('AddTask').' ';
- }
- }
- else
- {
- print ''.$langs->trans('AddTask').' ';
+ print ' ';
+
+ // Budget
+ print '
'.$langs->trans("Budget").' ';
+ if (strcmp($projectstatic->budget_amount, '')) {
+ print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency);
}
+ print ' ';
+
+ // Other attributes
+ $cols = 2;
+ //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
+
+ print '
';
print '
';
- */
- // To verify role of users
- //$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project
- //$arrayofuseridoftask=$object->getListContactId('internal');
+ print '
';
+ print '
';
+ print '
';
- $head = task_prepare_head($object);
+ print '
';
- if ($action == 'edit' && $user->rights->projet->creer) {
- print '
';
- print '
';
- print ' ';
- print ' ';
- print '
';
+ print dol_get_fiche_end();
- print '';
+ print '
';
+ print ' ';
+ print ' ';
+ print '
';
+
+ print '';
+ } else {
+ /*
+ * Fiche tache en mode visu
+ */
+ $param = ($withproject ? '&withproject=1' : '');
+ $linkback = $withproject ? '
'.$langs->trans("BackToList").' ' : '';
+
+ print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
+
+ if ($action == 'delete') {
+ print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".GETPOST("id", 'int').'&withproject='.$withproject, $langs->trans("DeleteATask"), $langs->trans("ConfirmDeleteATask"), "confirm_delete");
+ }
+
+ if (!GETPOST('withproject') || empty($projectstatic->id)) {
+ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
+ $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")";
} else {
- /*
- * Fiche tache en mode visu
- */
- $param = ($withproject ? '&withproject=1' : '');
- $linkback = $withproject ? '
'.$langs->trans("BackToList").' ' : '';
-
- print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
-
- if ($action == 'delete') {
- print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".GETPOST("id", 'int').'&withproject='.$withproject, $langs->trans("DeleteATask"), $langs->trans("ConfirmDeleteATask"), "confirm_delete");
- }
-
- if (!GETPOST('withproject') || empty($projectstatic->id)) {
- $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
- $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")";
- } else {
- $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id);
- }
-
- $morehtmlref = '';
-
- // Project
- if (empty($withproject)) {
- $morehtmlref .= '
';
- $morehtmlref .= $langs->trans("Project").': ';
- $morehtmlref .= $projectstatic->getNomUrl(1);
- $morehtmlref .= ' ';
-
- // Third party
- $morehtmlref .= $langs->trans("ThirdParty").': ';
- if (!empty($projectstatic->thirdparty)) {
- $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
- }
- $morehtmlref .= '
';
- }
-
- dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
-
- print '
';
- print '
';
-
- print '
';
- print '
';
-
- // Task parent
- print ''.$langs->trans("ChildOfTask").' ';
- if ($object->fk_task_parent > 0) {
- $tasktmp = new Task($db);
- $tasktmp->fetch($object->fk_task_parent);
- print $tasktmp->getNomUrl(1);
- }
- print ' ';
-
- // Date start - Date end
- print ''.$langs->trans("DateStart").' - '.$langs->trans("Deadline").' ';
- $start = dol_print_date($object->date_start, 'dayhour');
- print ($start ? $start : '?');
- $end = dol_print_date($object->date_end, 'dayhour');
- print ' - ';
- print ($end ? $end : '?');
- if ($object->hasDelay()) {
- print img_warning("Late");
- }
- print ' ';
-
- // Planned workload
- print ''.$langs->trans("PlannedWorkload").' ';
- if ($object->planned_workload != '') {
- print convertSecondToTime($object->planned_workload, 'allhourmin');
- }
- print ' ';
-
- // Description
- print ''.$langs->trans("Description").' ';
- print nl2br($object->description);
- print ' ';
-
- print '
';
- print '
';
-
- print '
';
-
- print '
';
- print '
';
-
- // Progress declared
- print ''.$langs->trans("ProgressDeclared").' ';
- if ($object->progress != '') {
- print $object->progress.' %';
- }
- print ' ';
-
- // Progress calculated
- print ''.$langs->trans("ProgressCalculated").' ';
- if ($object->planned_workload != '') {
- $tmparray = $object->getSummaryOfTimeSpent();
- if ($tmparray['total_duration'] > 0 && !empty($object->planned_workload)) {
- print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %';
- } else {
- print '0 %';
- }
- } else {
- print ''.$langs->trans("WorkloadNotDefined").' ';
- }
- print ' ';
-
- // Other attributes
- $cols = 3;
- $parameters = array('socid'=>$socid);
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
-
- print '
';
-
- print '
';
- print '
';
-
- print '
';
- print '
';
-
- print dol_get_fiche_end();
+ $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id);
}
+ $morehtmlref = '';
- if ($action != 'edit') {
- /*
- * Actions
- */
+ // Project
+ if (empty($withproject)) {
+ $morehtmlref .= '
';
+ $morehtmlref .= $langs->trans("Project").': ';
+ $morehtmlref .= $projectstatic->getNomUrl(1);
+ $morehtmlref .= '
';
- print '
';
+ // Third party
+ $morehtmlref .= $langs->trans("ThirdParty").': ';
+ if (!empty($projectstatic->thirdparty)) {
+ $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
+ }
+ $morehtmlref .= '
';
+ }
- $parameters = array();
- $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
- // modified by hook
- if (empty($reshook)) {
- // Modify
- if ($user->rights->projet->creer) {
- print '
'.$langs->trans('Modify').' ';
- } else {
- print '
'.$langs->trans('Modify').' ';
- }
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
- // Delete
- if ($user->rights->projet->supprimer) {
- if (!$object->hasChildren() && !$object->hasTimeSpent()) {
- print '
'.$langs->trans('Delete').' ';
- } else {
- print '
'.$langs->trans('Delete').' ';
- }
- } else {
- print '
'.$langs->trans('Delete').' ';
- }
+ print '
';
+ print '
';
- print '
';
+ print '
';
+ print '
';
+
+ // Task parent
+ print ''.$langs->trans("ChildOfTask").' ';
+ if ($object->fk_task_parent > 0) {
+ $tasktmp = new Task($db);
+ $tasktmp->fetch($object->fk_task_parent);
+ print $tasktmp->getNomUrl(1);
+ }
+ print ' ';
+
+ // Date start - Date end
+ print ''.$langs->trans("DateStart").' - '.$langs->trans("Deadline").' ';
+ $start = dol_print_date($object->date_start, 'dayhour');
+ print ($start ? $start : '?');
+ $end = dol_print_date($object->date_end, 'dayhour');
+ print ' - ';
+ print ($end ? $end : '?');
+ if ($object->hasDelay()) {
+ print img_warning("Late");
+ }
+ print ' ';
+
+ // Planned workload
+ print ''.$langs->trans("PlannedWorkload").' ';
+ if ($object->planned_workload != '') {
+ print convertSecondToTime($object->planned_workload, 'allhourmin');
+ }
+ print ' ';
+
+ // Description
+ print ''.$langs->trans("Description").' ';
+ print nl2br($object->description);
+ print ' ';
+
+ print '
';
+ print '
';
+
+ print '
';
+
+ print '
';
+ print '
';
+
+ // Progress declared
+ print ''.$langs->trans("ProgressDeclared").' ';
+ if ($object->progress != '') {
+ print $object->progress.' %';
+ }
+ print ' ';
+
+ // Progress calculated
+ print ''.$langs->trans("ProgressCalculated").' ';
+ if ($object->planned_workload != '') {
+ $tmparray = $object->getSummaryOfTimeSpent();
+ if ($tmparray['total_duration'] > 0 && !empty($object->planned_workload)) {
+ print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %';
+ } else {
+ print '0 %';
+ }
+ } else {
+ print ''.$langs->trans("WorkloadNotDefined").' ';
+ }
+ print ' ';
+
+ // Other attributes
+ $cols = 3;
+ $parameters = array('socid'=>$socid);
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
+
+ print '
';
+
+ print '
';
+ print '
';
+
+ print '
';
+ print '
';
+
+ print dol_get_fiche_end();
+ }
+
+
+ if ($action != 'edit') {
+ /*
+ * Actions
+ */
+
+ print '
';
+
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
+ // modified by hook
+ if (empty($reshook)) {
+ // Modify
+ if ($user->rights->projet->creer) {
+ print '
'.$langs->trans('Modify').' ';
+ } else {
+ print '
'.$langs->trans('Modify').' ';
}
- print '
';
- print '
'; // ancre
+ // Delete
+ if ($user->rights->projet->supprimer) {
+ if (!$object->hasChildren() && !$object->hasTimeSpent()) {
+ print '
'.$langs->trans('Delete').' ';
+ } else {
+ print '
'.$langs->trans('Delete').' ';
+ }
+ } else {
+ print '
'.$langs->trans('Delete').' ';
+ }
- /*
- * Generated documents
- */
- $filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
- $filedir = $conf->projet->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
- $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
- $genallowed = ($user->rights->projet->lire);
- $delallowed = ($user->rights->projet->creer);
-
- print $formfile->showdocuments('project_task', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
-
- print '
';
-
- // List of actions on element
- include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
- $formactions = new FormActions($db);
- $defaultthirdpartyid = $socid > 0 ? $socid : $object->project->socid;
- $formactions->showactions($object, 'task', $defaultthirdpartyid, 1, '', 10, 'withproject='.$withproject);
-
- print '
';
+ print '
';
}
+
+ print '
';
+ print '
'; // ancre
+
+ /*
+ * Generated documents
+ */
+ $filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
+ $filedir = $conf->projet->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
+ $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
+ $genallowed = ($user->rights->projet->lire);
+ $delallowed = ($user->rights->projet->creer);
+
+ print $formfile->showdocuments('project_task', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
+
+ print '
';
+
+ // List of actions on element
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
+ $formactions = new FormActions($db);
+ $defaultthirdpartyid = $socid > 0 ? $socid : $object->project->socid;
+ $formactions->showactions($object, 'task', $defaultthirdpartyid, 1, '', 10, 'withproject='.$withproject);
+
+ print '
';
}
}
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 48ee75df62e..8e5877c7d0d 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -107,6 +107,13 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($projectstatic->table_element);
$extrafields->fetch_name_optionals_label($object->table_element);
+if ($id > 0 || $ref) {
+ $object->fetch($id, $ref);
+}
+
+restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
+
+
/*
* Actions
@@ -1073,6 +1080,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as inv ON inv.rowid = il.fk_facture,";
$sql .= " ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
+
if (empty($projectidforalltimes)) {
$sql .= " AND t.fk_task =".((int) $object->id);
} else {
@@ -1088,7 +1096,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
$sql .= natural_search('pt.label', $search_task_label);
}
if ($search_user > 0) {
- $sql .= natural_search('t.fk_user', $search_user);
+ $sql .= natural_search('t.fk_user', $search_user, 2);
}
if ($search_valuebilled == '1') {
$sql .= ' AND t.invoice_id > 0';
@@ -1103,6 +1111,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
+
+ if (! $resql) {
+ dol_print_error($db);
+ exit;
+ }
+
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;
diff --git a/htdocs/public/eventorganization/attendee_register.php b/htdocs/public/eventorganization/attendee_register.php
index 0cfdf1dabc0..a454f214316 100644
--- a/htdocs/public/eventorganization/attendee_register.php
+++ b/htdocs/public/eventorganization/attendee_register.php
@@ -64,19 +64,21 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
global $dolibarr_main_instance_unique_id;
global $dolibarr_main_url_root;
// Init vars
$errmsg = '';
-$num = 0;
$error = 0;
$backtopage = GETPOST('backtopage', 'alpha');
$action = GETPOST('action', 'aZ09');
$email = GETPOST("email");
$societe = GETPOST("societe");
+$emailcompany = GETPOST("emailcompany");
+$note_public = GETPOST('note_public', "nohtml");
// Getting id from Post and decoding it
$type = GETPOST('type', 'aZ09');
@@ -234,7 +236,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
// If the price has been set, name is required for the invoice
if (!GETPOST("societe") && !empty(floatval($project->price_registration))) {
$error++;
- $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."
\n";
+ $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Company"))."
\n";
}
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
$error++;
@@ -269,6 +271,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$confattendee->email = $email;
$confattendee->fk_project = $project->id;
$confattendee->fk_actioncomm = $id;
+ $confattendee->note_public = $note_public;
$resultconfattendee = $confattendee->create($user);
if ($resultconfattendee < 0) {
$error++;
@@ -293,7 +296,9 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
exit;
}
- $resultfetchthirdparty = -1;
+ $resultfetchthirdparty = 0;
+
+ $genericcompanyname = $langs->trans('EventParticipant').' '.($emailcompany ? $emailcompany : $email); // Keep this label simple so we can retreive same thirdparty for another event
// Getting the thirdparty or creating it
$thirdparty = new Societe($db);
@@ -303,45 +308,104 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$resultfetchthirdparty = $thirdparty->fetch($confattendee->fk_soc);
} else {
if (empty($conf->global->EVENTORGANIZATION_DISABLE_RETREIVE_THIRDPARTY_FROM_NAME)) {
- // Fetch using the input field by user if we just created the attendee
- if (!empty($societe)) {
- $resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', $email);
- if ($resultfetchthirdparty <= 0) {
- // Try to find the thirdparty from the contact
- $resultfetchcontact = $contact->fetch('', null, '', $email);
- if ($resultfetchcontact <= 0 || $contact->fk_soc <= 0) {
- // Need to create a new one (not found or multiple with the same name/email)
- $resultfetchthirdparty = 0;
- } else {
- $thirdparty->fetch($contact->fk_soc);
- $confattendee->fk_soc = $thirdparty->id;
- $confattendee->update($user);
- $resultfetchthirdparty = 1;
- }
- } else {
- // We found a unique result with that name/email, so we set the fk_soc of attendee
+ // Fetch using the field input by end user if we have just created the attendee
+ if ($resultfetchthirdparty <= 0 && !empty($societe) && !empty($emailcompany)) {
+ $resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', $emailcompany);
+ if ($resultfetchthirdparty > 0) {
+ // We found a unique result with the name + emailcompany, so we set the fk_soc of attendee
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
+ } elseif ($resultfetchthirdparty == -2) {
+ $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email);
}
- } else {
- // Need to create a thirdparty (put number>0 if we do not want to create a thirdparty for free-conferences)
- $resultfetchthirdparty = 0;
}
- } else {
- // Need to create a thirdparty (put number>0 if we do not want to create a thirdparty for free-conferences)
- $resultfetchthirdparty = 0;
+ // Fetch using the field input by end user if we have just created the attendee
+ if ($resultfetchthirdparty <= 0 && !empty($societe) && !empty($email) && $email != $emailcompany) {
+ $resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', $email);
+ if ($resultfetchthirdparty > 0) {
+ // We found a unique result with the name + email, so we set the fk_soc of attendee
+ $confattendee->fk_soc = $thirdparty->id;
+ $confattendee->update($user);
+ } elseif ($resultfetchthirdparty == -2) {
+ $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email);
+ }
+ }
+ }
+ if ($resultfetchthirdparty <= 0 && !empty($emailcompany)) {
+ // Try to find thirdparty from the email only
+ $resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $emailcompany);
+ if ($resultfetchthirdparty > 0) {
+ // We found a unique result with that email only, so we set the fk_soc of attendee
+ $confattendee->fk_soc = $thirdparty->id;
+ $confattendee->update($user);
+ } elseif ($resultfetchthirdparty == -2) {
+ $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email);
+ }
+ }
+ if ($resultfetchthirdparty <= 0 && !empty($email) && $email != $emailcompany) {
+ // Try to find thirdparty from the email only
+ $resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email);
+ if ($resultfetchthirdparty > 0) {
+ // We found a unique result with that email only, so we set the fk_soc of attendee
+ $confattendee->fk_soc = $thirdparty->id;
+ $confattendee->update($user);
+ } elseif ($resultfetchthirdparty == -2) {
+ $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email);
+ }
+ }
+ if ($resultfetchthirdparty <= 0 && !empty($genericcompanyname)) {
+ // Try to find thirdparty from the generic mail only
+ $resultfetchthirdparty = $thirdparty->fetch('', $genericcompanyname, '', '', '', '', '', '', '', '', '');
+ if ($resultfetchthirdparty > 0) {
+ // We found a unique result with that name + email, so we set the fk_soc of attendee
+ $confattendee->fk_soc = $thirdparty->id;
+ $confattendee->update($user);
+ } elseif ($resultfetchthirdparty == -2) {
+ $thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email);
+ }
+ }
+
+ // TODO Add more tests on a VAT number, profid or a name ?
+
+ if ($resultfetchthirdparty <= 0 && !empty($email)) {
+ // Try to find the thirdparty from the contact
+ $resultfetchcontact = $contact->fetch('', null, '', $email);
+ if ($resultfetchcontact > 0 && $contact->fk_soc > 0) {
+ $thirdparty->fetch($contact->fk_soc);
+ $confattendee->fk_soc = $thirdparty->id;
+ $confattendee->update($user);
+ $resultfetchthirdparty = 1;
+ }
+ }
+
+ if ($resultfetchthirdparty <= 0 && !empty($societe)) {
+ // Try to find thirdparty from the company name only
+ $resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', '');
+ if ($resultfetchthirdparty > 0) {
+ // We found a unique result with that name only, so we set the fk_soc of attendee
+ $confattendee->fk_soc = $thirdparty->id;
+ $confattendee->update($user);
+ } elseif ($resultfetchthirdparty == -2) {
+ $thirdparty->error = "ErrorSeveralCompaniesWithNameContactUs";
+ }
}
}
+ // If price is empty, no need to create a thirdparty, so we force $resultfetchthirdparty as if we have already found thirdp party.
+ if (empty(floatval($project->price_registration))) {
+ $resultfetchthirdparty = 1;
+ }
+
if ($resultfetchthirdparty < 0) {
+ // If an error was found
$error++;
$errmsg .= $thirdparty->error;
- } elseif ($resultfetchthirdparty == 0) {
+ } elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected
// Creation of a new thirdparty
if (!empty($societe)) {
$thirdparty->name = $societe;
} else {
- $thirdparty->name = $email;
+ $thirdparty->name = $genericcompanyname;
}
$thirdparty->address = GETPOST("address");
$thirdparty->zip = GETPOST("zipcode");
@@ -350,7 +414,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$thirdparty->fournisseur = 0;
$thirdparty->country_id = GETPOST("country_id", 'int');
$thirdparty->state_id = GETPOST("state_id", 'int');
- $thirdparty->email = $email;
+ $thirdparty->email = ($emailcompany ? $emailcompany : $email);
// Load object modCodeTiers
$module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
@@ -386,8 +450,10 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
}
if (!$error) {
+ // If the registration needs a payment
if (!empty(floatval($project->price_registration))) {
$outputlangs = $langs;
+
// TODO Use default language of $thirdparty->default_lang to build $outputlang
// Get product to use for invoice
@@ -405,30 +471,41 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$errmsg .= $productforinvoicerow->error;
} else {
$facture = new Facture($db);
- $facture->type = Facture::TYPE_STANDARD;
- $facture->socid = $thirdparty->id;
- $facture->paye = 0;
- $facture->date = dol_now();
- $facture->cond_reglement_id = $confattendee->cond_reglement_id;
- $facture->fk_project = $project->id;
+ if (empty($confattendee->fk_invoice)) {
+ $facture->type = Facture::TYPE_STANDARD;
+ $facture->socid = $thirdparty->id;
+ $facture->paye = 0;
+ $facture->date = dol_now();
+ $facture->cond_reglement_id = $confattendee->cond_reglement_id;
+ $facture->fk_project = $project->id;
+ $facture->status = Facture::STATUS_DRAFT;
- if (empty($facture->cond_reglement_id)) {
- $paymenttermstatic = new PaymentTerm($confattendee->db);
- $facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
if (empty($facture->cond_reglement_id)) {
- $error++;
- $confattendee->error = 'ErrorNoPaymentTermRECEPFound';
- $confattendee->errors[] = $confattendee->error;
+ $paymenttermstatic = new PaymentTerm($confattendee->db);
+ $facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
+ if (empty($facture->cond_reglement_id)) {
+ $error++;
+ $confattendee->error = 'ErrorNoPaymentTermRECEPFound';
+ $confattendee->errors[] = $confattendee->error;
+ }
+ }
+ $resultfacture = $facture->create($user);
+ if ($resultfacture <= 0) {
+ $confattendee->error = $facture->error;
+ $confattendee->errors = $facture->errors;
+ $error++;
+ } else {
+ $confattendee->fk_invoice = $resultfacture;
+ $confattendee->update($user);
}
- }
- $resultfacture = $facture->create($user);
- if ($resultfacture <= 0) {
- $confattendee->error = $facture->error;
- $confattendee->errors = $facture->errors;
- $error++;
} else {
- $facture->add_object_linked($confattendee->element, $confattendee->id);
+ $facture->fetch($confattendee->fk_invoice);
}
+
+ // Add link between invoice and the attendee registration
+ /*if (!$error) {
+ $facture->add_object_linked($confattendee->element, $confattendee->id);
+ }*/
}
if (!$error) {
@@ -439,11 +516,14 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$date_start = $project->date_start;
$date_end = $project->date_end;
- $result = $facture->addline($labelforproduct, floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1);
- if ($result <= 0) {
- $confattendee->error = $facture->error;
- $confattendee->errors = $facture->errors;
- $error++;
+ // If there is no lines yet, we add one
+ if (empty($facture->lines)) {
+ $result = $facture->addline($labelforproduct, floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1);
+ if ($result <= 0) {
+ $confattendee->error = $facture->error;
+ $confattendee->errors = $facture->errors;
+ $error++;
+ }
}
}
@@ -610,7 +690,10 @@ if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CO
print '
' . "\n";
// Email
- print '' . $langs->trans("Email") . '* ' . "\n";
+ print '' . $langs->trans("EmailAttendee") . '* ';
+ print img_picto('', 'email', 'class="pictofixedwidth"');
+ print ' ' . "\n";
+
// Company
print '' . $langs->trans("Company");
if (!empty(floatval($project->price_registration))) {
@@ -619,15 +702,25 @@ if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CO
print ' ';
print img_picto('', 'company', 'class="pictofixedwidth"');
print ' ' . "\n";
+
+ // Email company for invoice
+ if ($project->price_registration) {
+ print '' . $langs->trans("EmailCompanyForInvoice") . ' ';
+ print img_picto('', 'email', 'class="pictofixedwidth"');
+ print ' ' . "\n";
+ }
+
// Address
print '' . $langs->trans("Address") . ' ' . "\n";
- print '' . dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1) . ' ' . "\n";
+ print '' . dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1) . ' ' . "\n";
+
// Zip / Town
print '' . $langs->trans('Zip') . ' / ' . $langs->trans('Town') . ' ';
print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
print ' / ';
print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
print ' ';
+
// Country
print '' . $langs->trans('Country') . '* ';
print img_picto('', 'country', 'class="pictofixedwidth"');
@@ -666,6 +759,14 @@ if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CO
print ' ';
}
+ $notetoshow = $note_public;
+ print '' . $langs->trans('Note') . ' ';
+ if (!empty($conf->global->EVENTORGANIZATION_DEFAULT_NOTE_ON_REGISTRATION)) {
+ $notetoshow = str_replace('\n', "\n", $conf->global->EVENTORGANIZATION_DEFAULT_NOTE_ON_REGISTRATION);
+ }
+ print ''.dol_escape_htmltag($notetoshow, 0, 1).' ';
+ print ' ';
+
print "
\n";
print dol_get_fiche_end();
diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index 702c910ea01..97fe2387d8d 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -115,6 +115,8 @@ if (!$action) {
if ($source == 'organizedeventregistration') {
// Finding the Attendee
+ $attendee = new ConferenceOrBoothAttendee($db);
+
$invoiceid = GETPOST('ref', 'int');
$invoice = new Facture($db);
@@ -123,14 +125,28 @@ if ($source == 'organizedeventregistration') {
if ($resultinvoice <= 0) {
setEventMessages(null, $invoice->errors, "errors");
} else {
+ /*
+ $attendeeid = 0;
+
$invoice->fetchObjectLinked();
$linkedAttendees = $invoice->linkedObjectsIds['conferenceorboothattendee'];
if (is_array($linkedAttendees)) {
$linkedAttendees = array_values($linkedAttendees);
+ $attendeeid = $linkedAttendees[0];
+ }*/
+ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee";
+ $sql .= " WHERE fk_invoice = ".((int) $invoiceid);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj) {
+ $attendeeid = $obj->rowid;
+ }
+ }
- $attendee = new ConferenceOrBoothAttendee($db);
- $resultattendee = $attendee->fetch($linkedAttendees[0]);
+ if ($attendeeid > 0) {
+ $resultattendee = $attendee->fetch($attendeeid);
if ($resultattendee <= 0) {
setEventMessages(null, $attendee->errors, "errors");
@@ -1834,12 +1850,13 @@ if ($source == 'organizedeventregistration') {
// Debitor
print '
'.$langs->trans("Attendee");
print ' ';
- print $thirdparty->name;
+ print $attendee->email;
+ print ($thirdparty->name ? ' ('.$langs->trans("Company").' '.$thirdparty->name.')' : '');
print ' ';
print ''."\n";
if (! is_object($attendee->project)) {
- $text = 'ErrorProjectotFound';
+ $text = 'ErrorProjectNotFound';
} else {
$text = $langs->trans("PaymentEvent").' - '.$attendee->project->title;
}
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 845dc3ff450..569c1646ef9 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -932,7 +932,7 @@ if ($ispaymentok) {
}
// TODO send email with acknowledgment for the donation
- // (need that the donation module can gen a pdf document for the cerfa with pre filled content)
+ // (we need first that the donation module is able to generate a pdf document for the cerfa with pre filled content)
} elseif (array_key_exists('ATT', $tmptag) && $tmptag['ATT'] > 0) {
// Record payment for registration to an event for an attendee
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php
index 5b4bdf6bb6f..624748ded8f 100644
--- a/htdocs/reception/list.php
+++ b/htdocs/reception/list.php
@@ -573,43 +573,43 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
if ($sall) {
- $param .= "&sall=".urlencode($sall);
+ $param .= "&sall=".urlencode($sall);
}
if ($search_ref_rcp) {
- $param .= "&search_ref_rcp=".urlencode($search_ref_rcp);
+ $param .= "&search_ref_rcp=".urlencode($search_ref_rcp);
}
if ($search_ref_liv) {
- $param .= "&search_ref_liv=".urlencode($search_ref_liv);
+ $param .= "&search_ref_liv=".urlencode($search_ref_liv);
}
if ($search_company) {
- $param .= "&search_company=".urlencode($search_company);
+ $param .= "&search_company=".urlencode($search_company);
}
if ($optioncss != '') {
- $param .= '&optioncss='.urlencode($optioncss);
+ $param .= '&optioncss='.urlencode($optioncss);
}
if ($search_billed != '' && $search_billed >= 0) {
- $param .= "&search_billed=".urlencode($search_billed);
+ $param .= "&search_billed=".urlencode($search_billed);
}
if ($search_town) {
- $param .= "&search_town=".urlencode($search_town);
+ $param .= "&search_town=".urlencode($search_town);
}
if ($search_zip) {
- $param .= "&search_zip=".urlencode($search_zip);
+ $param .= "&search_zip=".urlencode($search_zip);
}
if ($search_state) {
- $param .= "&search_state=".urlencode($search_state);
+ $param .= "&search_state=".urlencode($search_state);
}
if ($search_status != '') {
- $param .= "&search_status=".urlencode($search_status);
+ $param .= "&search_status=".urlencode($search_status);
}
if ($search_country) {
- $param .= "&search_country=".urlencode($search_country);
+ $param .= "&search_country=".urlencode($search_country);
}
if ($search_type_thirdparty) {
- $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty);
+ $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty);
}
if ($search_ref_supplier) {
- $param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
+ $param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
}
// Add $param from extra fields
foreach ($search_array_options as $key => $val) {
@@ -885,7 +885,7 @@ while ($i < min($num, $limit)) {
// Ref
if (!empty($arrayfields['e.ref']['checked'])) {
- print "
";
+ print ' ';
print $reception->getNomUrl(1);
$filename = dol_sanitizeFileName($reception->ref);
$filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref);
@@ -898,10 +898,10 @@ while ($i < min($num, $limit)) {
}
}
- // Ref customer
+ // Ref supplier
if (!empty($arrayfields['e.ref_supplier']['checked'])) {
- print " ";
- print $obj->ref_supplier;
+ print ' ';
+ print dol_escape_htmltag($obj->ref_supplier);
print " \n";
if (!$i) {
$totalarray['nbfield']++;
@@ -910,7 +910,7 @@ while ($i < min($num, $limit)) {
// Third party
if (!empty($arrayfields['s.nom']['checked'])) {
- print '
';
+ print ' ';
print $companystatic->getNomUrl(1);
print ' ';
if (!$i) {
@@ -919,8 +919,8 @@ while ($i < min($num, $limit)) {
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
- print '
';
- print $obj->town;
+ print ' ';
+ print dol_escape_htmltag($obj->town);
print ' ';
if (!$i) {
$totalarray['nbfield']++;
@@ -928,8 +928,8 @@ while ($i < min($num, $limit)) {
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
- print '
';
- print $obj->zip;
+ print ' ';
+ print dol_escape_htmltag($obj->zip);
print ' ';
if (!$i) {
$totalarray['nbfield']++;
@@ -937,7 +937,7 @@ while ($i < min($num, $limit)) {
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
- print "
".$obj->state_name." \n";
+ print "
".dol_escape_htmltag($obj->state_name)." \n";
if (!$i) {
$totalarray['nbfield']++;
}
@@ -946,7 +946,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '
';
$tmparray = getCountry($obj->fk_pays, 'all');
- print $tmparray['label'];
+ print dol_escape_htmltag($tmparray['label']);
print ' ';
if (!$i) {
$totalarray['nbfield']++;
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index ff6e9474d34..e7597b311c2 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2581,7 +2581,7 @@ class Societe extends CommonObject
$label .= ' ('.dol_escape_htmltag($this->name_alias).')';
}
}
- $label .= '
'.$langs->trans('Email').': '.$this->email;
+ $label .= '
'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email;
if (!empty($this->phone) || !empty($this->fax)) {
$phonelist = array();
if ($this->phone) {
@@ -2590,7 +2590,7 @@ class Societe extends CommonObject
if ($this->fax) {
$phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', ' ', 'fax');
}
- $label .= '
'.$langs->trans('Phone').': '.implode(' ', $phonelist);
+ $label .= '
'.implode(' ', $phonelist);
}
if (!empty($this->address)) {
$label .= '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country
diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php
index 1ddab39dcbe..415281af65d 100644
--- a/htdocs/takepos/index.php
+++ b/htdocs/takepos/index.php
@@ -978,36 +978,39 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
query($sql);
-$paiementsModes = array();
-if ($resql) {
- while ($obj = $db->fetch_object($resql)) {
- $paycode = $obj->code;
- if ($paycode == 'LIQ') {
- $paycode = 'CASH';
- }
- if ($paycode == 'CHQ') {
- $paycode = 'CHEQUE';
- }
+ $resql = $db->query($sql);
+ $paiementsModes = array();
+ if ($resql) {
+ while ( $obj = $db->fetch_object($resql) ) {
+ $paycode = $obj->code;
+ if ($paycode == 'LIQ') {
+ $paycode = 'CASH';
+ }
+ if ($paycode == 'CHQ') {
+ $paycode = 'CHEQUE';
+ }
- $constantforkey = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"];
- //var_dump($constantforkey.' '.$conf->global->$constantforkey);
- if (!empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
- array_push($paiementsModes, $obj);
+ $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"];
+ //var_dump($constantforkey.' '.$conf->global->$constantforkey);
+ if ( ! empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
+ array_push($paiementsModes, $obj);
+ }
}
}
+
+ if (empty($paiementsModes)) {
+ $langs->load('errors');
+ setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
+ setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
+ }
}
-if (empty($paiementsModes)) {
- $langs->load('errors');
- setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
- setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
-}
if (count($maincategories) == 0) {
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
$tmpcategory = new Categorie($db);
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 0c00fcdd938..4130ac5c3cb 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -188,11 +188,9 @@ if ($action == 'valid' && $user->rights->facture->creer) {
if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
$bankaccount = GETPOST('accountid', 'int');
} else {
- if ($pay == "cash") {
+ if ($pay == 'LIQ') {
$bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility
- } elseif ($pay == "card") {
- $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$_SESSION["takeposterminal"]}; // For backward compatibility
- } elseif ($pay == "cheque") {
+ } elseif ($pay == "CHQ") {
$bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility
} else {
$accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"];
diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php
index ba8ac8f82f7..6e22f27f7ff 100644
--- a/htdocs/takepos/pay.php
+++ b/htdocs/takepos/pay.php
@@ -316,23 +316,20 @@ print '
'.(!empty($payIcon) ? ' '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code)).' ';
+ print '
'.(!empty($payIcon) ? ' '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code)).' ';
} else {
print '
'.$langs->trans("NoPaimementModesDefined").' ';
}
@@ -345,23 +342,20 @@ print '
'.(!empty($payIcon) ? ' '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code)).' ';
+ print '
'.(!empty($payIcon) ? ' '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code)).' ';
} else {
$button = array_pop($action_buttons);
print '
'.$button["text"].' ';
@@ -375,23 +369,20 @@ print '
'.(!empty($payIcon) ? ' '.(!empty($conf->global->TAKEPOS_NUMPAD_FORCE_PAYMENT_ICONS_LABELS) ? ' '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code) : '') : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code)).' ';
+ print '
'.(!empty($payIcon) ? ' '.(!empty($conf->global->TAKEPOS_NUMPAD_FORCE_PAYMENT_ICONS_LABELS) ? ' '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code) : '') : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code)).' ';
} else {
$button = array_pop($action_buttons);
print '
'.$button["text"].' ';
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 0df04bdf1ab..e07205a7043 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -492,7 +492,7 @@ if (empty($reshook)) {
}
}
- if ($action == 'setsubject') {
+ if ($action == 'setsubject' && $user->rights->ticket->write) {
if ($object->fetch(GETPOST('id', 'int'))) {
if ($action == 'setsubject') {
$object->subject = GETPOST('subject', 'alphanohtml');
diff --git a/htdocs/user/list.php b/htdocs/user/list.php
index a3b69d1dff8..3e1a8ff7f6d 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -371,7 +371,7 @@ if ($search_supervisor > 0) {
if ($search_thirdparty != '') {
$sql .= natural_search(array('s.nom'), $search_thirdparty);
}
-if ($search_warehouse != '') {
+if ($search_warehouse > 0) {
$sql .= natural_search(array('u.fk_warehouse'), $search_warehouse);
}
if ($search_login != '') {
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index d069df8c4d5..6aab64736e3 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -3127,7 +3127,7 @@ if (!GETPOST('hide_websitemenu')) {
print ''; // end websitetools
print '
';
- if (GETPOST('editsource', 'alpha') || GETPOST('editcontent', 'alpha')) {
+ if ($action == 'editsource' || $action == 'editcontent' || GETPOST('editsource', 'alpha') || GETPOST('editcontent', 'alpha')) {
$url = 'https://wiki.dolibarr.org/index.php/Module_Website';
$htmltext = $langs->transnoentitiesnoconv("YouCanEditHtmlSource", $url);