2
0
forked from Wavyzz/dolibarr

Merge HEAD, branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
Florian HENRY
2021-01-07 17:54:49 +01:00
113 changed files with 1848 additions and 1103 deletions

View File

@@ -91,7 +91,7 @@ class box_birthdays extends ModeleBoxes
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.statut = 1";
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
$sql .= " ORDER BY u.birth ASC";
$sql .= " ORDER BY DAY(u.birth) ASC";
$sql .= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);

View File

@@ -91,7 +91,7 @@ class box_birthdays_members extends ModeleBoxes
$sql .= " WHERE u.entity IN (".getEntity('adherent').")";
$sql .= " AND u.statut = 1";
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
$sql .= " ORDER BY u.birth ASC";
$sql .= " ORDER BY DAY(u.birth) ASC";
$sql .= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);

View File

@@ -83,7 +83,7 @@ class box_commandes extends ModeleBoxes
$societestatic = new Societe($this->db);
$userstatic = new User($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."CustomerOrders", $max));
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerOrders", $max));
if ($user->rights->commande->lire)
{
@@ -108,7 +108,7 @@ class box_commandes extends ModeleBoxes
if (!empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql .= " AND c.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql .= " ORDER BY c.tms DESC, c.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@@ -92,7 +92,7 @@ class box_contracts extends ModeleBoxes
$sql .= " AND c.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC ";
if (! empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC ";
else $sql .= " ORDER BY c.tms DESC, c.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@@ -81,7 +81,7 @@ class box_factures extends ModeleBoxes
$langs->load("bills");
$text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."CustomerBills", $max);
$text = $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerBills", $max);
$this->info_box_head = array(
'text' => $text,
'limit'=> dol_strlen($text)
@@ -106,7 +106,7 @@ class box_factures extends ModeleBoxes
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY f.datef DESC, f.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY f.datef DESC, f.ref DESC ";
else $sql .= " ORDER BY f.tms DESC, f.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@@ -81,7 +81,7 @@ class box_factures_fourn extends ModeleBoxes
$thirdpartystatic = new Fournisseur($this->db);
$this->info_box_head = array(
'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."SupplierBills", $max)
'text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierBills", $max)
);
if ($user->rights->fournisseur->facture->lire)
@@ -104,7 +104,7 @@ class box_factures_fourn extends ModeleBoxes
$sql .= " AND f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY f.datef DESC, f.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY f.datef DESC, f.ref DESC ";
else $sql .= " ORDER BY f.tms DESC, f.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@@ -112,10 +112,10 @@ class box_graph_invoices_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);

View File

@@ -109,13 +109,14 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);
if (empty($year)) $year = $nowarray['year'];
if (empty($endyear)) $endyear = $nowarray['year'];
$startyear = $endyear - 1;
$mode = 'supplier';

View File

@@ -112,10 +112,10 @@ class box_graph_orders_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);

View File

@@ -111,10 +111,10 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);

View File

@@ -95,11 +95,11 @@ class box_graph_product_distribution extends ModeleBoxes
$showpropalnb = GETPOST($param_showpropalnb, 'alpha');
$showordernb = GETPOST($param_showordernb, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$year = $tmparray['year'];
$showinvoicenb = $tmparray['showinvoicenb'];
$showpropalnb = $tmparray['showpropalnb'];
$showordernb = $tmparray['showordernb'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$year = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$showinvoicenb = (!empty($tmparray['showinvoicenb']) ? $tmparray['showinvoicenb'] : '');
$showpropalnb = (!empty($tmparray['showpropalnb']) ? $tmparray['showpropalnb'] : '');
$showordernb = (!empty($tmparray['showordernb']) ? $tmparray['showordernb'] : '');
}
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb = 1; $showinvoicenb = 1; $showordernb = 1; }
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb = 0;

View File

@@ -112,10 +112,10 @@ class box_graph_propales_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);
@@ -176,8 +176,10 @@ class box_graph_propales_permonth extends ModeleBoxes
//$datatype2 = array('lines','bars');
$filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsamountinyear-'.$endyear.'.png';
if (!empty($mode)) {
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsamountinyear-'.$endyear.'.png';
}
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();

View File

