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 '
'."\n"; print ''; print ''; @@ -124,6 +125,7 @@ if ($resql) print_liste_field_titre($langs->trans("DateReceived"),"ship2bill.php","e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); } print_liste_field_titre($langs->trans("Status"),"ship2bill.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print ''; print "\n"; // Lignes des champs de filtre @@ -132,7 +134,7 @@ if ($resql) print ''; print ''; print ''; print ''; if($conf->livraison_bon->enabled) { @@ -141,13 +143,9 @@ if ($resql) print ''; print ''; } - print ''; + print ''; print ''; @@ -161,12 +159,15 @@ if ($resql) $objp = $db->fetch_object($resql); $var=!$var; + + // Ref print ""; print "\n"; + // Third party print ''; - // Date delivery planed + + // Date delivery planed print ""; print '"; print ""; -print ""; +print ""; print ""; $var=!$var; diff --git a/htdocs/fichinter/apercu.php b/htdocs/fichinter/apercu.php index 65721bdcce1..0d4d3421538 100644 --- a/htdocs/fichinter/apercu.php +++ b/htdocs/fichinter/apercu.php @@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref)) // Date print ''; - print "\n"; + print "\n"; print ''; print '
 
'; - print ''; + print ''; print '  '; - // Développé dans la 3.7 - //print img_search(); - //print img_searchclear(); - print ''; + print ''; print ''; - print ''; print ''.$langs->trans("All").' / '.$langs->trans("None").''; print '
"; $shipment->id=$objp->rowid; $shipment->ref=$objp->ref; print $shipment->getNomUrl(1); print "'; $companystatic->id=$objp->socid; @@ -174,7 +175,8 @@ if ($resql) $companystatic->name=$objp->socname; print $companystatic->getNomUrl(1); print '"; print dol_print_date($db->jdate($objp->date_expedition),"day"); /*$now = time(); diff --git a/htdocs/externalsite/admin/externalsite.php b/htdocs/externalsite/admin/externalsite.php index 95d0a4397de..93595b2cb9f 100644 --- a/htdocs/externalsite/admin/externalsite.php +++ b/htdocs/externalsite/admin/externalsite.php @@ -99,7 +99,7 @@ $var=!$var; print "
'.$langs->trans("Label")."global->EXTERNALSITE_LABEL) || $conf->global->EXTERNALSITE_LABEL=='ExternalSite')?'':$conf->global->EXTERNALSITE_LABEL)) . "\" size=\"12\">My menu entry".$langs->trans("ExampleMyMenuEntry")."
'.$langs->trans("Date").'".dol_print_date($object->date,"daytext")."".dol_print_date($object->datec,"daytext")."
'; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 524feec13df..a6d3f9720ec 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -158,7 +158,7 @@ if ($result) } print ''; $liststatus=$interventionstatic->statuts_short; - print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1, 0, 0, '', 1); + print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); print ''; print ''; print ''; diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 3253a79fcd8..2767c792f9e 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -117,7 +117,7 @@ if ($user->rights->fournisseur->facture->lire) if ($search_ref) { - $sql .= " AND f.rowid LIKE '%".$search_ref."%'"; + $sql .= " AND f.ref LIKE '%".$search_ref."%'"; } if ($search_ref_supplier) { @@ -241,7 +241,7 @@ if ($user->rights->fournisseur->facture->lire) print $facturestatic->getNomUrl(1); print "\n"; - print ''.dol_trunc($objp->ref_supplier,12)."\n"; + print ''.dol_trunc($objp->ref_supplier,12).''; print ''.dol_print_date($db->jdate($objp->df),'day')."\n"; print ''.dol_print_date($db->jdate($objp->datelimite),'day'); @@ -258,7 +258,7 @@ if ($user->rights->fournisseur->facture->lire) print "".price($objp->total_ttc).""; print "".price($objp->am).""; - // Affiche statut de la facture + // Show invoice status print ''; print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 616e9690e8a..357df92a4eb 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -72,8 +72,9 @@ $search_amount_no_tax = GETPOST("search_amount_no_tax","alpha"); $search_amount_all_tax = GETPOST("search_amount_all_tax","alpha"); $month = GETPOST("month","int"); $year = GETPOST("year","int"); +$filter = GETPOST("filtre"); -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers { $search_ref=""; $search_ref_supplier=""; @@ -83,6 +84,7 @@ if (GETPOST("button_removefilter")) $search_amount_all_tax=""; $year=""; $month=""; + $filter=""; } /* @@ -136,9 +138,9 @@ if ($socid) { $sql .= " AND s.rowid = ".$socid; } -if (GETPOST('filtre') && GETPOST('filtre') != -1) // GETPOST('filtre') may be a string +if ($filter && $filter != -1) // GETPOST('filtre') may be a string { - $filtrearr = explode(",", GETPOST('filtre')); + $filtrearr = explode(",", $filter); foreach ($filtrearr as $fil) { $filt = explode(":", $fil); @@ -217,7 +219,7 @@ if ($resql) if ($search_company) $param.='&search_company='.urlencode($search_company); if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax); if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax); - if (GETPOST("filtre") && GETPOST('filtre') != -1) $param.='&filtre='.urlencode(GETPOST("filtre")); + if ($filter && $filter != -1) $param.='&filtre='.urlencode($filter); print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print ''; @@ -269,8 +271,8 @@ if ($resql) print ''; print ''; print ''; - $liststatus=array('paye:0'=>$langs->trans("Unpayed"), 'paye:1'=>$langs->trans("Payed")); - print $form->selectarray('filtre', $liststatus, GETPOST('filtre'), 1); + $liststatus=array('paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid")); + print $form->selectarray('filtre', $liststatus, $filter, 1); print ''; print ''; print ''; @@ -329,7 +331,7 @@ if ($resql) //print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$objp->am); print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5); print ''; - + print ' '; print "\n"; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index f467e9235ef..57100bd98f0 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -536,7 +536,7 @@ if (empty($action)) print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$paramlist,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'c.libelle','',$paramlist,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Account'),$_SERVER["PHP_SELF"],'ba.label','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'f.amount','',$paramlist,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'p.amount','',$paramlist,'align="right"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$paramlist,'',$sortfield,$sortorder); print ' '; print "\n"; diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index 513c8b527d2..a0e1e058860 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -84,7 +84,7 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'56','Soci insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'57','Société par actions simplifiée (SAS)'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'58','Entreprise Unipersonnelle à Responsabilité Limitée (EURL)'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'59','Société par actions simplifiée unipersonnelle (SASU)'); - +insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'60', 'Entreprise Individuelle à Responsabilité Limitée (EIRL)'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'61','Caisse d''épargne et de prévoyance'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'62','Groupement d''intérêt économique (GIE)'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'63','Société coopérative agricole'); diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index de02887abf8..de80d439b82 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -18,6 +18,7 @@ -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (1, '60', 'Entreprise Individuelle à Responsabilité Limitée (EIRL)', 1); --insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',19); --insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_DELETE','Intervention delete','Executed when a intervention is delete','ficheinter',19); @@ -90,7 +91,6 @@ ALTER TABLE llx_bank_account ADD COLUMN accountancy_journal varchar(3) DEFAULT N ALTER TABLE llx_accountingaccount add column entity integer DEFAULT 1 NOT NULL AFTER rowid; ALTER TABLE llx_accountingaccount add column datec datetime AFTER entity; -ALTER TABLE llx_accountingaccount add column tms timestamp AFTER datec; ALTER TABLE llx_accountingaccount add column fk_user_author integer DEFAULT NULL AFTER label; ALTER TABLE llx_accountingaccount add column fk_user_modif integer DEFAULT NULL AFTER fk_user_author; @@ -102,6 +102,8 @@ UPDATE llx_const SET name = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT' WHERE name = 'COMPT UPDATE llx_const SET name = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT' WHERE name = 'COMPTA_PRODUCT_SOLD_ACCOUNT'; UPDATE llx_const SET name = 'ACCOUNTING_SERVICE_BUY_ACCOUNT' WHERE name = 'COMPTA_SERVICE_BUY_ACCOUNT'; UPDATE llx_const SET name = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT' WHERE name = 'COMPTA_SERVICE_SOLD_ACCOUNT'; +UPDATE llx_const SET name = 'ACCOUNTING_VAT_ACCOUNT' WHERE name = 'COMPTA_VAT_ACCOUNT'; +UPDATE llx_const SET name = 'ACCOUNTING_VAT_BUY_ACCOUNT' WHERE name = 'COMPTA_VAT_BUY_ACCOUNT'; -- Compatibility with module Accounting Expert UPDATE llx_const SET name = 'ACCOUNTING_SEPARATORCSV' WHERE name = 'ACCOUNTINGEX_SEPARATORCSV'; @@ -127,6 +129,7 @@ DROP TABLE llx_compta_compte_generaux; -- Align size for accounting account ALTER TABLE llx_accountingaccount MODIFY COLUMN account_number varchar(32); ALTER TABLE llx_accountingaccount MODIFY COLUMN account_parent varchar(32); +ALTER TABLE llx_accountingaccount add column tms timestamp AFTER datec; ALTER TABLE llx_accountingdebcred MODIFY COLUMN account_number varchar(32); ALTER TABLE llx_bank_account MODIFY COLUMN account_number varchar(32); ALTER TABLE llx_c_chargesociales MODIFY COLUMN accountancy_code varchar(32); diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index d96c5f48bfc..3bf5255a5fc 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -54,6 +54,7 @@ CREATE OR REPLACE FUNCTION dol_util_triggerall(DoEnable boolean) RETURNS integer -- Add triggers for timestamp fields CREATE OR REPLACE FUNCTION update_modified_column_tms() RETURNS TRIGGER AS $$ BEGIN NEW.tms = now(); RETURN NEW; END; $$ LANGUAGE plpgsql; +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accountingaccount FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accountingtransaction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 02795052fe5..77d91ad801d 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -33,6 +33,6 @@ IConfirmDonationReception=The recipient declare reception, as a donation, of the MinimumAmount=Minimum amount is %s FreeTextOnDonations=Free text to show in footer FrenchOptions=Options for France -DONATION_ART200=Show legacy article 200 -DONATION_ART238=Show legacy article 238 -DONATION_ART885=Show legacy article 885 \ No newline at end of file +DONATION_ART200=Show article 200 from CGI if you are concerned +DONATION_ART238=Show article 238 from CGI if you are concerned +DONATION_ART885=Show article 885 from CGI if you are concerned diff --git a/htdocs/langs/en_US/externalsite.lang b/htdocs/langs/en_US/externalsite.lang index 62da68c045d..afec761f5fe 100644 --- a/htdocs/langs/en_US/externalsite.lang +++ b/htdocs/langs/en_US/externalsite.lang @@ -2,3 +2,4 @@ ExternalSiteSetup=Setup link to external website ExternalSiteURL=External Site URL ExternalSiteModuleNotComplete=Module ExternalSite was not configured properly. +ExampleMyMenuEntry=My menu entry \ No newline at end of file diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5f9d42cdd44..92d588d19fe 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -124,7 +124,7 @@ if (empty($reshook)) // Barcode value if ($action == 'setbarcode' && $createbarcode) { - $result=$object->check_barcode(GETPOST('barcode'),GETPOT('barcode_type_code')); + $result=$object->check_barcode(GETPOST('barcode'),GETPOST('barcode_type_code')); if ($result >= 0) { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index a6b09cea8a6..f242121625f 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -87,12 +87,14 @@ else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas); * Actions */ -if (isset($_POST["button_removefilter_x"])) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $sref=""; $sbarcode=""; $snom=""; $search_categ=0; + $tosell=""; + $tobuy=""; } @@ -379,7 +381,7 @@ else print ''; print ''; - print ''; + print ''; print ''; print '';