WIP
This commit is contained in:
parent
b658b9b1d3
commit
9328fb4f6c
@ -632,7 +632,7 @@ class Form
|
|||||||
if (!$htmltext) {
|
if (!$htmltext) {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
$direction = (int)$direction; // For backward compatibility when $direction was set to '' instead of 0
|
$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
|
||||||
|
|
||||||
$tag = 'td';
|
$tag = 'td';
|
||||||
if ($notabs == 2) {
|
if ($notabs == 2) {
|
||||||
@ -700,7 +700,7 @@ class Form
|
|||||||
}
|
}
|
||||||
// Use another method to help avoid having a space in value in order to use this value with jquery
|
// Use another method to help avoid having a space in value in order to use this value with jquery
|
||||||
// Define label
|
// Define label
|
||||||
if ((string)$text != '') {
|
if ((string) $text != '') {
|
||||||
$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
|
$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
|
||||||
}
|
}
|
||||||
// Define value if value is after
|
// Define value if value is after
|
||||||
@ -1018,9 +1018,9 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
|
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
|
||||||
$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int)$row['eec']) . '">';
|
$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';
|
||||||
} else {
|
} else {
|
||||||
$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int)$row['eec']) . '">';
|
$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';
|
||||||
}
|
}
|
||||||
$out .= $labeltoshow;
|
$out .= $labeltoshow;
|
||||||
$out .= '</option>' . "\n";
|
$out .= '</option>' . "\n";
|
||||||
@ -1416,13 +1416,13 @@ class Form
|
|||||||
}
|
}
|
||||||
$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
|
$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
|
||||||
if (!empty($user->socid)) {
|
if (!empty($user->socid)) {
|
||||||
$sql .= " AND s.rowid = " . ((int)$user->socid);
|
$sql .= " AND s.rowid = " . ((int) $user->socid);
|
||||||
}
|
}
|
||||||
if ($filter) {
|
if ($filter) {
|
||||||
$sql .= " AND (" . $filter . ")";
|
$sql .= " AND (" . $filter . ")";
|
||||||
}
|
}
|
||||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int)$user->id);
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) {
|
if (!empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) {
|
||||||
$sql .= " AND s.status <> 0";
|
$sql .= " AND s.status <> 0";
|
||||||
@ -1606,7 +1606,7 @@ class Form
|
|||||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||||
$sql .= " re.description, re.fk_facture_source";
|
$sql .= " re.description, re.fk_facture_source";
|
||||||
$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";
|
$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";
|
||||||
$sql .= " WHERE re.fk_soc = " . (int)$socid;
|
$sql .= " WHERE re.fk_soc = " . (int) $socid;
|
||||||
$sql .= " AND re.entity = " . $conf->entity;
|
$sql .= " AND re.entity = " . $conf->entity;
|
||||||
if ($filter) {
|
if ($filter) {
|
||||||
$sql .= " AND " . $filter;
|
$sql .= " AND " . $filter;
|
||||||
@ -1705,6 +1705,8 @@ class Form
|
|||||||
* Return HTML code of the SELECT of list of all contacts (for a third party or all).
|
* Return HTML code of the SELECT of list of all contacts (for a third party or all).
|
||||||
* This also set the number of contacts found into $this->num
|
* This also set the number of contacts found into $this->num
|
||||||
*
|
*
|
||||||
|
* @since 9.0 Add afterSelectContactOptions hook
|
||||||
|
*
|
||||||
* @param int $socid Id ot third party or 0 for all or -1 for empty list
|
* @param int $socid Id ot third party or 0 for all or -1 for empty list
|
||||||
* @param array|int $selected Array of ID of pre-selected contact id
|
* @param array|int $selected Array of ID of pre-selected contact id
|
||||||
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
||||||
@ -1722,8 +1724,6 @@ class Form
|
|||||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
|
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
|
||||||
* @param integer $disableifempty Set tag 'disabled' on select if there is no choice
|
* @param integer $disableifempty Set tag 'disabled' on select if there is no choice
|
||||||
* @return int|string <0 if KO, HTML with select string if OK.
|
* @return int|string <0 if KO, HTML with select string if OK.
|
||||||
* @since 9.0 Add afterSelectContactOptions hook
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0)
|
public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0)
|
||||||
{
|
{
|
||||||
@ -1759,7 +1759,7 @@ class Form
|
|||||||
}
|
}
|
||||||
$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
|
$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
|
||||||
if ($socid > 0 || $socid == -1) {
|
if ($socid > 0 || $socid == -1) {
|
||||||
$sql .= " AND sp.fk_soc = " . ((int)$socid);
|
$sql .= " AND sp.fk_soc = " . ((int) $socid);
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
|
if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
|
||||||
$sql .= " AND sp.statut <> 0";
|
$sql .= " AND sp.statut <> 0";
|
||||||
@ -2033,7 +2033,7 @@ class Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($user->socid)) {
|
if (!empty($user->socid)) {
|
||||||
$sql .= " AND u.fk_soc = " . ((int)$user->socid);
|
$sql .= " AND u.fk_soc = " . ((int) $user->socid);
|
||||||
}
|
}
|
||||||
if (is_array($exclude) && $excludeUsers) {
|
if (is_array($exclude) && $excludeUsers) {
|
||||||
$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")";
|
$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")";
|
||||||
@ -2510,10 +2510,10 @@ class Form
|
|||||||
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
|
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
|
||||||
$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
|
$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
|
||||||
if (!empty($status)) $sql .= ' AND status = ' . (int)$status;
|
if (!empty($status)) $sql .= ' AND status = ' . (int) $status;
|
||||||
if (!empty($type)) $sql .= ' AND bomtype = ' . (int)$type;
|
if (!empty($type)) $sql .= ' AND bomtype = ' . (int) $type;
|
||||||
if (!empty($TProducts)) $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
|
if (!empty($TProducts)) $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
|
||||||
if (!empty($limit)) $sql .= ' LIMIT ' . (int)$limit;
|
if (!empty($limit)) $sql .= ' LIMIT ' . (int) $limit;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
if ($showempty) {
|
if ($showempty) {
|
||||||
@ -2636,13 +2636,13 @@ class Form
|
|||||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||||
$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
|
$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
|
||||||
if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||||
$sql .= " AND price_level = " . ((int)$price_level);
|
$sql .= " AND price_level = " . ((int) $price_level);
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY date_price";
|
$sql .= " ORDER BY date_price";
|
||||||
$sql .= " DESC LIMIT 1) as price_rowid";
|
$sql .= " DESC LIMIT 1) as price_rowid";
|
||||||
$sql .= ", (SELECT pp.price_by_qty FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
|
$sql .= ", (SELECT pp.price_by_qty FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
|
||||||
if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||||
$sql .= " AND price_level = " . ((int)$price_level);
|
$sql .= " AND price_level = " . ((int) $price_level);
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY date_price";
|
$sql .= " ORDER BY date_price";
|
||||||
$sql .= " DESC LIMIT 1) as price_by_qty";
|
$sql .= " DESC LIMIT 1) as price_by_qty";
|
||||||
@ -2662,7 +2662,7 @@ class Form
|
|||||||
|
|
||||||
//Price by customer
|
//Price by customer
|
||||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
|
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
|
||||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int)$socid) . " AND pcp.fk_product=p.rowid";
|
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
|
||||||
}
|
}
|
||||||
// Units
|
// Units
|
||||||
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
|
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
|
||||||
@ -2696,21 +2696,21 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($finished == 0) {
|
if ($finished == 0) {
|
||||||
$sql .= " AND p.finished = " . ((int)$finished);
|
$sql .= " AND p.finished = " . ((int) $finished);
|
||||||
} elseif ($finished == 1) {
|
} elseif ($finished == 1) {
|
||||||
$sql .= " AND p.finished = " . ((int)$finished);
|
$sql .= " AND p.finished = " . ((int) $finished);
|
||||||
if ($status >= 0) {
|
if ($status >= 0) {
|
||||||
$sql .= " AND p.tosell = " . ((int)$status);
|
$sql .= " AND p.tosell = " . ((int) $status);
|
||||||
}
|
}
|
||||||
} elseif ($status >= 0) {
|
} elseif ($status >= 0) {
|
||||||
$sql .= " AND p.tosell = " . ((int)$status);
|
$sql .= " AND p.tosell = " . ((int) $status);
|
||||||
}
|
}
|
||||||
if ($status_purchase >= 0) {
|
if ($status_purchase >= 0) {
|
||||||
$sql .= " AND p.tobuy = " . ((int)$status_purchase);
|
$sql .= " AND p.tobuy = " . ((int) $status_purchase);
|
||||||
}
|
}
|
||||||
// Filter by product type
|
// Filter by product type
|
||||||
if (strval($filtertype) != '') {
|
if (strval($filtertype) != '') {
|
||||||
$sql .= " AND p.fk_product_type = " . ((int)$filtertype);
|
$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
|
||||||
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
|
} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
|
||||||
$sql .= " AND p.fk_product_type = 1";
|
$sql .= " AND p.fk_product_type = 1";
|
||||||
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
|
} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
|
||||||
@ -2822,7 +2822,7 @@ class Form
|
|||||||
if ((!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product
|
if ((!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product
|
||||||
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
|
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
|
||||||
$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
|
$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
|
||||||
$sql .= " WHERE fk_product_price = " . ((int)$objp->price_rowid);
|
$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
|
||||||
$sql .= " ORDER BY quantity ASC";
|
$sql .= " ORDER BY quantity ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
|
dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
|
||||||
@ -3066,9 +3066,9 @@ class Form
|
|||||||
if (empty($hidepriceinlabel) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
|
if (empty($hidepriceinlabel) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
|
||||||
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
|
||||||
$sql .= " FROM " . $this->db->prefix() . "product_price";
|
$sql .= " FROM " . $this->db->prefix() . "product_price";
|
||||||
$sql .= " WHERE fk_product = " . ((int)$objp->rowid);
|
$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
|
||||||
$sql .= " AND entity IN (" . getEntity('productprice') . ")";
|
$sql .= " AND entity IN (" . getEntity('productprice') . ")";
|
||||||
$sql .= " AND price_level = " . ((int)$price_level);
|
$sql .= " AND price_level = " . ((int) $price_level);
|
||||||
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
|
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
|
||||||
$sql .= " LIMIT 1";
|
$sql .= " LIMIT 1";
|
||||||
|
|
||||||
@ -3335,7 +3335,7 @@ class Form
|
|||||||
$sql .= " FROM " . $this->db->prefix() . "product as p";
|
$sql .= " FROM " . $this->db->prefix() . "product as p";
|
||||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
|
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
|
||||||
if ($socid > 0) {
|
if ($socid > 0) {
|
||||||
$sql .= " AND pfp.fk_soc = " . ((int)$socid);
|
$sql .= " AND pfp.fk_soc = " . ((int) $socid);
|
||||||
}
|
}
|
||||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
|
||||||
// Units
|
// Units
|
||||||
@ -3344,10 +3344,10 @@ class Form
|
|||||||
}
|
}
|
||||||
$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
|
$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
|
||||||
if ($statut != -1) {
|
if ($statut != -1) {
|
||||||
$sql .= " AND p.tobuy = " . ((int)$statut);
|
$sql .= " AND p.tobuy = " . ((int) $statut);
|
||||||
}
|
}
|
||||||
if (strval($filtertype) != '') {
|
if (strval($filtertype) != '') {
|
||||||
$sql .= " AND p.fk_product_type = " . ((int)$filtertype);
|
$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
|
||||||
}
|
}
|
||||||
if (!empty($filtre)) {
|
if (!empty($filtre)) {
|
||||||
$sql .= " " . $filtre;
|
$sql .= " " . $filtre;
|
||||||
@ -3734,7 +3734,7 @@ class Form
|
|||||||
$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
|
$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
|
||||||
$sql .= " AND p.tobuy = 1";
|
$sql .= " AND p.tobuy = 1";
|
||||||
$sql .= " AND s.fournisseur = 1";
|
$sql .= " AND s.fournisseur = 1";
|
||||||
$sql .= " AND p.rowid = " . ((int)$productid);
|
$sql .= " AND p.rowid = " . ((int) $productid);
|
||||||
if (empty($conf->global->PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED)) {
|
if (empty($conf->global->PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED)) {
|
||||||
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
|
$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
|
||||||
} else {
|
} else {
|
||||||
@ -3835,7 +3835,7 @@ class Form
|
|||||||
// looking for users
|
// looking for users
|
||||||
$sql = "SELECT a.rowid, a.label";
|
$sql = "SELECT a.rowid, a.label";
|
||||||
$sql .= " FROM " . $this->db->prefix() . "societe_address as a";
|
$sql .= " FROM " . $this->db->prefix() . "societe_address as a";
|
||||||
$sql .= " WHERE a.fk_soc = " . ((int)$socid);
|
$sql .= " WHERE a.fk_soc = " . ((int) $socid);
|
||||||
$sql .= " ORDER BY a.label ASC";
|
$sql .= " ORDER BY a.label ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::select_address", LOG_DEBUG);
|
dol_syslog(get_class($this) . "::select_address", LOG_DEBUG);
|
||||||
@ -4643,7 +4643,7 @@ class Form
|
|||||||
$sql .= ' FROM ' . $this->db->prefix() . 'facture';
|
$sql .= ' FROM ' . $this->db->prefix() . 'facture';
|
||||||
$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
|
$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
|
||||||
$sql .= ' AND situation_counter >= 1';
|
$sql .= ' AND situation_counter >= 1';
|
||||||
$sql .= ' AND fk_soc = ' . (int)$socid;
|
$sql .= ' AND fk_soc = ' . (int) $socid;
|
||||||
$sql .= ' AND type <> 2';
|
$sql .= ' AND type <> 2';
|
||||||
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
|
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -4755,7 +4755,7 @@ class Form
|
|||||||
$sql .= " FROM " . $this->db->prefix() . "bank_account";
|
$sql .= " FROM " . $this->db->prefix() . "bank_account";
|
||||||
$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
|
$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
|
||||||
if ($status != 2) {
|
if ($status != 2) {
|
||||||
$sql .= " AND clos = " . (int)$status;
|
$sql .= " AND clos = " . (int) $status;
|
||||||
}
|
}
|
||||||
if ($filtre) {
|
if ($filtre) {
|
||||||
$sql .= " AND " . $filtre;
|
$sql .= " AND " . $filtre;
|
||||||
@ -4835,7 +4835,7 @@ class Form
|
|||||||
$sql .= " FROM " . $this->db->prefix() . "establishment";
|
$sql .= " FROM " . $this->db->prefix() . "establishment";
|
||||||
$sql .= " WHERE 1=1";
|
$sql .= " WHERE 1=1";
|
||||||
if ($status != 2) {
|
if ($status != 2) {
|
||||||
$sql .= " AND status = " . (int)$status;
|
$sql .= " AND status = " . (int) $status;
|
||||||
}
|
}
|
||||||
if ($filtre) {
|
if ($filtre) {
|
||||||
$sql .= " AND " . $filtre;
|
$sql .= " AND " . $filtre;
|
||||||
@ -6079,8 +6079,8 @@ class Form
|
|||||||
*
|
*
|
||||||
* @param string $selected preselected currency code
|
* @param string $selected preselected currency code
|
||||||
* @param string $htmlname name of HTML select list
|
* @param string $htmlname name of HTML select list
|
||||||
* @return void
|
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function select_currency($selected = '', $htmlname = 'currency_id')
|
public function select_currency($selected = '', $htmlname = 'currency_id')
|
||||||
{
|
{
|
||||||
@ -7078,7 +7078,7 @@ class Form
|
|||||||
}
|
}
|
||||||
$retstring .= "</select>";
|
$retstring .= "</select>";
|
||||||
} elseif ($typehour == 'text' || $typehour == 'textselect') {
|
} elseif ($typehour == 'text' || $typehour == 'textselect') {
|
||||||
$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int)$hourSelected) : '') . '">';
|
$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
|
||||||
} else {
|
} else {
|
||||||
return 'BadValueForParameterTypeHour';
|
return 'BadValueForParameterTypeHour';
|
||||||
}
|
}
|
||||||
@ -7109,7 +7109,7 @@ class Form
|
|||||||
}
|
}
|
||||||
$retstring .= "</select>";
|
$retstring .= "</select>";
|
||||||
} elseif ($typehour == 'text') {
|
} elseif ($typehour == 'text') {
|
||||||
$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int)$minSelected) : '') . '">';
|
$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($typehour != 'text') {
|
if ($typehour != 'text') {
|
||||||
@ -7662,7 +7662,7 @@ class Form
|
|||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
}
|
}
|
||||||
if ($status != -1) {
|
if ($status != -1) {
|
||||||
$sql .= ' AND statut = ' . ((int)$status);
|
$sql .= ' AND statut = ' . ((int) $status);
|
||||||
}
|
}
|
||||||
$sql .= $this->db->plimit($limit, 0);
|
$sql .= $this->db->plimit($limit, 0);
|
||||||
|
|
||||||
@ -7960,14 +7960,14 @@ class Form
|
|||||||
}
|
}
|
||||||
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
|
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
|
||||||
if ($objecttmp->element == 'societe') {
|
if ($objecttmp->element == 'societe') {
|
||||||
$sql .= " AND t.rowid = " . ((int)$user->socid);
|
$sql .= " AND t.rowid = " . ((int) $user->socid);
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND t.fk_soc = " . ((int)$user->socid);
|
$sql .= " AND t.fk_soc = " . ((int) $user->socid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
|
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
|
||||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||||
$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int)$user->id);
|
$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8181,7 +8181,7 @@ class Form
|
|||||||
$out .= ' selected'; // To preselect a value
|
$out .= ' selected'; // To preselect a value
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$id = (string)$id; // if $id = 0, then $id = '0'
|
$id = (string) $id; // if $id = 0, then $id = '0'
|
||||||
if ($id != '' && ($id == $key || ($id == 'ifone' && count($array) == 1)) && !$disabled) {
|
if ($id != '' && ($id == $key || ($id == 'ifone' && count($array) == 1)) && !$disabled) {
|
||||||
$out .= ' selected'; // To preselect a value
|
$out .= ' selected'; // To preselect a value
|
||||||
}
|
}
|
||||||
@ -8209,7 +8209,7 @@ class Form
|
|||||||
if ($addjscombo && $jsbeautify) {
|
if ($addjscombo && $jsbeautify) {
|
||||||
// Enhance with select2
|
// Enhance with select2
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', ($show_empty < 0 ? (string)$show_empty : '-1'), $morecss);
|
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', ($show_empty < 0 ? (string) $show_empty : '-1'), $morecss);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
@ -8287,7 +8287,7 @@ class Form
|
|||||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||||
placeholder: "' . dol_escape_js($placeholder) . '",
|
placeholder: "' . dol_escape_js($placeholder) . '",
|
||||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||||
minimumInputLength: ' . ((int)$minimumInputLength) . ',
|
minimumInputLength: ' . ((int) $minimumInputLength) . ',
|
||||||
formatResult: function(result, container, query, escapeMarkup) {
|
formatResult: function(result, container, query, escapeMarkup) {
|
||||||
return escapeMarkup(result.text);
|
return escapeMarkup(result.text);
|
||||||
},
|
},
|
||||||
@ -8501,7 +8501,7 @@ class Form
|
|||||||
$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
|
$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
|
||||||
|
|
||||||
$out .= '<option value="' . $tmpkey . '"';
|
$out .= '<option value="' . $tmpkey . '"';
|
||||||
if (is_array($selected) && !empty($selected) && in_array((string)$tmpkey, $selected) && ((string)$tmpkey != '')) {
|
if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
|
||||||
$out .= ' selected';
|
$out .= ' selected';
|
||||||
}
|
}
|
||||||
$out .= ' data-html="' . dol_escape_htmltag(($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval) . '"';
|
$out .= ' data-html="' . dol_escape_htmltag(($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval) . '"';
|
||||||
@ -9176,7 +9176,7 @@ class Form
|
|||||||
$resultyesno .= '</select>' . "\n";
|
$resultyesno .= '</select>' . "\n";
|
||||||
|
|
||||||
if ($addjscombo) {
|
if ($addjscombo) {
|
||||||
$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string)$useempty : '-1'), $morecss);
|
$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $resultyesno;
|
return $resultyesno;
|
||||||
@ -9510,9 +9510,9 @@ class Form
|
|||||||
$dir = $conf->societe->multidir_output[$entity];
|
$dir = $conf->societe->multidir_output[$entity];
|
||||||
if (!empty($object->logo)) {
|
if (!empty($object->logo)) {
|
||||||
if (dolIsAllowedForPreview($object->logo)) {
|
if (dolIsAllowedForPreview($object->logo)) {
|
||||||
if ((string)$imagesize == 'mini') {
|
if ((string) $imagesize == 'mini') {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
|
$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
|
||||||
} elseif ((string)$imagesize == 'small') {
|
} elseif ((string) $imagesize == 'small') {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
|
$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
|
||||||
} else {
|
} else {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
|
$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
|
||||||
@ -9525,9 +9525,9 @@ class Form
|
|||||||
$dir = $conf->societe->multidir_output[$entity] . '/contact';
|
$dir = $conf->societe->multidir_output[$entity] . '/contact';
|
||||||
if (!empty($object->photo)) {
|
if (!empty($object->photo)) {
|
||||||
if (dolIsAllowedForPreview($object->photo)) {
|
if (dolIsAllowedForPreview($object->photo)) {
|
||||||
if ((string)$imagesize == 'mini') {
|
if ((string) $imagesize == 'mini') {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
|
$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
|
||||||
} elseif ((string)$imagesize == 'small') {
|
} elseif ((string) $imagesize == 'small') {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
|
$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
|
||||||
} else {
|
} else {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
|
$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
|
||||||
@ -9541,9 +9541,9 @@ class Form
|
|||||||
$dir = $conf->user->dir_output;
|
$dir = $conf->user->dir_output;
|
||||||
if (!empty($object->photo)) {
|
if (!empty($object->photo)) {
|
||||||
if (dolIsAllowedForPreview($object->photo)) {
|
if (dolIsAllowedForPreview($object->photo)) {
|
||||||
if ((string)$imagesize == 'mini') {
|
if ((string) $imagesize == 'mini') {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
|
$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
|
||||||
} elseif ((string)$imagesize == 'small') {
|
} elseif ((string) $imagesize == 'small') {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
|
$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
|
||||||
} else {
|
} else {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
|
$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
|
||||||
@ -9560,9 +9560,9 @@ class Form
|
|||||||
$dir = $conf->adherent->dir_output;
|
$dir = $conf->adherent->dir_output;
|
||||||
if (!empty($object->photo)) {
|
if (!empty($object->photo)) {
|
||||||
if (dolIsAllowedForPreview($object->photo)) {
|
if (dolIsAllowedForPreview($object->photo)) {
|
||||||
if ((string)$imagesize == 'mini') {
|
if ((string) $imagesize == 'mini') {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
|
$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
|
||||||
} elseif ((string)$imagesize == 'small') {
|
} elseif ((string) $imagesize == 'small') {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
|
$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
|
||||||
} else {
|
} else {
|
||||||
$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
|
$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
|
||||||
@ -9580,9 +9580,9 @@ class Form
|
|||||||
$dir = $conf->$modulepart->dir_output;
|
$dir = $conf->$modulepart->dir_output;
|
||||||
if (!empty($object->photo)) {
|
if (!empty($object->photo)) {
|
||||||
if (dolIsAllowedForPreview($object->photo)) {
|
if (dolIsAllowedForPreview($object->photo)) {
|
||||||
if ((string)$imagesize == 'mini') {
|
if ((string) $imagesize == 'mini') {
|
||||||
$file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
|
$file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
|
||||||
} elseif ((string)$imagesize == 'small') {
|
} elseif ((string) $imagesize == 'small') {
|
||||||
$file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small');
|
$file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small');
|
||||||
} else {
|
} else {
|
||||||
$file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
|
$file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
|
||||||
@ -10076,8 +10076,7 @@ class Form
|
|||||||
* @param User $usertofilter User object to use for filtering
|
* @param User $usertofilter User object to use for filtering
|
||||||
* @return int Nbr of project if OK, <0 if KO
|
* @return int Nbr of project if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public
|
public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
|
||||||
function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
|
|
||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
@ -10206,7 +10205,7 @@ class Form
|
|||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db->lasterror);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10223,8 +10222,7 @@ class Form
|
|||||||
* @param string $morecss More css added to the select component
|
* @param string $morecss More css added to the select component
|
||||||
* @return int Nbr of project if OK, <0 if KO
|
* @return int Nbr of project if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public
|
public function selectInvoiceRec($selected = '', $htmlname = 'facrecid', $maxlength = 24, $option_only = 0, $show_empty = '1', $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500')
|
||||||
function selectInvoiceRec($selected = '', $htmlname = 'facrecid', $maxlength = 24, $option_only = 0, $show_empty = '1', $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500')
|
|
||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
@ -10315,8 +10313,7 @@ class Form
|
|||||||
* @param string $search_component_params_hidden String with $search_component_params criterias
|
* @param string $search_component_params_hidden String with $search_component_params criterias
|
||||||
* @return string HTML component for advanced search
|
* @return string HTML component for advanced search
|
||||||
*/
|
*/
|
||||||
public
|
public function searchComponent($arrayofcriterias, $search_component_params, $arrayofinputfieldsalreadyoutput = array(), $search_component_params_hidden = '')
|
||||||
function searchComponent($arrayofcriterias, $search_component_params, $arrayofinputfieldsalreadyoutput = array(), $search_component_params_hidden = '')
|
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -10403,8 +10400,7 @@ class Form
|
|||||||
* @param int $addjscombo Add js combobox
|
* @param int $addjscombo Add js combobox
|
||||||
* @return string HTML select string
|
* @return string HTML select string
|
||||||
*/
|
*/
|
||||||
public
|
public function selectModelMail($prefix, $modelType = '', $default = 0, $addjscombo = 0)
|
||||||
function selectModelMail($prefix, $modelType = '', $default = 0, $addjscombo = 0)
|
|
||||||
{
|
{
|
||||||
global $langs, $user;
|
global $langs, $user;
|
||||||
|
|
||||||
@ -10452,8 +10448,7 @@ class Form
|
|||||||
* @param string $dol_openinpopup If the button are shown in a context of a page shown inside a popup, we put here the string name of popup.
|
* @param string $dol_openinpopup If the button are shown in a context of a page shown inside a popup, we put here the string name of popup.
|
||||||
* @return string Html code with the buttons
|
* @return string Html code with the buttons
|
||||||
*/
|
*/
|
||||||
public
|
public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = 0, $morecss = '', $dol_openinpopup = '')
|
||||||
function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = 0, $morecss = '', $dol_openinpopup = '')
|
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,7 @@ class FormProjets
|
|||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output a combo list with projects qualified for a third party / user
|
* Output a combo list with projects qualified for a third party / user
|
||||||
*
|
*
|
||||||
@ -94,18 +95,18 @@ class FormProjets
|
|||||||
$placeholder = '';
|
$placeholder = '';
|
||||||
|
|
||||||
if ($selected && empty($selected_input_value)) {
|
if ($selected && empty($selected_input_value)) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||||
$project = new Project($this->db);
|
$project = new Project($this->db);
|
||||||
$project->fetch($selected);
|
$project->fetch($selected);
|
||||||
$selected_input_value = $project->ref;
|
$selected_input_value = $project->ref;
|
||||||
}
|
}
|
||||||
$urloption = 'socid='.((int) $socid).'&htmlname='.urlencode($htmlname).'&discardclosed='.((int) $discard_closed);
|
$urloption = 'socid=' . ((int) $socid) . '&htmlname=' . urlencode($htmlname) . '&discardclosed=' . ((int) $discard_closed);
|
||||||
if ($morefilter == 'usage_organize_event=1') {
|
if ($morefilter == 'usage_organize_event=1') {
|
||||||
$urloption .= '&usage_organize_event=1';
|
$urloption .= '&usage_organize_event=1';
|
||||||
}
|
}
|
||||||
$out .= '<input type="text" class="minwidth200'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
|
$out .= '<input type="text" class="minwidth200' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' />';
|
||||||
|
|
||||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array());
|
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array());
|
||||||
} else {
|
} else {
|
||||||
$out .= $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, abs($discard_closed), $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss, $morefilter);
|
$out .= $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, abs($discard_closed), $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss, $morefilter);
|
||||||
}
|
}
|
||||||
@ -124,6 +125,7 @@ class FormProjets
|
|||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array with projects qualified for a third party
|
* Returns an array with projects qualified for a third party
|
||||||
*
|
*
|
||||||
@ -150,7 +152,7 @@ class FormProjets
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||||
|
|
||||||
if (empty($htmlid)) {
|
if (empty($htmlid)) {
|
||||||
$htmlid = $htmlname;
|
$htmlid = $htmlname;
|
||||||
@ -172,26 +174,26 @@ class FormProjets
|
|||||||
|
|
||||||
// Search all projects
|
// Search all projects
|
||||||
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, s.nom as name, s.name_alias";
|
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, s.nom as name, s.name_alias";
|
||||||
$sql .= " FROM ".$this->db->prefix()."projet as p LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc";
|
$sql .= " FROM " . $this->db->prefix() . "projet as p LEFT JOIN " . $this->db->prefix() . "societe as s ON s.rowid = p.fk_soc";
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
|
||||||
if ($projectsListId !== false) {
|
if ($projectsListId !== false) {
|
||||||
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
|
$sql .= " AND p.rowid IN (" . $this->db->sanitize($projectsListId) . ")";
|
||||||
}
|
}
|
||||||
if ($socid == 0) {
|
if ($socid == 0) {
|
||||||
$sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
$sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||||
}
|
}
|
||||||
if ($socid > 0) {
|
if ($socid > 0) {
|
||||||
if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
|
if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
|
||||||
$sql .= " AND (p.fk_soc=".((int) $socid)." OR p.fk_soc IS NULL)";
|
$sql .= " AND (p.fk_soc=" . ((int) $socid) . " OR p.fk_soc IS NULL)";
|
||||||
} elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
|
} elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
|
||||||
$sql .= " AND (p.fk_soc IN (".$this->db->sanitize(((int) $socid).", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY).") OR p.fk_soc IS NULL)";
|
$sql .= " AND (p.fk_soc IN (" . $this->db->sanitize(((int) $socid) . ", " . $conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) . ") OR p.fk_soc IS NULL)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($filterkey)) {
|
if (!empty($filterkey)) {
|
||||||
$sql .= natural_search(array('p.title', 'p.ref'), $filterkey);
|
$sql .= natural_search(array('p.title', 'p.ref'), $filterkey);
|
||||||
}
|
}
|
||||||
if ($morefilter) {
|
if ($morefilter) {
|
||||||
$sql .= ' AND ('.$this->db->sanitize($morefilter, 0, 1).')';
|
$sql .= ' AND (' . $this->db->sanitize($morefilter, 0, 1) . ')';
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY p.ref ASC";
|
$sql .= " ORDER BY p.ref ASC";
|
||||||
|
|
||||||
@ -201,7 +203,7 @@ class FormProjets
|
|||||||
$morecss .= ' minwidth100';
|
$morecss .= ' minwidth100';
|
||||||
}
|
}
|
||||||
if (empty($option_only)) {
|
if (empty($option_only)) {
|
||||||
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlid.'" name="'.$htmlname.'">';
|
$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlid . '" name="' . $htmlname . '">';
|
||||||
}
|
}
|
||||||
if (!empty($show_empty)) {
|
if (!empty($show_empty)) {
|
||||||
$out .= '<option value="0"> </option>';
|
$out .= '<option value="0"> </option>';
|
||||||
@ -223,37 +225,37 @@ class FormProjets
|
|||||||
$labeltoshow = dol_trunc($obj->ref, 18);
|
$labeltoshow = dol_trunc($obj->ref, 18);
|
||||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
||||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||||
$labeltoshow .= ', '.dol_trunc($obj->title, $maxlength);
|
$labeltoshow .= ', ' . dol_trunc($obj->title, $maxlength);
|
||||||
if ($obj->name) {
|
if ($obj->name) {
|
||||||
$labeltoshow .= ' - '.$obj->name;
|
$labeltoshow .= ' - ' . $obj->name;
|
||||||
if ($obj->name_alias) {
|
if ($obj->name_alias) {
|
||||||
$labeltoshow .= ' ('.$obj->name_alias.')';
|
$labeltoshow .= ' (' . $obj->name_alias . ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$disabled = 0;
|
$disabled = 0;
|
||||||
if ($obj->fk_statut == 0) {
|
if ($obj->fk_statut == 0) {
|
||||||
$disabled = 1;
|
$disabled = 1;
|
||||||
$labeltoshow .= ' - '.$langs->trans("Draft");
|
$labeltoshow .= ' - ' . $langs->trans("Draft");
|
||||||
} elseif ($obj->fk_statut == 2) {
|
} elseif ($obj->fk_statut == 2) {
|
||||||
if ($discard_closed == 2) {
|
if ($discard_closed == 2) {
|
||||||
$disabled = 1;
|
$disabled = 1;
|
||||||
}
|
}
|
||||||
$labeltoshow .= ' - '.$langs->trans("Closed");
|
$labeltoshow .= ' - ' . $langs->trans("Closed");
|
||||||
} elseif (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
|
} elseif (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
|
||||||
$disabled = 1;
|
$disabled = 1;
|
||||||
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
|
$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($selected) && $selected == $obj->rowid) {
|
if (!empty($selected) && $selected == $obj->rowid) {
|
||||||
$out .= '<option value="'.$obj->rowid.'" selected';
|
$out .= '<option value="' . $obj->rowid . '" selected';
|
||||||
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
||||||
$out .= '>'.$labeltoshow.'</option>';
|
$out .= '>' . $labeltoshow . '</option>';
|
||||||
} else {
|
} else {
|
||||||
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
|
||||||
$resultat = '';
|
$resultat = '';
|
||||||
} else {
|
} else {
|
||||||
$resultat = '<option value="'.$obj->rowid.'"';
|
$resultat = '<option value="' . $obj->rowid . '"';
|
||||||
if ($disabled) {
|
if ($disabled) {
|
||||||
$resultat .= ' disabled';
|
$resultat .= ' disabled';
|
||||||
}
|
}
|
||||||
@ -270,7 +272,7 @@ class FormProjets
|
|||||||
'value' => $obj->ref,
|
'value' => $obj->ref,
|
||||||
'ref' => $obj->ref,
|
'ref' => $obj->ref,
|
||||||
'labelx' => $labeltoshow,
|
'labelx' => $labeltoshow,
|
||||||
'label' => ($disabled ? '<span class="opacitymedium">'.$labeltoshow.'</span>' : $labeltoshow),
|
'label' => ($disabled ? '<span class="opacitymedium">' . $labeltoshow . '</span>' : $labeltoshow),
|
||||||
'disabled' => (bool) $disabled
|
'disabled' => (bool) $disabled
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -288,7 +290,7 @@ class FormProjets
|
|||||||
|
|
||||||
// Use select2 selector
|
// Use select2 selector
|
||||||
if (!empty($conf->use_javascript_ajax)) {
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
|
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
|
||||||
$out .= $comboenhancement;
|
$out .= $comboenhancement;
|
||||||
$morecss .= ' minwidth100';
|
$morecss .= ' minwidth100';
|
||||||
@ -331,7 +333,7 @@ class FormProjets
|
|||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||||
|
|
||||||
if (is_null($usertofilter)) {
|
if (is_null($usertofilter)) {
|
||||||
$usertofilter = $user;
|
$usertofilter = $user;
|
||||||
@ -355,19 +357,19 @@ class FormProjets
|
|||||||
$sql = "SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,";
|
$sql = "SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,";
|
||||||
$sql .= " p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,";
|
$sql .= " p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,";
|
||||||
$sql .= " s.nom as name";
|
$sql .= " s.nom as name";
|
||||||
$sql .= " FROM ".$this->db->prefix()."projet as p";
|
$sql .= " FROM " . $this->db->prefix() . "projet as p";
|
||||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc,";
|
$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON s.rowid = p.fk_soc,";
|
||||||
$sql .= " ".$this->db->prefix()."projet_task as t";
|
$sql .= " " . $this->db->prefix() . "projet_task as t";
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
|
||||||
$sql .= " AND t.fk_projet = p.rowid";
|
$sql .= " AND t.fk_projet = p.rowid";
|
||||||
if ($projectsListId) {
|
if ($projectsListId) {
|
||||||
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
|
$sql .= " AND p.rowid IN (" . $this->db->sanitize($projectsListId) . ")";
|
||||||
}
|
}
|
||||||
if ($socid == 0) {
|
if ($socid == 0) {
|
||||||
$sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
$sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||||
}
|
}
|
||||||
if ($socid > 0) {
|
if ($socid > 0) {
|
||||||
$sql .= " AND (p.fk_soc=".((int) $socid)." OR p.fk_soc IS NULL)";
|
$sql .= " AND (p.fk_soc=" . ((int) $socid) . " OR p.fk_soc IS NULL)";
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY p.ref, t.ref ASC";
|
$sql .= " ORDER BY p.ref, t.ref ASC";
|
||||||
|
|
||||||
@ -375,14 +377,14 @@ class FormProjets
|
|||||||
if ($resql) {
|
if ($resql) {
|
||||||
// Use select2 selector
|
// Use select2 selector
|
||||||
if (empty($option_only) && !empty($conf->use_javascript_ajax)) {
|
if (empty($option_only) && !empty($conf->use_javascript_ajax)) {
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||||
$out .= $comboenhancement;
|
$out .= $comboenhancement;
|
||||||
$morecss .= ' minwidth200 maxwidth500';
|
$morecss .= ' minwidth200 maxwidth500';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($option_only)) {
|
if (empty($option_only)) {
|
||||||
$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
|
$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
|
||||||
}
|
}
|
||||||
if (!empty($show_empty)) {
|
if (!empty($show_empty)) {
|
||||||
$out .= '<option value="0" class="optiongrey">';
|
$out .= '<option value="0" class="optiongrey">';
|
||||||
@ -428,58 +430,58 @@ class FormProjets
|
|||||||
$labeltoshow .= dol_trunc($obj->ref, 18); // Project ref
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Project ref
|
||||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
||||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||||
$labeltoshow .= ' '.dol_trunc($obj->title, $maxlength);
|
$labeltoshow .= ' ' . dol_trunc($obj->title, $maxlength);
|
||||||
$titletoshow = $labeltoshow;
|
$titletoshow = $labeltoshow;
|
||||||
|
|
||||||
if ($obj->name) {
|
if ($obj->name) {
|
||||||
$labeltoshow .= ' ('.$obj->name.')';
|
$labeltoshow .= ' (' . $obj->name . ')';
|
||||||
$titletoshow .= ' <span class="opacitymedium">('.$obj->name.')</span>';
|
$titletoshow .= ' <span class="opacitymedium">(' . $obj->name . ')</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$disabled = 0;
|
$disabled = 0;
|
||||||
if ($obj->fk_statut == Project::STATUS_DRAFT) {
|
if ($obj->fk_statut == Project::STATUS_DRAFT) {
|
||||||
$disabled = 1;
|
$disabled = 1;
|
||||||
$labeltoshow .= ' - '.$langs->trans("Draft");
|
$labeltoshow .= ' - ' . $langs->trans("Draft");
|
||||||
$titletoshow .= ' - <span class="opacitymedium">'.$langs->trans("Draft").'</span>';
|
$titletoshow .= ' - <span class="opacitymedium">' . $langs->trans("Draft") . '</span>';
|
||||||
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
|
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
|
||||||
if ($discard_closed == 2) {
|
if ($discard_closed == 2) {
|
||||||
$disabled = 1;
|
$disabled = 1;
|
||||||
}
|
}
|
||||||
$labeltoshow .= ' - '.$langs->trans("Closed");
|
$labeltoshow .= ' - ' . $langs->trans("Closed");
|
||||||
$titletoshow .= ' - <span class="opacitymedium">'.$langs->trans("Closed").'</span>';
|
$titletoshow .= ' - <span class="opacitymedium">' . $langs->trans("Closed") . '</span>';
|
||||||
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
|
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
|
||||||
$disabled = 1;
|
$disabled = 1;
|
||||||
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
|
$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
|
||||||
$titletoshow .= ' - <span class="opacitymedium">'.$langs->trans("LinkedToAnotherCompany").'</span>';
|
$titletoshow .= ' - <span class="opacitymedium">' . $langs->trans("LinkedToAnotherCompany") . '</span>';
|
||||||
}
|
}
|
||||||
$labeltoshow .= ' - ';
|
$labeltoshow .= ' - ';
|
||||||
$titletoshow .= ' - ';
|
$titletoshow .= ' - ';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Label for task
|
// Label for task
|
||||||
$labeltoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
|
$labeltoshow .= $obj->tref . ' ' . dol_trunc($obj->tlabel, $maxlength);
|
||||||
$titletoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
|
$titletoshow .= $obj->tref . ' ' . dol_trunc($obj->tlabel, $maxlength);
|
||||||
if ($obj->usage_task && preg_match('/progress/', $showmore)) {
|
if ($obj->usage_task && preg_match('/progress/', $showmore)) {
|
||||||
$labeltoshow .= ' <span class="opacitymedium">('.$obj->progress.'%)</span>';
|
$labeltoshow .= ' <span class="opacitymedium">(' . $obj->progress . '%)</span>';
|
||||||
$titletoshow .= ' <span class="opacitymedium">('.$obj->progress.'%)</span>';
|
$titletoshow .= ' <span class="opacitymedium">(' . $obj->progress . '%)</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($selected) && $selected == $obj->rowid) {
|
if (!empty($selected) && $selected == $obj->rowid) {
|
||||||
$out .= '<option value="'.$obj->rowid.'" selected';
|
$out .= '<option value="' . $obj->rowid . '" selected';
|
||||||
$out .= ' data-html="'.dol_escape_htmltag($titletoshow).'"';
|
$out .= ' data-html="' . dol_escape_htmltag($titletoshow) . '"';
|
||||||
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
||||||
$out .= '>'.$labeltoshow.'</option>';
|
$out .= '>' . $labeltoshow . '</option>';
|
||||||
} else {
|
} else {
|
||||||
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
|
||||||
$resultat = '';
|
$resultat = '';
|
||||||
} else {
|
} else {
|
||||||
$resultat = '<option value="'.$obj->rowid.'"';
|
$resultat = '<option value="' . $obj->rowid . '"';
|
||||||
if ($disabled) {
|
if ($disabled) {
|
||||||
$resultat .= ' disabled';
|
$resultat .= ' disabled';
|
||||||
}
|
}
|
||||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
|
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
|
||||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||||
$resultat .= ' data-html="'.dol_escape_htmltag($titletoshow).'"';
|
$resultat .= ' data-html="' . dol_escape_htmltag($titletoshow) . '"';
|
||||||
$resultat .= '>';
|
$resultat .= '>';
|
||||||
$resultat .= $labeltoshow;
|
$resultat .= $labeltoshow;
|
||||||
$resultat .= '</option>';
|
$resultat .= '</option>';
|
||||||
@ -508,6 +510,7 @@ class FormProjets
|
|||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a HTML select list of element of same thirdparty to suggest to link them to project
|
* Build a HTML select list of element of same thirdparty to suggest to link them to project
|
||||||
*
|
*
|
||||||
@ -597,30 +600,30 @@ class FormProjets
|
|||||||
if ($linkedtothirdparty) {
|
if ($linkedtothirdparty) {
|
||||||
$sql .= ", s.nom as name";
|
$sql .= ", s.nom as name";
|
||||||
}
|
}
|
||||||
$sql .= " FROM ".$this->db->prefix().$table_element." as t";
|
$sql .= " FROM " . $this->db->prefix() . $table_element . " as t";
|
||||||
if ($linkedtothirdparty) {
|
if ($linkedtothirdparty) {
|
||||||
$sql .= ", ".$this->db->prefix()."societe as s";
|
$sql .= ", " . $this->db->prefix() . "societe as s";
|
||||||
}
|
}
|
||||||
$sql .= " WHERE ".$projectkey." is null";
|
$sql .= " WHERE " . $projectkey . " is null";
|
||||||
if (!empty($socid) && $linkedtothirdparty) {
|
if (!empty($socid) && $linkedtothirdparty) {
|
||||||
if (is_numeric($socid)) {
|
if (is_numeric($socid)) {
|
||||||
$sql .= " AND t.fk_soc = ".((int) $socid);
|
$sql .= " AND t.fk_soc = " . ((int) $socid);
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND t.fk_soc IN (".$this->db->sanitize($socid).")";
|
$sql .= " AND t.fk_soc IN (" . $this->db->sanitize($socid) . ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!in_array($table_element, array('expensereport_det', 'stock_mouvement'))) {
|
if (!in_array($table_element, array('expensereport_det', 'stock_mouvement'))) {
|
||||||
$sql .= ' AND t.entity IN ('.getEntity('project').')';
|
$sql .= ' AND t.entity IN (' . getEntity('project') . ')';
|
||||||
}
|
}
|
||||||
if ($linkedtothirdparty) {
|
if ($linkedtothirdparty) {
|
||||||
$sql .= " AND s.rowid = t.fk_soc";
|
$sql .= " AND s.rowid = t.fk_soc";
|
||||||
}
|
}
|
||||||
if ($sqlfilter) {
|
if ($sqlfilter) {
|
||||||
$sql .= " AND ".$sqlfilter;
|
$sql .= " AND " . $sqlfilter;
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY ref DESC";
|
$sql .= " ORDER BY ref DESC";
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::select_element', LOG_DEBUG);
|
dol_syslog(get_class($this) . '::select_element', LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
@ -628,18 +631,18 @@ class FormProjets
|
|||||||
$sellist = '';
|
$sellist = '';
|
||||||
|
|
||||||
if ($num > 0) {
|
if ($num > 0) {
|
||||||
$sellist = '<select class="flat elementselect css'.$table_element.($morecss ? ' '.$morecss : '').'" name="elementselect">';
|
$sellist = '<select class="flat elementselect css' . $table_element . ($morecss ? ' ' . $morecss : '') . '" name="elementselect">';
|
||||||
$sellist .= '<option value="-1"'.($placeholder ? ' class="optiongrey"' : '').'>'.$placeholder.'</option>';
|
$sellist .= '<option value="-1"' . ($placeholder ? ' class="optiongrey"' : '') . '>' . $placeholder . '</option>';
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$ref = $obj->ref ? $obj->ref : $obj->rowid;
|
$ref = $obj->ref ? $obj->ref : $obj->rowid;
|
||||||
if (!empty($obj->ref_supplier)) {
|
if (!empty($obj->ref_supplier)) {
|
||||||
$ref .= ' ('.$obj->ref_supplier.')';
|
$ref .= ' (' . $obj->ref_supplier . ')';
|
||||||
}
|
}
|
||||||
if (!empty($obj->name)) {
|
if (!empty($obj->name)) {
|
||||||
$ref .= ' - '.$obj->name;
|
$ref .= ' - ' . $obj->name;
|
||||||
}
|
}
|
||||||
$sellist .= '<option value="'.$obj->rowid.'">'.$ref.'</option>';
|
$sellist .= '<option value="' . $obj->rowid . '">' . $ref . '</option>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sellist .= '</select>';
|
$sellist .= '</select>';
|
||||||
@ -657,7 +660,7 @@ class FormProjets
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$this->errors[] = $this->db->lasterror();
|
$this->errors[] = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::select_element ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::select_element " . $this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -682,7 +685,7 @@ class FormProjets
|
|||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
$sql = "SELECT rowid, code, label, percent";
|
$sql = "SELECT rowid, code, label, percent";
|
||||||
$sql .= " FROM ".$this->db->prefix().'c_lead_status';
|
$sql .= " FROM " . $this->db->prefix() . 'c_lead_status';
|
||||||
$sql .= " WHERE active = 1";
|
$sql .= " WHERE active = 1";
|
||||||
$sql .= " ORDER BY position";
|
$sql .= " ORDER BY position";
|
||||||
|
|
||||||
@ -691,31 +694,31 @@ class FormProjets
|
|||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num > 0) {
|
if ($num > 0) {
|
||||||
$sellist = '<select class="flat oppstatus'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
|
$sellist = '<select class="flat oppstatus' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
|
||||||
if ($showempty) {
|
if ($showempty) {
|
||||||
// Without  , strange move of screen when switching value
|
// Without  , strange move of screen when switching value
|
||||||
$sellist .= '<option value="-1"> </option>';
|
$sellist .= '<option value="-1"> </option>';
|
||||||
}
|
}
|
||||||
if ($showallnone) {
|
if ($showallnone) {
|
||||||
$sellist .= '<option value="all"'.($preselected == 'all' ? ' selected="selected"' : '').'>-- '.$langs->trans("OnlyOpportunitiesShort").'</option>';
|
$sellist .= '<option value="all"' . ($preselected == 'all' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("OnlyOpportunitiesShort") . '</option>';
|
||||||
$sellist .= '<option value="openedopp"'.($preselected == 'openedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("OpenedOpportunitiesShort").'</option>';
|
$sellist .= '<option value="openedopp"' . ($preselected == 'openedopp' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("OpenedOpportunitiesShort") . '</option>';
|
||||||
$sellist .= '<option value="notopenedopp"'.($preselected == 'notopenedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotOpenedOpportunitiesShort").'</option>';
|
$sellist .= '<option value="notopenedopp"' . ($preselected == 'notopenedopp' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("NotOpenedOpportunitiesShort") . '</option>';
|
||||||
$sellist .= '<option value="none"'.($preselected == 'none' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotAnOpportunityShort").'</option>';
|
$sellist .= '<option value="none"' . ($preselected == 'none' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("NotAnOpportunityShort") . '</option>';
|
||||||
}
|
}
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$sellist .= '<option value="'.$obj->rowid.'" defaultpercent="'.$obj->percent.'" elemcode="'.$obj->code.'"';
|
$sellist .= '<option value="' . $obj->rowid . '" defaultpercent="' . $obj->percent . '" elemcode="' . $obj->code . '"';
|
||||||
if ($obj->rowid == $preselected) {
|
if ($obj->rowid == $preselected) {
|
||||||
$sellist .= ' selected="selected"';
|
$sellist .= ' selected="selected"';
|
||||||
}
|
}
|
||||||
$sellist .= '>';
|
$sellist .= '>';
|
||||||
if ($useshortlabel) {
|
if ($useshortlabel) {
|
||||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label);
|
$finallabel = ($langs->transnoentitiesnoconv("OppStatus" . $obj->code) != "OppStatus" . $obj->code ? $langs->transnoentitiesnoconv("OppStatus" . $obj->code) : $obj->label);
|
||||||
} else {
|
} else {
|
||||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label);
|
$finallabel = ($langs->transnoentitiesnoconv("OppStatus" . $obj->code) != "OppStatus" . $obj->code ? $langs->transnoentitiesnoconv("OppStatus" . $obj->code) : $obj->label);
|
||||||
if ($showpercent) {
|
if ($showpercent) {
|
||||||
$finallabel .= ' ('.$obj->percent.'%)';
|
$finallabel .= ' (' . $obj->percent . '%)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sellist .= $finallabel;
|
$sellist .= $finallabel;
|
||||||
@ -744,7 +747,7 @@ class FormProjets
|
|||||||
} else {
|
} else {
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$this->errors[] = $this->db->lasterror();
|
$this->errors[] = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::selectOpportunityStatus ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::selectOpportunityStatus " . $this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -756,7 +759,6 @@ class FormProjets
|
|||||||
* @param int $selectedLineId Id invoice line preselected
|
* @param int $selectedLineId Id invoice line preselected
|
||||||
* @param string $htmlNameInvoiceId Name of HTML select for Invoice
|
* @param string $htmlNameInvoiceId Name of HTML select for Invoice
|
||||||
* @param int $htmlNameInvoiceLineId Name of HTML select for Invoice Line
|
* @param int $htmlNameInvoiceLineId Name of HTML select for Invoice Line
|
||||||
* @param int $option_only Return only html options lines without the select tag
|
|
||||||
* @param string $morecss More css added to the select component
|
* @param string $morecss More css added to the select component
|
||||||
* @param array $filters Array of filters
|
* @param array $filters Array of filters
|
||||||
* @return int Nbr of project if OK, <0 if KO
|
* @return int Nbr of project if OK, <0 if KO
|
||||||
@ -779,10 +781,10 @@ class FormProjets
|
|||||||
if (!empty($filters)) {
|
if (!empty($filters)) {
|
||||||
foreach ($filters as $key => $value) {
|
foreach ($filters as $key => $value) {
|
||||||
if ($key == 'p.rowid') {
|
if ($key == 'p.rowid') {
|
||||||
$sql .= " AND p.rowid=" . (int)$value;
|
$sql .= " AND p.rowid=" . (int) $value;
|
||||||
}
|
}
|
||||||
if ($key == 'f.rowid') {
|
if ($key == 'f.rowid') {
|
||||||
$sql .= " AND f.rowid=" . (int)$value;
|
$sql .= " AND f.rowid=" . (int) $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -852,7 +854,6 @@ class FormProjets
|
|||||||
$labeltoshow .= $obj->label; // Invoice ref
|
$labeltoshow .= $obj->label; // Invoice ref
|
||||||
$labeltoshow .= dol_trunc($obj->description, 25); // Invoice ref
|
$labeltoshow .= dol_trunc($obj->description, 25); // Invoice ref
|
||||||
|
|
||||||
|
|
||||||
$out .= '<option value="' . $obj->rowid . '" ';
|
$out .= '<option value="' . $obj->rowid . '" ';
|
||||||
if (!empty($selectedInvoiceId) && $selectedLineId == $obj->rowid) {
|
if (!empty($selectedInvoiceId) && $selectedLineId == $obj->rowid) {
|
||||||
$out .= ' selected ';
|
$out .= ' selected ';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user