@@ -64,7 +64,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$this->db = $db;
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
$tmpentry = array('enabled'=>((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && !empty($conf->stock->enabled)), 'perms'=>($user->rights->stock->lire), 'module'=>'product|service|stock');
$tmpentry = array('enabled'=>((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && !empty($conf->stock->enabled)), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock');
$showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden = ($showmode != 1);
}

View File

@@ -81,7 +81,7 @@ class box_propales extends ModeleBoxes
$propalstatic = new Propal($this->db);
$societestatic = new Societe($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."Propals", $max));
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."Propals", $max));
if ($user->rights->propale->lire)
{
@@ -96,7 +96,7 @@ class box_propales extends ModeleBoxes
$sql .= " AND p.entity IN (".getEntity('propal').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY p.datep DESC, p.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY p.datep DESC, p.ref DESC ";
else $sql .= " ORDER BY p.tms DESC, p.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@@ -105,6 +105,7 @@ class box_shipments extends ModeleBoxes
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
$sql .= " WHERE e.entity IN (".getEntity('expedition').")";
if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1";
if ($user->socid > 0) $sql.= " AND s.rowid = ".$user->socid;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id;
else $sql .= " ORDER BY e.date_delivery, e.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@@ -79,7 +79,7 @@ class box_supplier_orders extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$thirdpartystatic = new Fournisseur($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."SupplierOrders", $max));
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierOrders", $max));
if ($user->rights->fournisseur->commande->lire)
{
@@ -98,7 +98,7 @@ class box_supplier_orders extends ModeleBoxes
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql .= " ORDER BY c.tms DESC, c.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@@ -99,7 +99,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC";
else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC";
$sql .= $this->db->plimit($max, 0);

View File

@@ -601,7 +601,7 @@ abstract class CommonObject
if (empty($lastname)) $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : '')))));
$ret = '';
if ($option && $this->civility_code)
if (!empty($option) && !empty($this->civility_code))
{
if ($langs->transnoentitiesnoconv("Civility".$this->civility_code) != "Civility".$this->civility_code) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_code).' ';
else $ret .= $this->civility_code.' ';
@@ -720,7 +720,7 @@ abstract class CommonObject
$out = '';
$outdone = 0;
$coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
$coords = $this->getFullAddress(1, ', ', (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) ? $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT : 0));
if ($coords)
{
if (!empty($conf->use_javascript_ajax))
@@ -1407,7 +1407,7 @@ abstract class CommonObject
} elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') {
$modulename = 'fournisseur';
}
if ($conf->{$modulename}->enabled) {
if (!empty($conf->{$modulename}->enabled)) {
$libelle_element = $langs->trans('ContactDefault_'.$obj->element);
$transkey = "TypeContact_".$obj->element."_".$source."_".$obj->code;
$libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle);
@@ -3257,14 +3257,18 @@ abstract class CommonObject
*
* @param string $origin Linked element type
* @param int $origin_id Linked element id
* @param User $f_user User that create
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <=0 if KO, >0 if OK
* @see fetchObjectLinked(), updateObjectLinked(), deleteObjectLinked()
*/
public function add_object_linked($origin = null, $origin_id = null)
public function add_object_linked($origin = null, $origin_id = null, $f_user = null, $notrigger = 0)
{
// phpcs:enable
global $user;
$origin = (!empty($origin) ? $origin : $this->origin);
$origin_id = (!empty($origin_id) ? $origin_id : $this->origin_id);
$f_user = isset($f_user) ? $f_user : $user;
// Special case
if ($origin == 'order') $origin = 'commande';
@@ -3272,26 +3276,41 @@ abstract class CommonObject
if ($origin == 'invoice_template') $origin = 'facturerec';
if ($origin == 'supplierorder') $origin = 'order_supplier';
$this->db->begin();
$error = 0;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "element_element (";
$sql .= "fk_source";
$sql .= ", sourcetype";
$sql .= ", fk_target";
$sql .= ", targettype";
$sql .= ") VALUES (";
$sql .= $origin_id;
$sql .= ", '".$this->db->escape($origin)."'";
$sql .= ", ".$this->id;
$sql .= ", '".$this->db->escape($this->element)."'";
$sql .= ", '" . $this->db->escape($origin) . "'";
$sql .= ", " . $this->id;
$sql .= ", '" . $this->db->escape($this->element) . "'";
$sql .= ")";
dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
if ($this->db->query($sql))
{
dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
if ($this->db->query($sql)) {
if (!$notrigger) {
// Call trigger
$this->context['link_origin'] = $origin;
$this->context['link_origin_id'] = $origin_id;
$result = $this->call_trigger('OBJECT_LINK_INSERT', $f_user);
if ($result < 0) {
$error++;
}
// End call triggers
}
} else {
$this->error = $this->db->lasterror();
$error++;
}
if (!$error) {
$this->db->commit();
return 1;
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return 0;
}
@@ -3502,38 +3521,61 @@ abstract class CommonObject
* @param string $sourcetype Object source type
* @param int $targetid Object target id
* @param string $targettype Object target type
* @param User $f_user User that create
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int >0 if OK, <0 if KO
* @see add_object_linked(), fetObjectLinked(), deleteObjectLinked()
*/
public function updateObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '')
public function updateObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $f_user = null, $notrigger = 0)
{
global $user;
$updatesource = false;
$updatetarget = false;
$f_user = isset($f_user) ? $f_user : $user;
if (!empty($sourceid) && !empty($sourcetype) && empty($targetid) && empty($targettype)) $updatesource = true;
elseif (empty($sourceid) && empty($sourcetype) && !empty($targetid) && !empty($targettype)) $updatetarget = true;
$sql = "UPDATE ".MAIN_DB_PREFIX."element_element SET ";
if ($updatesource)
{
$sql .= "fk_source = ".$sourceid;
$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
$sql .= " WHERE fk_target = ".$this->id;
$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
} elseif ($updatetarget)
{
$sql .= "fk_target = ".$targetid;
$sql .= ", targettype = '".$this->db->escape($targettype)."'";
$sql .= " WHERE fk_source = ".$this->id;
$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
$this->db->begin();
$error = 0;
$sql = "UPDATE " . MAIN_DB_PREFIX . "element_element SET ";
if ($updatesource) {
$sql .= "fk_source = " . $sourceid;
$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
$sql .= " WHERE fk_target = " . $this->id;
$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
} elseif ($updatetarget) {
$sql .= "fk_target = " . $targetid;
$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
$sql .= " WHERE fk_source = " . $this->id;
$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
}
dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
if ($this->db->query($sql))
{
return 1;
dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
if ($this->db->query($sql)) {
if (!$notrigger) {
// Call trigger
$this->context['link_source_id'] = $sourceid;
$this->context['link_source_type'] = $sourcetype;
$this->context['link_target_id'] = $targetid;
$this->context['link_target_type'] = $targettype;
$result = $this->call_trigger('OBJECT_LINK_UPDATE', $f_user);
if ($result < 0) {
$error++;
}
// End call triggers
}
} else {
$this->error = $this->db->lasterror();
$error++;
}
if (!$error) {
$this->db->commit();
return 1;
} else {
$this->db->rollback();
return -1;
}
}
@@ -3546,13 +3588,17 @@ abstract class CommonObject
* @param int $targetid Object target id
* @param string $targettype Object target type
* @param int $rowid Row id of line to delete. If defined, other parameters are not used.
* @param User $f_user User that create
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int >0 if OK, <0 if KO
* @see add_object_linked(), updateObjectLinked(), fetchObjectLinked()
*/
public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '')
public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '', $f_user = null, $notrigger = 0)
{
global $user;
$deletesource = false;
$deletetarget = false;
$f_user = isset($f_user) ? $f_user : $user;
if (!empty($sourceid) && !empty($sourcetype) && empty($targetid) && empty($targettype)) $deletesource = true;
elseif (empty($sourceid) && empty($sourcetype) && !empty($targetid) && !empty($targettype)) $deletetarget = true;
@@ -3561,36 +3607,56 @@ abstract class CommonObject
$sourcetype = (!empty($sourcetype) ? $sourcetype : $this->element);
$targetid = (!empty($targetid) ? $targetid : $this->id);
$targettype = (!empty($targettype) ? $targettype : $this->element);
$this->db->begin();
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
$sql .= " WHERE";
if ($rowid > 0)
{
$sql .= " rowid = ".$rowid;
} else {
if ($deletesource)
{
$sql .= " fk_source = ".$sourceid." AND sourcetype = '".$this->db->escape($sourcetype)."'";
$sql .= " AND fk_target = ".$this->id." AND targettype = '".$this->db->escape($this->element)."'";
} elseif ($deletetarget)
{
$sql .= " fk_target = ".$targetid." AND targettype = '".$this->db->escape($targettype)."'";
$sql .= " AND fk_source = ".$this->id." AND sourcetype = '".$this->db->escape($this->element)."'";
if (!$notrigger) {
// Call trigger
$this->context['link_id'] = $rowid;
$this->context['link_source_id'] = $sourceid;
$this->context['link_source_type'] = $sourcetype;
$this->context['link_target_id'] = $targetid;
$this->context['link_target_type'] = $targettype;
$result = $this->call_trigger('OBJECT_LINK_DELETE', $f_user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "element_element";
$sql .= " WHERE";
if ($rowid > 0) {
$sql .= " rowid = " . $rowid;
} else {
$sql .= " (fk_source = ".$this->id." AND sourcetype = '".$this->db->escape($this->element)."')";
$sql .= " OR";
$sql .= " (fk_target = ".$this->id." AND targettype = '".$this->db->escape($this->element)."')";
if ($deletesource) {
$sql .= " fk_source = " . $sourceid . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
$sql .= " AND fk_target = " . $this->id . " AND targettype = '" . $this->db->escape($this->element) . "'";
} elseif ($deletetarget) {
$sql .= " fk_target = " . $targetid . " AND targettype = '" . $this->db->escape($targettype) . "'";
$sql .= " AND fk_source = " . $this->id . " AND sourcetype = '" . $this->db->escape($this->element) . "'";
} else {
$sql .= " (fk_source = " . $this->id . " AND sourcetype = '" . $this->db->escape($this->element) . "')";
$sql .= " OR";
$sql .= " (fk_target = " . $this->id . " AND targettype = '" . $this->db->escape($this->element) . "')";
}
}
dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
$error++;
}
}
dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
if ($this->db->query($sql))
{
if (!$error) {
$this->db->commit();
return 1;
} else {
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
$this->db->rollback();
return 0;
}
}
@@ -6846,7 +6912,7 @@ abstract class CommonObject
$value = $getposttemp;
}
} else {
$value = $this->array_options["options_".$key]; // No GET, no POST, no default value, so we take value of object.
$value = (!empty($this->array_options["options_".$key]) ? $this->array_options["options_".$key] : ''); // No GET, no POST, no default value, so we take value of object.
}
//var_dump($keyprefix.' - '.$key.' - '.$keysuffix.' - '.$keyprefix.'options_'.$key.$keysuffix.' - '.$this->array_options["options_".$key.$keysuffix].' - '.$getposttemp.' - '.$value);
break;

View File

@@ -697,6 +697,12 @@ class Conf
if (!empty($this->global->MAIN_TZUSERINPUTKEY)) $this->tzuserinputkey = $this->global->MAIN_TZUSERINPUTKEY; // 'tzserver' or 'tzuserrel'
if (!empty($this->global->PRODUIT_AUTOFILL_DESC)) {
$this->global->MAIN_NO_CONCAT_DESCRIPTION = 1;
} else {
unset($this->global->MAIN_NO_CONCAT_DESCRIPTION);
}
// For backward compatibility
if (isset($this->product)) $this->produit = $this->product;
if (isset($this->facture)) $this->invoice = $this->facture;

View File

@@ -964,7 +964,7 @@ class DolGraph
$array_of_ykeys = array_keys($valarray);
$alabelexists = 1;
$tmpykey = explode('_', ($array_of_ykeys[$i + ($alabelexists ? 1 : 0)]), 3);
if (!empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array
if (isset($tmpykey[2]) && (!empty($tmpykey[2]) || $tmpykey[2] == '0')) { // This is a 'Group by' array
$tmpvalue = (array_key_exists('y_' . $tmpykey[1] . '_' . $tmpykey[2], $valarray) ? $valarray['y_' . $tmpykey[1] . '_' . $tmpykey[2]] : $valarray[$i + 1]);
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
$arrayofgroupslegend[$i] = array(
@@ -1203,7 +1203,7 @@ class DolGraph
$foundnegativecolor = 0;
$usecolorvariantforgroupby = 0;
// We used a 'group by' and we have too many colors so we generated color variants per
if (is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by.
if (!empty($arrayofgroupslegend) && is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by.
$nbofcolorneeds = count($arrayofgroupslegend);
$nbofcolorsavailable = count($theme_datacolor);
if ($nbofcolorneeds > $nbofcolorsavailable) {
@@ -1278,7 +1278,7 @@ class DolGraph
$this->stringtoshow .= '{';
$this->stringtoshow .= 'dolibarrinfo: \'y_' . $i . '\', ';
$this->stringtoshow .= 'label: \'' . dol_escape_js(dol_string_nohtmltag($textoflegend)) . '\', ';
$this->stringtoshow .= 'pointStyle: \'' . ($this->type[$i] == 'linesnopoint' ? 'line' : 'circle') . '\', ';
$this->stringtoshow .= 'pointStyle: \'' . ((!empty($this->type[$i]) && $this->type[$i] == 'linesnopoint') ? 'line' : 'circle') . '\', ';
$this->stringtoshow .= 'fill: ' . ($type == 'bar' ? 'true' : 'false') . ', ';
if ($isfunnel) {
$this->stringtoshow .= 'borderWidth: \'2\', ';
@@ -1287,7 +1287,7 @@ class DolGraph
}
$this->stringtoshow .= 'borderColor: \'' . $bordercolor . '\', ';
$this->stringtoshow .= 'backgroundColor: \'' . $color . '\', ';
if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', ';
if (!empty($arrayofgroupslegend) && !empty($arrayofgroupslegend[$i])) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', ';
$this->stringtoshow .='data: [';
if ($isfunnel) {
$this->stringtoshow .= '['.-$serie[$i].','.$serie[$i].']';

View File

@@ -1097,7 +1097,12 @@ class ExtraFields
foreach ($param['options'] as $key => $val)
{
if ((string) $key == '') continue;
list($val, $parent) = explode('|', $val);
$valarray = explode('|', $val);
$val = $valarray[0];
$parent = '';
if (!empty($valarray[1])) {
$parent = $valarray[1];
}
$out .= '<option value="'.$key.'"';
$out .= (((string) $value == (string) $key) ? ' selected' : '');
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
@@ -2063,7 +2068,7 @@ class ExtraFields
{
global $_POST;
if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label']))
if (is_string($extrafieldsobjectkey) && !empty($this->attributes[$extrafieldsobjectkey]['label']) && is_array($this->attributes[$extrafieldsobjectkey]['label']))
{
$extralabels = $this->attributes[$extrafieldsobjectkey]['label'];
} else {

View File

@@ -2182,7 +2182,9 @@ class Form
if (!empty($conf->global->MAIN_MULTILANGS))
{
$sql .= ", pl.label as label_translated";
$sql .= ", pl.description as description_translated";
$selectFields .= ", label_translated";
$selectFields .= ", description_translated";
}
// Price by quantity
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
@@ -2222,7 +2224,18 @@ class Form
// Multilang : we add translation
if (!empty($conf->global->MAIN_MULTILANGS))
{
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang='".$this->db->escape($langs->getDefaultLang())."'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid ";
if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && !empty($socid)) {
$soc = new Societe($db);
$result = $soc->fetch($socid);
if ($result > 0 && !empty($soc->default_lang)) {
$sql .= " AND pl.lang='" . $this->db->escape($soc->default_lang) . "'";
} else {
$sql .= " AND pl.lang='".$this->db->escape($langs->getDefaultLang())."'";
}
} else {
$sql .= " AND pl.lang='".$this->db->escape($langs->getDefaultLang())."'";
}
}
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
@@ -2435,7 +2448,9 @@ class Form
$outval = '';
$outref = '';
$outlabel = '';
$outlabel_translated = '';
$outdesc = '';
$outdesc_translated = '';
$outbarcode = '';
$outorigin = '';
$outtype = '';
@@ -2456,6 +2471,11 @@ class Form
$outref = $objp->ref;
$outlabel = $objp->label;
$outdesc = $objp->description;
if (!empty($conf->global->MAIN_MULTILANGS))
{
$outlabel_translated = $objp->label_translated;
$outdesc_translated = $objp->description_translated;
}
$outbarcode = $objp->barcode;
$outorigin = $objp->fk_country;
$outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid;
@@ -2517,6 +2537,10 @@ class Form
elseif ($objp->stock <= 0) $opt .= ' class="product_line_stock_too_low"';
}
}
if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$opt .= ' data-labeltrans="'.$outlabel_translated.'"';
$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';
}
$opt .= '>';
$opt .= $objp->ref;
if ($outbarcode) $opt .= ' ('.$outbarcode.')';
@@ -2687,7 +2711,24 @@ class Form
}
$opt .= "</option>\n";
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'pbq'=>$outpbq);
$optJson = array(
'key'=>$outkey,
'value'=>$outref,
'label'=>$outval,
'label2'=>$outlabel,
'desc'=>$outdesc,
'type'=>$outtype,
'price_ht'=>price2num($outprice_ht),
'price_ttc'=>price2num($outprice_ttc),
'pricebasetype'=>$outpricebasetype,
'tva_tx'=>$outtva_tx, 'qty'=>$outqty,
'discount'=>$outdiscount,
'duration_value'=>$outdurationvalue,
'duration_unit'=>$outdurationunit,
'pbq'=>$outpbq,
'labeltrans'=>$outlabel_translated,
'desctrans'=>$outdesc_translated
);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -2770,6 +2811,12 @@ class Form
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
$sql .= " pfp.supplier_reputation";
// if we use supplier description of the products
if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) {
$sql .= " ,pfp.desc_fourn as description";
} else {
$sql .= " ,p.description";
}
// Units
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units";
@@ -2799,7 +2846,11 @@ class Form
foreach ($scrit as $crit)
{
if ($i > 0) $sql .= " AND ";
$sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%')";
$sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) {
$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
}
$sql .= ")";
$i++;
}
if (count($scrit) > 1) $sql .= ")";
@@ -3028,8 +3079,9 @@ class Form
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt .= ' disabled';
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0)
{
$opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqup="'.$objp->unitprice.'" data-pbqpercent="'.$objp->remise_percent.'"';
$opt .= ' data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'"';
}
$opt .= ' data-description="'.dol_escape_htmltag($objp->description).'"';
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
$opt .= '>';
@@ -3043,7 +3095,20 @@ class Form
// "key" value of json key array is used by jQuery automatically as selected value
// "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $opt;
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'up'=>$objp->unitprice, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
array_push($outarray,
array('key'=>$outkey,
'value'=>$outref,
'label'=>$outval,
'qty'=>$outqty,
'up'=>$objp->unitprice,
'discount'=>$outdiscount,
'type'=>$outtype,
'duration_value'=>$outdurationvalue,
'duration_unit'=>$outdurationunit,
'disabled'=>(empty($objp->idprodfournprice) ?true:false),
'description'=>$objp->description
)
);
// Exemple of var_dump $outarray
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"
@@ -3749,9 +3814,10 @@ class Form
* @param string $filtre To filter list
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib To add more attribute on select
* @param int $noinfoadmin 0=Add admin info, 1=Disable admin info
* @return void
*/
public function selectShippingMethod($selected = '', $htmlname = 'shipping_method_id', $filtre = '', $useempty = 0, $moreattrib = '')
public function selectShippingMethod($selected = '', $htmlname = 'shipping_method_id', $filtre = '', $useempty = 0, $moreattrib = '', $noinfoadmin = 0)
{
global $langs, $conf, $user;
@@ -3786,7 +3852,7 @@ class Form
$i++;
}
print "</select>";
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
if ($user->admin && empty($noinfoadmin)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ajax_combobox('select'.$htmlname);
} else {
@@ -3890,9 +3956,10 @@ class Form
* @param string $selected Preselected Unit ID
* @param string $htmlname Select name
* @param int $showempty Add a nempty line
* @param string $unit_type Restrict to one given unit type
* @return string HTML select
*/
public function selectUnits($selected = '', $htmlname = 'units', $showempty = 0)
public function selectUnits($selected = '', $htmlname = 'units', $showempty = 0, $unit_type = '')
{
global $langs;
@@ -3902,6 +3969,9 @@ class Form
$sql = 'SELECT rowid, label, code from '.MAIN_DB_PREFIX.'c_units';
$sql .= ' WHERE active > 0';
if (!empty($unit_type)) {
$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
}
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0)

View File

@@ -202,7 +202,8 @@ class FormActions
$newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
{
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.($object->socid > 0 ? '&amp;socid='.$object->socid : ($socid > 0 ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage));
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&amp;socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage);
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
}
@@ -244,7 +245,7 @@ class FormActions
print '<td class="nowraponall tdoverflowmax125">';
if (!empty($actioncomm->userownerid))
{
if (is_object($cacheusers[$actioncomm->userownerid]))
if (isset($cacheusers[$actioncomm->userownerid]) && is_object($cacheusers[$actioncomm->userownerid]))
{
$tmpuser = $cacheusers[$actioncomm->userownerid];
} else {

View File

@@ -135,15 +135,39 @@ class FormFile
$max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) $maxphp = $maxphp * 1;
if (preg_match('/m$/i', $maxphp)) $maxphp = $maxphp * 1024;
if (preg_match('/g$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024;
if (preg_match('/t$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024 * 1024;
if (preg_match('/k$/i', $maxphp)) {
$maxphp = preg_replace('/k$/i', '', $maxphp);
$maxphp = $maxphp * 1;
}
if (preg_match('/m$/i', $maxphp)) {
$maxphp = preg_replace('/m$/i', '', $maxphp);
$maxphp = $maxphp * 1024;
}
if (preg_match('/g$/i', $maxphp)) {
$maxphp = preg_replace('/g$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp)) {
$maxphp = preg_replace('/t$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024 * 1024;
}
$maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1;
if (preg_match('/m$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024;
if (preg_match('/g$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024;
if (preg_match('/t$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = preg_replace('/k$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1;
}
if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024;
}
if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
}
// Now $max and $maxphp and $maxphp2 are in Kb
$maxmin = $max;
$maxphptoshow = $maxphptoshowparam = '';
@@ -1049,8 +1073,8 @@ class FormFile
if (empty($relativepath))
{
$relativepath = (!empty($object->ref) ?dol_sanitizeFileName($object->ref) : '').'/';
if ($object->element == 'invoice_supplier') $relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath
if ($object->element == 'project_task') $relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.';
if (!empty($object->element) && $object->element == 'invoice_supplier') $relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath
if (!empty($object->element) && $object->element == 'project_task') $relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.';
}
// For backward compatiblity, we detect file stored into an old path
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $filearray[0]['level1name'] == 'photos')

View File

@@ -106,7 +106,8 @@ class InfoBox
if (is_object($user)) $sql .= " AND b.fk_user IN (0,".$user->id.")";
else $sql .= " AND b.fk_user = 0";
$sql .= " ORDER BY b.box_order";
} else // available
}
else // available
{
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
@@ -150,7 +151,7 @@ class InfoBox
// box properties
$box->rowid = (empty($obj->rowid) ? '' : $obj->rowid);
$box->id = (empty($obj->box_id) ? '' : $obj->box_id);
$box->position = ($obj->position == '' ? '' : $obj->position); // '0' must stay '0'
$box->position = ((isset($obj->position) && $obj->position == '') ? '' : (isset($obj->position) ? $obj->position : '')); // '0' must stay '0'
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
$box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user);
$box->sourcefile = $relsourcefile;

View File

@@ -81,7 +81,8 @@ class Notify
'EXPENSE_REPORT_VALIDATE',
'EXPENSE_REPORT_APPROVE',
'HOLIDAY_VALIDATE',
'HOLIDAY_APPROVE'
'HOLIDAY_APPROVE',
'ACTION_CREATE'
);
@@ -530,12 +531,18 @@ class Notify
$object_type = 'holiday';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayValidated", $link);
break;
case 'HOLIDAY_APPROVE':
$link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->holiday->dir_output;
$object_type = 'holiday';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
break;
case 'HOLIDAY_APPROVE':
$link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->holiday->dir_output;
$object_type = 'holiday';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
break;
case 'ACTION_CREATE':
$link = '<a href="'.$urlwithroot.'/comm/action/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->agenda->dir_output;
$object_type = 'action';
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextActionAdded", $link);
break;
}
$ref = dol_sanitizeFileName($newref);
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
@@ -749,6 +756,12 @@ class Notify
$object_type = 'holiday';
$mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
break;
case 'ACTION_CREATE':
$link = '<a href="'.$urlwithroot.'/comm/action/card.php?id='.$object->id.'">'.$newref.'</a>';
$dir_output = $conf->agenda->dir_output;
$object_type = 'action';
$mesg = $langs->transnoentitiesnoconv("EMailTextActionAdded", $link);
break;
}
$ref = dol_sanitizeFileName($newref);
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf";

View File

@@ -731,7 +731,7 @@ class Translate
*/
public function transcountry($str, $countrycode)
{
if ($this->tab_translate["$str$countrycode"]) return $this->trans("$str$countrycode");
if (!empty($this->tab_translate["$str$countrycode"])) return $this->trans("$str$countrycode");
else return $this->trans($str);
}

View File

@@ -135,7 +135,11 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
}
return { label: label, value: item.value, id: item.key, disabled: item.disabled,
update: update, textarea: textarea,
pbq: item.pbq, type: item.type, qty: item.qty, discount: item.discount, pricebasetype: item.pricebasetype, price_ht: item.price_ht, price_ttc: item.price_ttc }
pbq: item.pbq,
type: item.type, qty: item.qty, discount: item.discount,
pricebasetype: item.pricebasetype, price_ht: item.price_ht,
price_ttc: item.price_ttc,
up: item.up, description : item.description}
}));
}
else console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array.");
@@ -148,13 +152,33 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
//console.log(ui.item);
$("#'.$htmlname.'").attr("data-pbq", ui.item.pbq);
$("#'.$htmlname.'").attr("data-pbqup", ui.item.price_ht);
$("#'.$htmlname.'").attr("data-pbqbase", ui.item.pricebasetype);
$("#'.$htmlname.'").attr("data-pbqqty", ui.item.qty);
$("#'.$htmlname.'").attr("data-pbqpercent", ui.item.discount);
//For supplier price
$("#'.$htmlname.'").attr("data-up", ui.item.up);
$("#'.$htmlname.'").attr("data-discount", ui.item.discount);
$("#'.$htmlname.'").attr("data-qty", ui.item.qty);
$("#'.$htmlname.'").attr("data-description", ui.item.description);
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
//For customer price
';
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
$script .= '
$("#' . $htmlname . '").attr("data-pbq", ui.item.pbq);
$("#' . $htmlname . '").attr("data-pbqup", ui.item.price_ht);
$("#' . $htmlname . '").attr("data-pbqbase", ui.item.pricebasetype);
$("#' . $htmlname . '").attr("data-pbqqty", ui.item.qty);
$("#' . $htmlname . '").attr("data-pbqpercent", ui.item.discount);
';
} else {
$script .= '
$("#' . $htmlname . '").attr("data-up", ui.item.price_ht);
$("#' . $htmlname . '").attr("data-base", ui.item.pricebasetype);
$("#' . $htmlname . '").attr("data-qty", ui.item.qty);
$("#' . $htmlname . '").attr("data-discount", ui.item.discount);
';
}
$script .= '
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
// Disable an element
if (options.option_disabled) {
console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled)

