diff --git a/dev/initdata/mysqldump_dolibarr_3.6.0.sql b/dev/initdata/mysqldump_dolibarr_3.6.0.sql
index 77cbbcc511f..b1b8d77aa3c 100644
--- a/dev/initdata/mysqldump_dolibarr_3.6.0.sql
+++ b/dev/initdata/mysqldump_dolibarr_3.6.0.sql
@@ -4867,7 +4867,7 @@ CREATE TABLE `llx_opensurvey_sondage` (
`mailsonde` tinyint(4) NOT NULL DEFAULT '0',
`survey_link_visible` int(11) DEFAULT '1',
`origin` varchar(64) DEFAULT NULL,
- `tms` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id_sondage`),
KEY `idx_id_sondage_admin` (`id_sondage_admin`),
KEY `idx_date_fin` (`date_fin`)
diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php
index ac354d4d08d..ce7eb82f9a1 100644
--- a/htdocs/comm/list.php
+++ b/htdocs/comm/list.php
@@ -48,13 +48,12 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom";
-$search_nom=GETPOST("search_nom");
+$search_company=GETPOST("search_company");
$search_zipcode=GETPOST("search_zipcode");
$search_town=GETPOST("search_town");
$search_code=GETPOST("search_code");
$search_compta=GETPOST("search_compta");
$search_status = GETPOST("search_status",'int');
-if ($search_status=='') $search_status=1; // always display activ customer first
// Load sale and categ filters
$search_sale = GETPOST("search_sale");
@@ -78,21 +77,18 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x"))
{
- $search_categ='';
- $catid='';
- $search_sale='';
- $socname="";
- $search_nom="";
+ $search_sale="";
+ $search_categ="";
+ $catid="";
+ $search_company="";
$search_zipcode="";
$search_town="";
- $search_idprof1='';
- $search_idprof2='';
- $search_idprof3='';
- $search_idprof4='';
- $seach_status=1;
+ $search_code='';
+ $search_compta='';
+ $search_status='';
}
-
+if ($search_status=='') $search_status=1; // always display activ customer first
/*
* view
@@ -122,8 +118,8 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
-if ($search_nom) {
- $sql .= natural_search('s.nom', $search_nom);
+if ($search_company) {
+ $sql .= natural_search('s.nom', $search_company);
}
if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
if ($search_town) {
@@ -156,7 +152,7 @@ if ($result)
{
$num = $db->num_rows($result);
- $param = "&search_nom=".$search_nom."&search_code=".$search_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town;
+ $param = "&search_company=".$search_company."&search_code=".$search_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town;
if ($search_categ != '') $param.='&search_categ='.$search_categ;
if ($search_sale != '') $param.='&search_sale='.$search_sale;
if ($search_status != '') $param.='&search_status='.$search_status;
@@ -207,7 +203,7 @@ if ($result)
print '
';
print '| ';
- print '';
+ print '';
print ' | ';
print '';
@@ -235,7 +231,6 @@ if ($result)
print ' | ';
print '';
- print ' ';
print '';
print ' | ';
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 96d633bd834..66b36e0320f 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -56,6 +56,8 @@ $search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_author=GETPOST('search_author','alpha');
$search_town=GETPOST('search_town','alpha');
+$viewstatut=$db->escape(GETPOST('viewstatut'));
+$object_statut=$db->escape(GETPOST('propal_statut'));
$sall=GETPOST("sall");
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
@@ -78,6 +80,26 @@ if (! empty($socid))
}
$result = restrictedArea($user, $module, $objectid, $dbtable);
+if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both tests are required to be compatible with all browsers
+{
+ $search_categ='';
+ $search_user='';
+ $search_sale='';
+ $search_ref='';
+ $search_refcustomer='';
+ $search_societe='';
+ $search_montant_ht='';
+ $search_author='';
+ $search_town='';
+ $year='';
+ $month='';
+ $viewstatut='';
+ $object_statut='';
+}
+
+if($object_statut != '')
+$viewstatut=$object_statut;
+
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('propallist'));
@@ -93,21 +115,6 @@ $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
-// Do we click on purge search criteria ?
-if (GETPOST("button_removefilter_x"))
-{
- $search_categ='';
- $search_user='';
- $search_sale='';
- $search_ref='';
- $search_refcustomer='';
- $search_societe='';
- $search_montant_ht='';
- $search_author='';
- $search_town='';
- $year='';
- $month='';
-}
/*
@@ -132,11 +139,6 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-$viewstatut=$db->escape(GETPOST('viewstatut'));
-$object_statut = $db->escape(GETPOST('propal_statut'));
-if($object_statut != '')
-$viewstatut=$object_statut;
-
if (! $sortfield) $sortfield='p.datep';
if (! $sortorder) $sortorder='DESC';
$limit = $conf->liste_limit;
@@ -322,10 +324,12 @@ if ($result)
print '';
$formpropal->selectProposalStatus($viewstatut,1);
print ' | ';
+
print '';
- print '';
- print '';
+ print '';
+ print '';
print ' | ';
+
print "
\n";
$var=true;
@@ -391,7 +395,7 @@ if ($result)
// Date proposal
print '';
- print dol_print_date($db->jdate($obj->dp), 'day');
+ print dol_print_date($db->jdate($objp->dp), 'day');
print " | \n";
// Date end validity
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index f400925b059..ed308394e6c 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1000,7 +1000,12 @@ class Commande extends CommonOrder
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
- $this->lines[$i] = $line;
+ // get extrafields from original line
+ $object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
+ foreach($object->lines[$i]->array_options as $options_key => $value)
+ $line->array_options[$options_key] = $value;
+
+ $this->lines[$i] = $line;
}
$this->socid = $object->socid;
@@ -1021,6 +1026,11 @@ class Commande extends CommonOrder
$this->origin = $object->element;
$this->origin_id = $object->id;
+ // get extrafields from original line
+ $object->fetch_optionals($object->id);
+ foreach($object->array_options as $options_key => $value)
+ $this->array_options[$options_key] = $value;
+
// Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 7c8dc7c6c59..4331d80925f 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -735,6 +735,11 @@ class Facture extends CommonInvoice
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
$line->pa_ht = $marginInfos[0];
+ // get extrafields from original line
+ $object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
+ foreach($object->lines[$i]->array_options as $options_key => $value)
+ $line->array_options[$options_key] = $value;
+
$this->lines[$i] = $line;
}
@@ -754,6 +759,11 @@ class Facture extends CommonInvoice
$this->origin = $object->element;
$this->origin_id = $object->id;
+ // get extrafields from original line
+ $object->fetch_optionals($object->id);
+ foreach($object->array_options as $options_key => $value)
+ $this->array_options[$options_key] = $value;
+
// Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id;
if (! empty($object->other_linked_objects) && is_array($object->other_linked_objects))
diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php
index 320d86f3377..c762aac5702 100644
--- a/htdocs/compta/facture/impayees.php
+++ b/htdocs/compta/facture/impayees.php
@@ -429,7 +429,8 @@ if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_payme
if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
-$sql.= " GROUP BY s.nom, s.rowid, s.email, f.rowid, f.facnumber, f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type ";
+$sql.= " GROUP BY s.nom, s.rowid, s.email, f.rowid, f.facnumber, f.ref_client, f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp,";
+$sql.= " f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type, fk_mode_reglement";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql.= " ORDER BY ";
$listfield=explode(',',$sortfield);
diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php
index 27782259333..362493b7f19 100644
--- a/htdocs/compta/paiement/cheque/index.php
+++ b/htdocs/compta/paiement/cheque/index.php
@@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
+$langs->load("compta");
+$langs->load("bills");
// Security check
if ($user->societe_id) $socid=$user->societe_id;
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 2e28328085a..eab4369ac21 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -53,7 +53,7 @@ $search_email=GETPOST("search_email");
$search_skype=GETPOST("search_skype");
$search_priv=GETPOST("search_priv");
$search_categ=GETPOST("search_categ",'int');
-$search_statu=GETPOST("search_status",'int');
+$search_status=GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
@@ -96,9 +96,9 @@ else if ($type == "o")
$urlfiche="";
}
-if (GETPOST('button_removefilter'))
+if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both tests are required to be compatible with all browsers
{
- $search_firstlast_only="";
+ $search_firstlast_only="";
$search_lastname="";
$search_firstname="";
$search_societe="";
@@ -302,7 +302,7 @@ if ($result)
print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
- print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
if (! empty($conf->skype->enabled)) { print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder); }
@@ -356,8 +356,8 @@ if ($result)
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '';
print '';
- print '';
- print '';
+ print '';
+ print '';
print ' | ';
print '';
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index cf57e97933b..b1b28192395 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -79,14 +79,13 @@ $now=dol_now();
llxHeader();
$sql = 'SELECT';
+$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier,";
+$sql.= " s.nom as name, s.rowid as socid,";
$sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,';
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')",1,0).') as nb_expired,';
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,';
-$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
-$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,";
-$sql.= " s.nom as name, s.rowid as socid";
-$sql.= " ,c.ref_supplier";
+$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed';
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
@@ -107,7 +106,7 @@ if (!empty($search_ref_supplier)) {
if ($sall) {
$sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall);
}
-$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, s.nom, s.rowid";
+$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid";
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit + 1, $offset);
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 87ee2f1a1d2..8f5dcd93b70 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -2179,6 +2179,331 @@ abstract class CommonObject
}
}
+<<<<<<< HEAD
+=======
+
+ /**
+ * Function to get extra fields of a member into $this->array_options
+ * This method is in most cases called by method fetch of objects but you can call it separately.
+ *
+ * @param int $rowid Id of line
+ * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label()
+ * @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded
+ */
+ function fetch_optionals($rowid,$optionsArray='')
+ {
+ if (! is_array($optionsArray))
+ {
+ // optionsArray not already loaded, so we load it
+ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+ $extrafields = new ExtraFields($this->db);
+ $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element);
+ }
+
+
+ // Request to get complementary values
+ if (count($optionsArray) > 0)
+ {
+ $sql = "SELECT rowid";
+ foreach ($optionsArray as $name => $label)
+ {
+ $sql.= ", ".$name;
+ }
+ $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields";
+ $sql.= " WHERE fk_object = ".$rowid;
+
+ dol_syslog(get_class($this)."::fetch_optionals sql=".$sql, LOG_DEBUG);
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $numrows=$this->db->num_rows($resql);
+ if ($numrows)
+ {
+ $tab = $this->db->fetch_array($resql);
+
+ foreach ($tab as $key => $value)
+ {
+ // Test fetch_array ! is_int($key) because fetch_array result is a mix table with some key as alpha and some key as int (depend db engine)
+ if ($key != 'rowid' && $key != 'tms' && ! is_int($key))
+ {
+ // we can add this attribute to object properties
+ $this->array_options["options_".$key]=$value;
+ }
+ }
+ }
+
+ $this->db->free($resql);
+
+ if ($numrows) return $numrows;
+ else return 0;
+ }
+ else
+ {
+ dol_print_error($this->db);
+ return -1;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Delete all extra fields values for the current object.
+ *
+ * @return int <0 if KO, >0 if OK
+ */
+ function deleteExtraFields()
+ {
+ global $langs;
+
+ $error=0;
+
+ $this->db->begin();
+
+ $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
+ dol_syslog(get_class($this)."::deleteExtraFields delete sql=".$sql_del);
+ $resql=$this->db->query($sql_del);
+ if (! $resql)
+ {
+ $this->error=$this->db->lasterror();
+ dol_syslog(get_class($this)."::deleteExtraFields ".$this->error,LOG_ERR);
+ $this->db->rollback();
+ return -1;
+ }
+ else
+ {
+ $this->db->commit();
+ return 1;
+ }
+ }
+
+ /**
+ * Add/Update all extra fields values for the current object.
+ * All data to describe values to insert are stored into $this->array_options=array('keyextrafield'=>'valueextrafieldtoadd')
+ *
+ * @return int -1=error, O=did nothing, 1=OK
+ */
+ function insertExtraFields()
+ {
+ global $conf,$langs;
+
+ $error=0;
+
+ if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
+
+ if (! empty($this->array_options))
+ {
+ // Check parameters
+ $langs->load('admin');
+ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+ $extrafields = new ExtraFields($this->db);
+ $optionsArray = $extrafields->fetch_name_optionals_label($this->table_element);
+
+ foreach($this->array_options as $key => $value)
+ {
+ $attributeKey = substr($key,8); // Remove 'options_' prefix
+ $attributeType = $extrafields->attribute_type[$attributeKey];
+ $attributeSize = $extrafields->attribute_size[$attributeKey];
+ $attributeLabel = $extrafields->attribute_label[$attributeKey];
+ switch ($attributeType)
+ {
+ case 'int':
+ if (!is_numeric($value) && $value!='')
+ {
+ $error++; $this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel);
+ return -1;
+ }
+ elseif ($value=='')
+ {
+ $this->array_options[$key] = null;
+ }
+ break;
+ case 'price':
+ $this->array_options[$key] = price2num($this->array_options[$key]);
+ break;
+ case 'date':
+ $this->array_options[$key]=$this->db->idate($this->array_options[$key]);
+ break;
+ case 'datetime':
+ $this->array_options[$key]=$this->db->idate($this->array_options[$key]);
+ break;
+ }
+ }
+ $this->db->begin();
+
+ $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
+ dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del);
+ $this->db->query($sql_del);
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
+ foreach($this->array_options as $key => $value)
+ {
+ $attributeKey = substr($key,8); // Remove 'options_' prefix
+ // Add field of attribut
+ if (isset($extrafields->attribute_type[$attributeKey]) && $extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate
+ $sql.=",".$attributeKey;
+ }
+ $sql .= ") VALUES (".$this->id;
+ foreach($this->array_options as $key => $value)
+ {
+ $attributeKey = substr($key,8); // Remove 'options_' prefix
+ // Add field o fattribut
+ if(isset($extrafields->attribute_type[$attributeKey]) && $extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate)
+ {
+ if ($this->array_options[$key] != '')
+ {
+ $sql.=",'".$this->db->escape($this->array_options[$key])."'";
+ }
+ else
+ {
+ $sql.=",null";
+ }
+ }
+ }
+ $sql.=")";
+
+ dol_syslog(get_class($this)."::insertExtraFields insert sql=".$sql);
+ $resql = $this->db->query($sql);
+ if (! $resql)
+ {
+ $this->error=$this->db->lasterror();
+ dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR);
+ $this->db->rollback();
+ return -1;
+ }
+ else
+ {
+ $this->db->commit();
+ return 1;
+ }
+ }
+ else return 0;
+ }
+
+ /**
+ * Function to show lines of extrafields with output datas
+ *
+ * @param object $extrafields Extrafield Object
+ * @param string $mode Show output (view) or input (edit) for extrafield
+ * @param array $params Optionnal parameters
+ * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
+ *
+ * @return string
+ */
+ function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='')
+ {
+ global $_POST, $conf;
+
+ $out = '';
+
+ if (count($extrafields->attribute_label) > 0)
+ {
+ $out .= "\n";
+ $out .= ' ';
+ $out .= "\n";
+
+ $e = 0;
+ foreach($extrafields->attribute_label as $key=>$label)
+ {
+ if (is_array($params) && count($params)>0) {
+ if (array_key_exists('colspan',$params)) {
+ $colspan=$params['colspan'];
+ }
+ }else {
+ $colspan='3';
+ }
+ switch($mode) {
+ case "view":
+ $value=$this->array_options["options_".$key];
+ break;
+ case "edit":
+ $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]);
+ break;
+ }
+ if ($extrafields->attribute_type[$key] == 'separate')
+ {
+ $out .= $extrafields->showSeparator($key);
+ }
+ else
+ {
+ $csstyle='';
+ if (is_array($params) && count($params)>0) {
+ if (array_key_exists('style',$params)) {
+ $csstyle=$params['style'];
+ }
+ }
+ if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
+ {
+ $out .= '';
+ $colspan='0';
+ }
+ else
+ {
+ $out .= '
';
+ }
+ // Convert date into timestamp format
+ if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
+ {
+ $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
+ }
+
+ if($extrafields->attribute_required[$key])
+ $label = ''.$label.'';
+
+ $out .= '| '.$label.' | ';
+ $out .='';
+
+ switch($mode) {
+ case "view":
+ $out .= $extrafields->showOutputField($key,$value);
+ break;
+ case "edit":
+ $out .= $extrafields->showInputField($key,$value,'',$keyprefix);
+ break;
+ }
+
+ $out .= ' | '."\n";
+
+ if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '
';
+ else $out .= '';
+ $e++;
+ }
+ }
+ $out .= "\n";
+ $out .= ' ';
+ $out .= '
+ ';
+ }
+ return $out;
+ }
+
+
+>>>>>>> refs/remotes/origin/3.6
/**
* Function to check if an object is used by others.
* Check is done into this->childtables. There is no check into llx_element_element.
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 4cd62249545..af1d244e0d0 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -36,7 +36,7 @@ $result = restrictedArea($user, 'expedition',$expeditionid,'');
$search_ref_exp = GETPOST("search_ref_exp");
$search_ref_liv = GETPOST('search_ref_liv');
-$search_societe = GETPOST("search_societe");
+$search_company = GETPOST("search_company");
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
@@ -51,12 +51,12 @@ if (! $sortfield) $sortfield="e.ref";
if (! $sortorder) $sortorder="DESC";
$limit = $conf->liste_limit;
-// Do we click on purge search criteria ?
+// Purge search criteria
if (GETPOST("button_removefilter_x"))
{
$search_ref_exp='';
$search_ref_liv='';
- $search_societe='';
+ $search_company='';
}
/*
@@ -92,7 +92,7 @@ if ($socid)
}
if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp);
if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv);
-if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
+if ($search_company) $sql .= natural_search('s.nom', $search_company);
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1,$offset);
@@ -107,12 +107,13 @@ if ($resql)
$param="";
if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp;
if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv;
- if ($search_societe) $param.= "&search_societe=".$search_societe;
+ if ($search_company) $param.= "&search_company=".$search_company;
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num);
$i = 0;
+ print '