View File

@@ -302,7 +302,7 @@ function societe_prepare_head(Societe $object)
}
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
$head[$h][1] .= $langs->trans("Events");
$head[$h][1] = $langs->trans("Events");
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
@@ -862,7 +862,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
// Definition of fields for list
$arrayfields = array(
't.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'position'=>1),
't.rowid'=>array('label'=>"TechnicalID", 'checked'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'position'=>1),
't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10),
't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20),
't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30),
@@ -870,7 +870,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>50, 'class'=>'center'),
);
// Extra fields
if (is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) {
if (!empty($extrafields->attributes[$contactstatic->table_element]['label']) && is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) {
foreach ($extrafields->attributes[$contactstatic->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$contactstatic->table_element]['list'][$key])) {
$arrayfields["ef.".$key] = array(
@@ -989,7 +989,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
} elseif (in_array($key, array('role'))) {
print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles);
} else {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.(!empty($search[$key]) ? dol_escape_htmltag($search[$key]) : '').'">';
}
print '</td>';
}
@@ -1204,14 +1204,17 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
{
global $user, $conf;
global $form;
global $param, $massactionbutton;
$start_year = GETPOST('dateevent_startyear');
$start_month = GETPOST('dateevent_startmonth');
$start_day = GETPOST('dateevent_startday');
$end_year = GETPOST('dateevent_endyear');
$end_month = GETPOST('dateevent_endmonth');
$end_day = GETPOST('dateevent_endday');
$tms_start = '';
$tms_end = '';
if (!empty($start_year) && !empty($start_month) && !empty($start_day)) {
$search_start = $start_year.'-'.$start_month.'-'.$start_day;
$tms_start = strtotime($search_start);
@@ -1391,7 +1394,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone = 'todo';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && (!empty($obj->datep) && $obj->datep > $now))) $tododone = 'todo';
$histo[$numaction] = array(
'type'=>$obj->type,

View File

@@ -680,7 +680,8 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
if (!is_array($out)) {
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = str_replace(array('&quot;', '"', '../'), '', trim($out));
$out = str_replace(array('&quot;', '"'), "''", trim($out));
$out = str_replace(array('../'), '', $out);
// keep lines feed
$out = dol_string_nohtmltag($out, 0);
}

View File

@@ -163,7 +163,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
print '<ul'.(empty($pere['rowid']) ? ' id="treeData"' : '').'>'; $ulprinted++;
}
print "\n".'<li '.($tab[$x]['statut'] ? ' class="liuseractive"' : 'class="liuserdisabled"').'>';
print "\n".'<li '.(!empty($tab[$x]['statut']) ? ' class="liuseractive"' : 'class="liuserdisabled"').'>';
if ($showfk)
{
print '<table class="nobordernopadding centpercent"><tr><td>';
@@ -194,7 +194,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
print '<ul'.(empty($pere['rowid']) ? ' id="treeData"' : '').'>'; $ulprinted++;
}
print "\n".'<li '.($tab[$x]['statut'] ? ' class="liuseractive"' : 'class="liuserdisabled"').'>';
print "\n".'<li '.(!empty($tab[$x]['statut']) ? ' class="liuseractive"' : 'class="liuserdisabled"').'>';
if ($showfk)
{
print '<table class="nobordernopadding centpercent"><tr><td>';

View File

@@ -498,7 +498,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td colspan="'.($colspan - 1).'">';
//var_dump($conf->global->THEME_ELDY_BACKBODY);
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKBODY) ? $conf->global->THEME_ELDY_BACKBODY : ''), array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -539,7 +539,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $conf->global->THEME_ELDY_TOPMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -580,7 +580,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $conf->global->THEME_ELDY_VERMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -601,7 +601,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("TextTitleColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $conf->global->THEME_ELDY_TEXTTITLENOTAB : ''), array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
}
@@ -621,7 +621,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKTITLE1) ? $conf->global->THEME_ELDY_BACKTITLE1 : ''), array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
}
@@ -641,7 +641,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLE) ? $conf->global->THEME_ELDY_TEXTTITLE : ''), array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
}
@@ -661,7 +661,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableTitleTextlinkColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLELINK) ? $conf->global->THEME_ELDY_TEXTTITLELINK : ''), array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default"));
}
@@ -682,7 +682,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -703,7 +703,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEPAIR1) ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -744,7 +744,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("LinkColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTLINK) ? $conf->global->THEME_ELDY_TEXTLINK : ''), array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -781,12 +781,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit) {
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
if (!empty($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover').' ';
} else {
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
if ($color) {
if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");
@@ -818,12 +818,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit) {
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
if (!empty($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked').' ';
} else {
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
if ($color) {
if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");

View File

@@ -206,9 +206,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
$menu_arr[] = array(
'name' => 'Projet',
'link' => '/projet/index.php?mainmenu=project&amp;leftmenu=',
'title' => (empty($conf->global->PROJECT_USE_OPPORTUNITIES) || $conf->global->PROJECT_USE_OPPORTUNITIES == 2)
? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2) ? "Leads" : "Projects")
: "Projects",
'title' => (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2 ? "Leads" : "Projects"),
'level' => 0,
'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
'target' => $atarget,
@@ -743,11 +741,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1);
$warnpicto = '';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
if (!empty($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningPHPMailD"));
}
if (in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) {
if (!empty($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete"));
}
@@ -805,8 +803,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
$newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
}
}
}

View File

@@ -622,6 +622,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$content='';
$pathoffile = $this->getDescLongReadmeFound();
if ($pathoffile) // Mostly for external modules

View File

@@ -365,14 +365,15 @@ class pdf_rouget extends ModelePdfExpedition
$tab_top_alt = $tab_top;
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
//$tab_top_alt += 1;
// Tracking number
if (!empty($object->tracking_number))
{
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
$object->getUrlTrackingStatus($object->tracking_number);
if (!empty($object->tracking_url))
{

View File

@@ -254,7 +254,7 @@ class modStock extends DolibarrModules
$this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')';
// Export stock including batch number
if ($conf->productbatch->enabled)
if (!empty($conf->productbatch->enabled))
{
$langs->load("productbatch");
@@ -327,7 +327,7 @@ class modStock extends DolibarrModules
'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product",
'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product'
); // We define here only fields that use another icon that the one defined into export_icon
if ($conf->productbatch->enabled)
if (!empty($conf->productbatch->enabled))
{
$this->export_fields_array[$r]['sm.batch'] = 'Batch';
$this->export_TypeFields_array[$r]['sm.batch'] = 'Text';

View File

@@ -14,7 +14,7 @@ if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey =
// Loop to show all columns of extrafields for the search title line
if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
{
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
if (!empty($extrafields->attributes[$extrafieldsobjectkey]['label']) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
{
if (empty($extrafieldsobjectprefix)) $extrafieldsobjectprefix = 'ef.';
if (empty($search_options_pattern)) $search_options_pattern = 'search_options_';

View File

@@ -13,7 +13,7 @@ if (!isset($disablesortlink)) $disablesortlink = 0;
// Loop to show all columns of extrafields for the title line
if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
{
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
if (!empty($extrafields->attributes[$extrafieldsobjectkey]['label']) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
{
if (empty($extrafieldsobjectprefix)) $extrafieldsobjectprefix = 'ef.';

View File

@@ -87,7 +87,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
{
$value = (GETPOSTISSET("options_".$tmpkeyextra) ? GETPOST("options_".$tmpkeyextra) : $object->array_options["options_".$tmpkeyextra]);
} else {
$value = $object->array_options["options_".$tmpkeyextra];
$value = (!empty($object->array_options["options_".$tmpkeyextra]) ? $object->array_options["options_".$tmpkeyextra] : '');
//var_dump($tmpkeyextra.' - '.$value);
}
@@ -165,7 +165,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
$html_id = !empty($object->id) ? $object->element.'_extras_'.$tmpkeyextra.'_'.$object->id : '';
print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$tmpkeyextra.' wordbreak"'.($cols ? ' colspan="'.$cols.'"' : '').'>';
print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$tmpkeyextra.' wordbreak"'.(!empty($cols) ? ' colspan="'.$cols.'"' : '').'>';
// Convert date into timestamp format
if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date', 'datetime')))

View File

@@ -516,13 +516,13 @@ if (!empty($usemargins) && $user->rights->margins->creer)
<?php
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
$("input[name='np_marginRate']:first").blur(function(e) {
return checkFreeLine(e, "np_marginRate");
return checkFreeLine(e, "np_marginRate");
});
<?php
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) { ?>
$("input[name='np_markRate']:first").blur(function(e) {
return checkFreeLine(e, "np_markRate");
return checkFreeLine(e, "np_markRate");
});
<?php
}
@@ -537,21 +537,21 @@ if (!empty($usemargins) && $user->rights->margins->creer)
var rate = $("input[name='"+npRate+"']:first");
if (rate.val() == '')
return true;
return true;
if (! $.isNumeric(rate.val().replace(',','.')))
{
alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
if (npRate == "np_markRate" && rate.val() >= 100)
{
alert('<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
alert('<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
var price = 0;
@@ -604,39 +604,39 @@ if (!empty($usemargins) && $user->rights->margins->creer)
});
$("#prod_entry_mode_free").on( "click", function() {
setforfree();
setforfree();
});
$("#select_type").change(function()
{
setforfree();
setforfree();
if (jQuery('#select_type').val() >= 0)
{
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
jQuery('#dp_desc').focus();
/* focus if CKEDITOR */
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{
var editor = CKEDITOR.instances['dp_desc'];
if (editor) { editor.focus(); }
}
jQuery('#dp_desc').focus();
/* focus if CKEDITOR */
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{
var editor = CKEDITOR.instances['dp_desc'];
if (editor) { editor.focus(); }
}
}
console.log("Hide/show date according to product type");
if (jQuery('#select_type').val() == '0')
{
jQuery('#trlinefordates').hide();
jQuery('.divlinefordates').hide();
jQuery('#trlinefordates').hide();
jQuery('.divlinefordates').hide();
}
else
{
jQuery('#trlinefordates').show();
jQuery('.divlinefordates').show();
jQuery('#trlinefordates').show();
jQuery('.divlinefordates').show();
}
});
$("#prod_entry_mode_predef").on( "click", function() {
console.log("click prod_entry_mode_predef");
setforpredef();
jQuery('#trlinefordates').show();
console.log("click prod_entry_mode_predef");
setforpredef();
jQuery('#trlinefordates').show();
});
<?php
@@ -661,7 +661,6 @@ if (!empty($usemargins) && $user->rights->margins->creer)
?>
var pbq = parseInt($('option:selected', this).attr('data-pbq')); /* If product was selected with a HTML select */
if (isNaN(pbq)) { pbq = jQuery('#idprod').attr('data-pbq'); } /* If product was selected with a HTML input with autocomplete */
//console.log(pbq);
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
{
@@ -677,6 +676,32 @@ if (!empty($usemargins) && $user->rights->margins->creer)
function(data) {
console.log("Load unit price end, we got value "+data.price_ht);
jQuery("#price_ht").val(data.price_ht);
<?php
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { ?>
var proddesc = data.desc_trans;
<?php
} else { ?>
var proddesc = data.desc;
<?php
} ?>
console.log("Load desciption into text area : "+proddesc);
<?php
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{
var editor = CKEDITOR.instances['dp_desc'];
if (editor) {
editor.setData(proddesc);
}
}
<?php
} else { ?>
jQuery('#dp_desc').text(proddesc);
<?php
} ?>
<?php
} ?>
},
'json'
);
@@ -791,7 +816,10 @@ if (!empty($usemargins) && $user->rights->margins->creer)
}
?>
/* To process customer price per quantity (CUSTOMER_PRICE_PER_QTY works only if combo product is not an ajax after x key pressed) */
<?php
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
{?>
/* To process customer price per quantity (PRODUIT_CUSTOMER_PRICES_BY_QTY works only if combo product is not an ajax after x key pressed) */
var pbq = parseInt($('option:selected', this).attr('data-pbq')); // When select is done from HTML select
if (isNaN(pbq)) { pbq = jQuery('#idprod').attr('data-pbq'); } // When select is done from HTML input with autocomplete
var pbqup = parseFloat($('option:selected', this).attr('data-pbqup'));
@@ -803,7 +831,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent'));
if (isNaN(pbqpercent)) { pbqpercent = jQuery('#idprod').attr('data-pbqpercent'); }
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
if ((jQuery('#idprod').val() > 0) && ! isNaN(pbq) && pbq > 0)
{
var pbqupht = pbqup; /* TODO support of price per qty TTC not yet available */
@@ -818,12 +846,76 @@ if (!empty($usemargins) && $user->rights->margins->creer)
{
jQuery("#remise_percent").val(pbqpercent);
}
} else { jQuery("#pbq").val(''); }
<?php
}
else
?>
//Deal with supplier
if (jQuery('#idprodfournprice').val() >0)
{
jQuery("#pbq").val('');
var up = parseFloat($('option:selected', this).attr('data-up')); // When select is done from HTML select
if (isNaN(up)) { up = parseFloat(jQuery('#idprodfournprice').attr('data-up'));} // When select is done from HTML input with autocomplete
var qty = parseFloat($('option:selected', this).attr('data-qty'));
if (isNaN(qty)) { qty = parseFloat(jQuery('#idprodfournprice').attr('data-qty'));}
var discount = parseFloat($('option:selected', this).attr('data-discount'));
if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));}
console.log("We find supplier price :"+up+" qty: "+qty+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val());
jQuery("#price_ht").val(up);
if (jQuery("#qty").val() < qty)
{
jQuery("#qty").val(qty);
}
if (jQuery("#remise_percent").val() < discount)
{
jQuery("#remise_percent").val(discount);
}
<?php
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
?>
var description = $('option:selected', this).attr('data-description');
if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); }
console.log("Load desciption into text area : "+description);
<?php
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{
var editor = CKEDITOR.instances['dp_desc'];
if (editor) {
editor.setData(description);
}
}
<?php
} else { ?>
jQuery('#dp_desc').text(description);
<?php
}
}?>
} else if (jQuery('#idprodfournprice').length > 0) {
<?php
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{
var editor = CKEDITOR.instances['dp_desc'];
if (editor) {
editor.setData('');
}
}
<?php
} else { ?>
jQuery('#dp_desc').text('');
<?php
}
}?>
}
/* To set focus */
if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0)
{

View File

@@ -189,11 +189,21 @@ $coldisplay++;
</td>
<?php
if (!empty($conf->global->PRODUCT_USE_UNITS))
{
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$unit_type = false;
// limit unit select to unit type
if (!empty($line->fk_unit) && empty($conf->global->MAIN_EDIT_LINE_ALLOW_ALL_UNIT_TYPE)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
$cUnit = new CUnits($line->db);
if ($cUnit->fetch($line->fk_unit) > 0) {
if (!empty($cUnit->unit_type)) {
$unit_type = $cUnit->unit_type;
}
}
}
$coldisplay++;
print '<td class="left">';
print $form->selectUnits($line->fk_unit, "units");
print $form->selectUnits($line->fk_unit, "units", 0, $unit_type);
print '</td>';
}
?>

View File

@@ -119,8 +119,7 @@ if (($line->info_bits & 2) == 2) {
} else {
$format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE ? 'dayhour' : 'day';
if ($line->fk_product > 0)
{
if ($line->fk_product > 0) {
print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
} else {
$type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type);

View File

@@ -81,9 +81,9 @@ $(document).ready(function () {
<!-- Title with version -->
<div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
<?php
if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
if (!empty($disablenofollow)) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
echo dol_escape_htmltag($title);
if ($disablenofollow) echo '</a>';
if (!empty($disablenofollow)) echo '</a>';
?>
</div>
@@ -113,7 +113,7 @@ if ($disablenofollow) echo '</a>';
</div>
<?php
if ($captcha) {
if (!empty($captcha)) {
// Add a variable param to force not using cache (jmobile)
$php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time
if (preg_match('/\?/', $php_self)) $php_self .= '&time='.dol_print_date(dol_now(), 'dayhourlog');
@@ -200,7 +200,7 @@ if (!empty($morelogincontent)) {
<br>
<?php if ($message) { ?>
<?php if (!empty($message)) { ?>
<div class="center login_main_message">
<?php echo dol_htmloutput_mesg($message, '', '', 1); ?>
</div>

View File

@@ -46,7 +46,8 @@ class InterfaceNotification extends DolibarrTriggers
'EXPENSE_REPORT_VALIDATE',
'EXPENSE_REPORT_APPROVE',
'HOLIDAY_VALIDATE',
'HOLIDAY_APPROVE'
'HOLIDAY_APPROVE',
'ACTION_CREATE'
);
/**

View File

@@ -198,11 +198,21 @@ class InterfaceTicketEmail extends DolibarrTriggers
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) {
$sendto = '';
if (empty($user->socid) && empty($user->email)) {
$object->fetch_thirdparty();
$sendto = $object->thirdparty->email;
} else {
$sendto = $user->email;
//if contact selected send to email's contact else send to email's thirdparty
$contactid = GETPOST('contactid', 'alpha');
if (!empty($contactid)) {
$contact = new Contact($this->db);
$res = $contact->fetch($contactid);
}
if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
$sendto = $contact->email;
} elseif (!empty($object->fk_soc)) {
$object->fetch_thirdparty();
$sendto = $object->thirdparty->email;
}
if ($sendto) {