Merge branch 'develop' into develop_bug5
This commit is contained in:
commit
3b202b2255
@ -45,6 +45,7 @@ $modellabel=GETPOST("modellabel"); // Doc template to use for address sheet
|
|||||||
$mesg='';
|
$mesg='';
|
||||||
|
|
||||||
$adherentstatic=new Adherent($db);
|
$adherentstatic=new Adherent($db);
|
||||||
|
$object=new Adherent($db);
|
||||||
|
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
@ -70,11 +71,11 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
|||||||
$sql.= " t.libelle as type,";
|
$sql.= " t.libelle as type,";
|
||||||
$sql.= " c.code as country_code, c.label as country";
|
$sql.= " c.code as country_code, c.label as country";
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
foreach ($extrafields->attribute_label as $key => $val)
|
if (! empty($extrafields->attributes[$object->table_element]['label']))
|
||||||
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||||
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
||||||
$sql.= " AND d.entity IN (".getEntity('adherent').")";
|
$sql.= " AND d.entity IN (".getEntity('adherent').")";
|
||||||
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
|
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
|
||||||
@ -98,10 +99,10 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
|||||||
$adherentstatic->firstname=$objp->firstname;
|
$adherentstatic->firstname=$objp->firstname;
|
||||||
|
|
||||||
// format extrafiled so they can be parsed in function complete_substitutions_array
|
// format extrafiled so they can be parsed in function complete_substitutions_array
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
|
||||||
{
|
{
|
||||||
$adherentstatic->array_options = array();
|
$adherentstatic->array_options = array();
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
$tmpkey='options_'.$key;
|
$tmpkey='options_'.$key;
|
||||||
if (!empty($objp->$tmpkey))
|
if (!empty($objp->$tmpkey))
|
||||||
|
|||||||
@ -338,7 +338,7 @@ if ($action == 'create')
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -736,7 +736,7 @@ if ($rowid > 0)
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -744,7 +744,7 @@ if ($rowid > 0)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// Extra field
|
// Extra field
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print '<br><br><table class="border" width="100%">';
|
print '<br><br><table class="border" width="100%">';
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
|
|||||||
@ -50,7 +50,7 @@ llxHeader();
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("PerfDolibarr"),'','title_setup');
|
print load_fiche_titre($langs->trans("PerfDolibarr"),'','title_setup');
|
||||||
|
|
||||||
print $langs->trans("YouMayFindPerfAdviceHere",'http://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
print $langs->trans("YouMayFindPerfAdviceHere",'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||||
|
|
||||||
// Recupere la version de PHP
|
// Recupere la version de PHP
|
||||||
$phpversion=version_php();
|
$phpversion=version_php();
|
||||||
|
|||||||
@ -317,7 +317,7 @@ if ($action == 'create')
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -715,7 +715,7 @@ if ($rowid > 0)
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -723,7 +723,7 @@ if ($rowid > 0)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// Extra field
|
// Extra field
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print '<br><br><table class="border" width="100%">';
|
print '<br><br><table class="border" width="100%">';
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
|
|||||||
@ -268,7 +268,7 @@ if ($user->rights->categorie->creer)
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,7 +176,7 @@ print '</td></tr>';
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -908,7 +908,7 @@ if ($action == 'create')
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -1260,7 +1260,7 @@ if ($id > 0)
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -754,7 +754,7 @@ if ($action == 'create')
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -1235,7 +1235,7 @@ else
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1646,7 +1646,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
$parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid);
|
$parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid);
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
if (empty($reshook)) {
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -472,7 +472,7 @@ if ($action == 'create' && !$error)
|
|||||||
$parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders);
|
$parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders);
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
$object=new Facture($db);
|
$object=new Facture($db);
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
|
|||||||
@ -413,7 +413,7 @@ if ($action == 'create')
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit',$parameters);
|
print $object->showOptionals($extrafields,'edit',$parameters);
|
||||||
}
|
}
|
||||||
@ -914,7 +914,7 @@ else
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2857,7 +2857,7 @@ if ($action == 'create')
|
|||||||
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="2"', 'cols'=>2);
|
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="2"', 'cols'=>2);
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
if (empty($reshook)) {
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2730,14 +2730,15 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la facture meme
|
// Mise a jour informations denormalisees au niveau de la facture meme
|
||||||
$result=$this->update_price(1,'auto',0,$mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->line->rowid;
|
return $this->line->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -4482,11 +4483,11 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet');
|
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet');
|
||||||
|
$this->rowid=$this->id; // For backward compatibility
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$this->id=$this->rowid;
|
|
||||||
$result=$this->insertExtraFields();
|
$result=$this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -4558,12 +4559,12 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->rowid;
|
return $this->id;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -369,7 +369,8 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
|||||||
|
|
||||||
foreach ($x_both[$rate]['coll']['detail'] as $index => $fields) {
|
foreach ($x_both[$rate]['coll']['detail'] as $index => $fields) {
|
||||||
// Define type
|
// Define type
|
||||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
|
||||||
|
$type=(isset($fields['dtype'])?$fields['dtype']:$fields['ptype']);
|
||||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||||
// was not saved.
|
// was not saved.
|
||||||
if (!empty($fields['ddate_start'])) {
|
if (!empty($fields['ddate_start'])) {
|
||||||
@ -401,10 +402,10 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
|||||||
{
|
{
|
||||||
$product_static->id=$fields['pid'];
|
$product_static->id=$fields['pid'];
|
||||||
$product_static->ref=$fields['pref'];
|
$product_static->ref=$fields['pref'];
|
||||||
$product_static->type=$fields['ptype'];
|
$product_static->type=$fields['dtype']; // We force with the type of line to have type how line is registered
|
||||||
print $product_static->getNomUrl(1);
|
print $product_static->getNomUrl(1);
|
||||||
if (dol_string_nohtmltag($fields['descr'])) {
|
if (dol_string_nohtmltag($fields['descr'])) {
|
||||||
print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -423,7 +424,7 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
|||||||
$fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
$fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),24);
|
||||||
|
|
||||||
// Show range
|
// Show range
|
||||||
print_date_range($fields['ddate_start'],$fields['ddate_end']);
|
print_date_range($fields['ddate_start'],$fields['ddate_end']);
|
||||||
@ -550,7 +551,8 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
|||||||
|
|
||||||
foreach ($x_both[$rate]['paye']['detail'] as $index=>$fields) {
|
foreach ($x_both[$rate]['paye']['detail'] as $index=>$fields) {
|
||||||
// Define type
|
// Define type
|
||||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
|
||||||
|
$type=(isset($fields['dtype'])?$fields['dtype']:$fields['ptype']);
|
||||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||||
// was not saved.
|
// was not saved.
|
||||||
if (!empty($fields['ddate_start'])) {
|
if (!empty($fields['ddate_start'])) {
|
||||||
@ -582,10 +584,10 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
|||||||
{
|
{
|
||||||
$product_static->id=$fields['pid'];
|
$product_static->id=$fields['pid'];
|
||||||
$product_static->ref=$fields['pref'];
|
$product_static->ref=$fields['pref'];
|
||||||
$product_static->type=$fields['ptype'];
|
$product_static->type=$fields['dtype']; // We force with the type of line to have type how line is registered
|
||||||
print $product_static->getNomUrl(1);
|
print $product_static->getNomUrl(1);
|
||||||
if (dol_string_nohtmltag($fields['descr'])) {
|
if (dol_string_nohtmltag($fields['descr'])) {
|
||||||
print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -595,7 +597,16 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
|||||||
} else {
|
} else {
|
||||||
$text = img_object($langs->trans('Product'),'product');
|
$text = img_object($langs->trans('Product'),'product');
|
||||||
}
|
}
|
||||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg)) {
|
||||||
|
if ($reg[1]=='DEPOSIT') {
|
||||||
|
$fields['descr']=$langs->transnoentitiesnoconv('Deposit');
|
||||||
|
} elseif ($reg[1]=='CREDIT_NOTE') {
|
||||||
|
$fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
|
||||||
|
} else {
|
||||||
|
$fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),24);
|
||||||
|
|
||||||
// Show range
|
// Show range
|
||||||
print_date_range($fields['ddate_start'],$fields['ddate_end']);
|
print_date_range($fields['ddate_start'],$fields['ddate_end']);
|
||||||
|
|||||||
@ -686,7 +686,7 @@ else
|
|||||||
$parameters=array('socid' => $socid, 'objsoc' => $objsoc, 'colspan' => ' colspan="3"', 'cols' => 3);
|
$parameters=array('socid' => $socid, 'objsoc' => $objsoc, 'colspan' => ' colspan="3"', 'cols' => 3);
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -963,7 +963,7 @@ else
|
|||||||
$parameters=array('colspan' => ' colspan="3"', 'cols'=>3);
|
$parameters=array('colspan' => ' colspan="3"', 'cols'=>3);
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1287,7 +1287,7 @@ if ($action == 'create')
|
|||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
if (empty($reshook)) {
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -153,7 +153,7 @@ if ($action == "update_extras" && ! empty($permissiontoadd))
|
|||||||
$attributekeylong = 'options_'.$attributekey;
|
$attributekeylong = 'options_'.$attributekey;
|
||||||
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong,' alpha');
|
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong,' alpha');
|
||||||
|
|
||||||
$result = $object->updateExtraField($attributekey, empty($triggermodname)?'':$triggermodname, $user);
|
$result = $object->insertExtraFields(empty($triggermodname)?'':$triggermodname, $user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
|
|||||||
@ -4903,14 +4903,14 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an exta field value for the current object.
|
* Update an extra field value for the current object.
|
||||||
* Data to describe values to update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
* Data to describe values to update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||||
*
|
*
|
||||||
* @param string $key Key of the extrafield (without starting 'options_')
|
* @param string $key Key of the extrafield (without starting 'options_')
|
||||||
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
|
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
|
||||||
* @param User $userused Object user
|
* @param User $userused Object user
|
||||||
* @return int -1=error, O=did nothing, 1=OK
|
* @return int -1=error, O=did nothing, 1=OK
|
||||||
* @see setValueFrom
|
* @see setValueFrom, insertExtraFields
|
||||||
*/
|
*/
|
||||||
function updateExtraField($key, $trigger, $userused)
|
function updateExtraField($key, $trigger, $userused)
|
||||||
{
|
{
|
||||||
@ -5054,7 +5054,6 @@ abstract class CommonObject
|
|||||||
if (is_array($val['arrayofkeyval'])) $type='select';
|
if (is_array($val['arrayofkeyval'])) $type='select';
|
||||||
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link';
|
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link';
|
||||||
|
|
||||||
//$elementtype=$this->attribute_elementtype[$key]; // seems to not be used
|
|
||||||
$default=$val['default'];
|
$default=$val['default'];
|
||||||
$computed=$val['computed'];
|
$computed=$val['computed'];
|
||||||
$unique=$val['unique'];
|
$unique=$val['unique'];
|
||||||
@ -5597,7 +5596,6 @@ abstract class CommonObject
|
|||||||
if (is_array($val['arrayofkeyval'])) $type='select';
|
if (is_array($val['arrayofkeyval'])) $type='select';
|
||||||
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link';
|
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link';
|
||||||
|
|
||||||
//$elementtype=$this->attribute_elementtype[$key]; // seems to not be used
|
|
||||||
$default=$val['default'];
|
$default=$val['default'];
|
||||||
$computed=$val['computed'];
|
$computed=$val['computed'];
|
||||||
$unique=$val['unique'];
|
$unique=$val['unique'];
|
||||||
@ -5996,7 +5994,7 @@ abstract class CommonObject
|
|||||||
|
|
||||||
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate')
|
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate')
|
||||||
{
|
{
|
||||||
$out .= $extrafields->showSeparator($key);
|
$out .= $extrafields->showSeparator($key, $this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1384,7 +1384,6 @@ class ExtraFields
|
|||||||
|
|
||||||
if (! empty($extrafieldsobjectkey))
|
if (! empty($extrafieldsobjectkey))
|
||||||
{
|
{
|
||||||
$elementtype=$this->attributes[$extrafieldsobjectkey]['elementtype'][$key]; // seems not used
|
|
||||||
$label=$this->attributes[$extrafieldsobjectkey]['label'][$key];
|
$label=$this->attributes[$extrafieldsobjectkey]['label'][$key];
|
||||||
$type=$this->attributes[$extrafieldsobjectkey]['type'][$key];
|
$type=$this->attributes[$extrafieldsobjectkey]['type'][$key];
|
||||||
$size=$this->attributes[$extrafieldsobjectkey]['size'][$key];
|
$size=$this->attributes[$extrafieldsobjectkey]['size'][$key];
|
||||||
@ -1400,7 +1399,6 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
else // Old usage
|
else // Old usage
|
||||||
{
|
{
|
||||||
$elementtype=$this->attribute_elementtype[$key]; // seems not used
|
|
||||||
$label=$this->attribute_label[$key];
|
$label=$this->attribute_label[$key];
|
||||||
$type=$this->attribute_type[$key];
|
$type=$this->attribute_type[$key];
|
||||||
$size=$this->attribute_size[$key];
|
$size=$this->attribute_size[$key];
|
||||||
@ -1743,11 +1741,16 @@ class ExtraFields
|
|||||||
* Return HTML string to print separator extrafield
|
* Return HTML string to print separator extrafield
|
||||||
*
|
*
|
||||||
* @param string $key Key of attribute
|
* @param string $key Key of attribute
|
||||||
* @return string
|
* @param string $object Object
|
||||||
|
* @return string HTML code with line for separator
|
||||||
*/
|
*/
|
||||||
function showSeparator($key)
|
function showSeparator($key, $object)
|
||||||
{
|
{
|
||||||
$out = '<tr class="trextrafieldseparator trextrafieldseparator'.$key.'"><td colspan="4"><strong>'.$this->attribute_label[$key].'</strong></td></tr>';
|
global $langs;
|
||||||
|
|
||||||
|
$out = '<tr class="trextrafieldseparator trextrafieldseparator'.$key.'"><td colspan="2"><strong>';
|
||||||
|
$out.= $langs->trans($this->attributes[$object->table_element]['label'][$key]);
|
||||||
|
$out.= '</strong></td></tr>';
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -867,7 +867,7 @@ class FormFile
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir).'$/', $filedir, $regs);
|
preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir,'/').'$/', $filedir, $regs);
|
||||||
$entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity);
|
$entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1261,15 +1261,18 @@ class FormMail extends Form
|
|||||||
// Create dynamic tags for __PRODUCT_EXTRAFIELD_FIELD__
|
// Create dynamic tags for __PRODUCT_EXTRAFIELD_FIELD__
|
||||||
if (!empty($line->fk_product))
|
if (!empty($line->fk_product))
|
||||||
{
|
{
|
||||||
$extrafields = new ExtraFields($this->db);
|
if (! is_object($extrafields)) $extrafields = new ExtraFields($this->db);
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('product', true);
|
$extralabels = $extrafields->fetch_name_optionals_label('product', true);
|
||||||
$product = new Product($this->db);
|
$product = new Product($this->db);
|
||||||
$product->fetch($line->fk_product, '', '', 1);
|
$product->fetch($line->fk_product, '', '', 1);
|
||||||
$product->fetch_optionals();
|
$product->fetch_optionals();
|
||||||
foreach ($extrafields->attribute_label as $key => $label) {
|
if (is_array($extrafieldstmp->attributes[$object->table_element]['label']) && count($extrafieldstmp->attributes[$object->table_element]['label']) > 0)
|
||||||
|
{
|
||||||
|
foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) {
|
||||||
$substit_line['__PRODUCT_EXTRAFIELD_' . strtoupper($key) . '__'] = $product->array_options['options_' . $key];
|
$substit_line['__PRODUCT_EXTRAFIELD_' . strtoupper($key) . '__'] = $product->array_options['options_' . $key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->substit_lines[] = $substit_line;
|
$this->substit_lines[] = $substit_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,7 +140,7 @@ class FormTicketsup
|
|||||||
|
|
||||||
print "\n<!-- Begin form TICKETSUP -->\n";
|
print "\n<!-- Begin form TICKETSUP -->\n";
|
||||||
|
|
||||||
print '<form method="POST" style="margin-bottom: 10px;" name="ticketsup" id="form_create_ticket" enctype="multipart/form-data" action="' . $this->param["returnurl"] . '">';
|
print '<form method="POST" style="margin-bottom: 30px;" name="ticketsup" id="form_create_ticket" enctype="multipart/form-data" action="' . $this->param["returnurl"] . '">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="' . $this->action . '">';
|
print '<input type="hidden" name="action" value="' . $this->action . '">';
|
||||||
foreach ($this->param as $key => $value) {
|
foreach ($this->param as $key => $value) {
|
||||||
@ -386,7 +386,7 @@ class FormTicketsup
|
|||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $action); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook) && is_array($extrafields->attributes[$ticketstat->table_element]['label']))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $ticketstat->showOptionals($extrafields, 'edit');
|
print $ticketstat->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5964,13 +5964,16 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
|||||||
// Create dynamic tags for __EXTRAFIELD_FIELD__
|
// Create dynamic tags for __EXTRAFIELD_FIELD__
|
||||||
if ($object->table_element && $object->id > 0)
|
if ($object->table_element && $object->id > 0)
|
||||||
{
|
{
|
||||||
$extrafieldstmp = new ExtraFields($db);
|
if (! is_object($extrafields)) $extrafieldstmp = new ExtraFields($db);
|
||||||
$extralabels = $extrafieldstmp->fetch_name_optionals_label($object->table_element, true);
|
$extralabels = $extrafieldstmp->fetch_name_optionals_label($object->table_element, true);
|
||||||
$object->fetch_optionals();
|
$object->fetch_optionals();
|
||||||
foreach ($extrafieldstmp->attribute_label as $key => $label) {
|
if (is_array($extrafieldstmp->attributes[$object->table_element]['label']) && count($extrafieldstmp->attributes[$object->table_element]['label']) > 0)
|
||||||
|
{
|
||||||
|
foreach ($extrafieldstmp->attributes[$object->table_element]['label'] as $key => $label) {
|
||||||
$substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
|
$substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Complete substitution array with the url to make online payment
|
// Complete substitution array with the url to make online payment
|
||||||
$paymenturl='';
|
$paymenturl='';
|
||||||
|
|||||||
@ -323,7 +323,6 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
|||||||
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
|
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
|
||||||
}
|
}
|
||||||
|
|
||||||
//print $sql.'<br>';
|
|
||||||
if (! $sql) return -1;
|
if (! $sql) return -1;
|
||||||
if ($sql == 'TODO') return -2;
|
if ($sql == 'TODO') return -2;
|
||||||
if ($sql != 'TODO')
|
if ($sql != 'TODO')
|
||||||
|
|||||||
@ -143,6 +143,7 @@ $langs->load("modulebuilder");
|
|||||||
<table summary="listofattributes" class="border centpercent">
|
<table summary="listofattributes" class="border centpercent">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
$label=$extrafields->attributes[$elementtype]['label'][$attrname];
|
||||||
$type=$extrafields->attributes[$elementtype]['type'][$attrname];
|
$type=$extrafields->attributes[$elementtype]['type'][$attrname];
|
||||||
$size=$extrafields->attributes[$elementtype]['size'][$attrname];
|
$size=$extrafields->attributes[$elementtype]['size'][$attrname];
|
||||||
$computed=$extrafields->attributes[$elementtype]['computed'][$attrname];
|
$computed=$extrafields->attributes[$elementtype]['computed'][$attrname];
|
||||||
@ -175,7 +176,7 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($t
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!-- Label -->
|
<!-- Label -->
|
||||||
<tr><td class="titlefield fieldrequired"><?php echo $langs->trans("Label"); ?></td><td class="valeur"><input type="text" name="label" size="40" value="<?php echo $extrafields->attribute_label[$attrname]; ?>"></td></tr>
|
<tr><td class="titlefield fieldrequired"><?php echo $langs->trans("Label"); ?></td><td class="valeur"><input type="text" name="label" size="40" value="<?php echo $label; ?>"></td></tr>
|
||||||
<!-- Code -->
|
<!-- Code -->
|
||||||
<tr><td class="fieldrequired"><?php echo $langs->trans("AttributeCode"); ?></td><td class="valeur"><?php echo $attrname; ?></td></tr>
|
<tr><td class="fieldrequired"><?php echo $langs->trans("AttributeCode"); ?></td><td class="valeur"><?php echo $attrname; ?></td></tr>
|
||||||
<!-- Type -->
|
<!-- Type -->
|
||||||
|
|||||||
@ -40,7 +40,7 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (empty($reshook)) {
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (empty($reshook)) {
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,8 +7,10 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
|
||||||
|
|
||||||
// Loop to show all columns of extrafields from $obj, $extrafields and $db
|
// Loop to show all columns of extrafields from $obj, $extrafields and $db
|
||||||
if (! empty($extrafieldsobjectkey)) // New method: $extrafieldsobject can be 'societe', 'socpeople', ...
|
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 (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
|
||||||
{
|
{
|
||||||
@ -42,36 +44,3 @@ if (! empty($extrafieldsobjectkey)) // New method: $extrafieldsobject can be 'so
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Old method
|
|
||||||
{
|
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
print '<td';
|
|
||||||
if ($align) print ' align="'.$align.'"';
|
|
||||||
print '>';
|
|
||||||
$tmpkey='options_'.$key;
|
|
||||||
if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp')))
|
|
||||||
{
|
|
||||||
$value = $db->jdate($obj->$tmpkey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$value = $obj->$tmpkey;
|
|
||||||
}
|
|
||||||
print $extrafields->showOutputField($key, $value, '');
|
|
||||||
print '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
if (! empty($val['isameasure']))
|
|
||||||
{
|
|
||||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
|
|
||||||
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -7,16 +7,18 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
|
||||||
|
|
||||||
// Loop to show all columns of extrafields for the search title line
|
// Loop to show all columns of extrafields for the search title line
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($arrayfields["ef.".$key]['checked'])) {
|
if (! empty($arrayfields["ef.".$key]['checked'])) {
|
||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
$typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
|
||||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
|
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]))
|
||||||
{
|
{
|
||||||
$crit=$val;
|
$crit=$val;
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
|
|||||||
@ -7,12 +7,17 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
|
||||||
|
|
||||||
// Loop to complete the sql search criterias from extrafields
|
// Loop to complete the sql search criterias from extrafields
|
||||||
foreach ($search_array_options as $key => $val)
|
if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
|
||||||
{
|
{
|
||||||
|
foreach ($search_array_options as $key => $val)
|
||||||
|
{
|
||||||
$crit=$val;
|
$crit=$val;
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
$typ=$extrafields->attribute_type[$tmpkey];
|
$typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey];
|
||||||
|
|
||||||
$mode_search=0;
|
$mode_search=0;
|
||||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
||||||
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
||||||
@ -21,4 +26,5 @@ foreach ($search_array_options as $key => $val)
|
|||||||
{
|
{
|
||||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ print $hookmanager->resPrint;
|
|||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
//var_dump($extrafields->attributes);
|
//var_dump($extrafields->attributes);
|
||||||
if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label']))
|
if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label']))
|
||||||
{
|
{
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
|
|||||||
}
|
}
|
||||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate')
|
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate')
|
||||||
{
|
{
|
||||||
print $extrafields->showSeparator($key);
|
print $extrafields->showSeparator($key, $object);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -387,7 +387,7 @@ if ($action == 'create')
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit',$parameters);
|
print $object->showOptionals($extrafields,'edit',$parameters);
|
||||||
}
|
}
|
||||||
@ -513,7 +513,7 @@ if (! empty($id) && $action == 'edit')
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1059,7 +1059,7 @@ if ($action == 'create')
|
|||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
if (empty($reshook)) {
|
||||||
// copy from order
|
// copy from order
|
||||||
$orderExtrafields = new Extrafields($db);
|
$orderExtrafields = new Extrafields($db);
|
||||||
$orderExtrafieldLabels = $orderExtrafields->fetch_name_optionals_label($object->table_element);
|
$orderExtrafieldLabels = $orderExtrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|||||||
@ -1412,7 +1412,7 @@ if ($action == 'create')
|
|||||||
$parameters = array('colspan' => ' colspan="3"');
|
$parameters = array('colspan' => ' colspan="3"');
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
if (empty($reshook)) {
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1002,7 +1002,7 @@ if ($action == 'create')
|
|||||||
$parameters=array('colspan' => ' colspan="2"');
|
$parameters=array('colspan' => ' colspan="2"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1609,7 +1609,7 @@ if ($action=='create')
|
|||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -371,7 +371,7 @@ if ($action == 'create' && !$error) {
|
|||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
$object=new FactureFournisseur($db);
|
$object=new FactureFournisseur($db);
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
|
|||||||
@ -1998,7 +1998,7 @@ if ($action == 'create')
|
|||||||
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -267,7 +267,7 @@ if ($ok && GETPOST('standard', 'alpha'))
|
|||||||
if (! in_array($code,array_keys($arrayoffieldsfound)))
|
if (! in_array($code,array_keys($arrayoffieldsfound)))
|
||||||
{
|
{
|
||||||
print 'Found field '.$code.' declared into '.MAIN_DB_PREFIX.'extrafields table but not found into desc of table '.$tableextra." -> ";
|
print 'Found field '.$code.' declared into '.MAIN_DB_PREFIX.'extrafields table but not found into desc of table '.$tableextra." -> ";
|
||||||
$type=$extrafields->attribute_type[$code]; $length=$extrafields->attribute_size[$code]; $attribute=''; $default=''; $extra=''; $null='null';
|
$type=$extrafields->attributes[$elementtype]['type'][$code]; $length=$extrafields->attributes[$elementtype]['size'][$code]; $attribute=''; $default=''; $extra=''; $null='null';
|
||||||
|
|
||||||
if ($type=='boolean') {
|
if ($type=='boolean') {
|
||||||
$typedb='int';
|
$typedb='int';
|
||||||
|
|||||||
@ -37,7 +37,7 @@ $versionfrom=GETPOST("versionfrom",'alpha',3)?GETPOST("versionfrom",'alpha',3):(
|
|||||||
$versionto=GETPOST("versionto",'alpha',3)?GETPOST("versionto",'alpha',3):(empty($argv[2])?'':$argv[2]);
|
$versionto=GETPOST("versionto",'alpha',3)?GETPOST("versionto",'alpha',3):(empty($argv[2])?'':$argv[2]);
|
||||||
$setuplang=GETPOST('selectlang','aZ09',3)?GETPOST('selectlang','aZ09',3):(empty($argv[3])?'auto':$argv[3]);
|
$setuplang=GETPOST('selectlang','aZ09',3)?GETPOST('selectlang','aZ09',3):(empty($argv[3])?'auto':$argv[3]);
|
||||||
$langs->setDefaultLang($setuplang);
|
$langs->setDefaultLang($setuplang);
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):(empty($argv[4])?'auto':$argv[4]);
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):(empty($argv[4])?'':$argv[4]);
|
||||||
|
|
||||||
// Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install
|
// Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install
|
||||||
// or MAIN_VERSION_LAST_UPGRADE for upgrade.
|
// or MAIN_VERSION_LAST_UPGRADE for upgrade.
|
||||||
|
|||||||
@ -132,7 +132,7 @@ foreach($object->fields as $key => $val)
|
|||||||
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
@ -205,7 +205,6 @@ $help_url='';
|
|||||||
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("MyObjects"));
|
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("MyObjects"));
|
||||||
|
|
||||||
|
|
||||||
// TODO : move this SQL request into fetchAll class method
|
|
||||||
// Build and execute select
|
// Build and execute select
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
$sql = 'SELECT ';
|
$sql = 'SELECT ';
|
||||||
@ -222,8 +221,8 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object
|
|||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql=preg_replace('/, $/','', $sql);
|
$sql=preg_replace('/, $/','', $sql);
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."myobject_extrafields as ef on (t.rowid = ef.fk_object)";
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('myobject').")";
|
if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||||
else $sql.=" WHERE 1 = 1";
|
else $sql.=" WHERE 1 = 1";
|
||||||
foreach($search as $key => $val)
|
foreach($search as $key => $val)
|
||||||
{
|
{
|
||||||
@ -252,6 +251,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
|
$sql=preg_replace('/, $/','', $sql);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$sql.=$db->order($sortfield,$sortorder);
|
$sql.=$db->order($sortfield,$sortorder);
|
||||||
@ -272,7 +272,6 @@ if (($page * $limit) > $nbtotalofrecords)
|
|||||||
// if total resultset is smaller the limit, no need to do paging.
|
// if total resultset is smaller the limit, no need to do paging.
|
||||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||||
{
|
{
|
||||||
$resql = $result;
|
|
||||||
$num = $nbtotalofrecords;
|
$num = $nbtotalofrecords;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -440,9 +439,12 @@ print '</tr>'."\n";
|
|||||||
|
|
||||||
// Detect if we need a fetch on each output line
|
// Detect if we need a fetch on each output line
|
||||||
$needToFetchEachLine=0;
|
$needToFetchEachLine=0;
|
||||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
|
||||||
{
|
{
|
||||||
|
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
||||||
|
{
|
||||||
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1097,7 +1097,7 @@ else
|
|||||||
$parameters=array('cols' => 3);
|
$parameters=array('cols' => 3);
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit',$parameters);
|
print $object->showOptionals($extrafields,'edit',$parameters);
|
||||||
}
|
}
|
||||||
@ -1470,7 +1470,7 @@ else
|
|||||||
$parameters=array('colspan' => ' colspan="3"', 'cols'=>3);
|
$parameters=array('colspan' => ' colspan="3"', 'cols'=>3);
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,7 +157,7 @@ class PriceParser
|
|||||||
$extrafields = new ExtraFields($this->db);
|
$extrafields = new ExtraFields($this->db);
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('product', true);
|
$extralabels = $extrafields->fetch_name_optionals_label('product', true);
|
||||||
$product->fetch_optionals();
|
$product->fetch_optionals();
|
||||||
foreach ($extrafields->attribute_label as $key=>$label)
|
foreach ($extrafields->attributes[$product->table_element]['label'] as $key=>$label)
|
||||||
{
|
{
|
||||||
$values["extrafield_".$key] = $product->array_options['options_'.$key];
|
$values["extrafield_".$key] = $product->array_options['options_'.$key];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -629,7 +629,7 @@ if ($action == 'create' && $user->rights->projet->creer)
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -869,7 +869,7 @@ elseif ($object->id > 0)
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -418,7 +418,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields_task->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields_task,'edit');
|
print $object->showOptionals($extrafields_task,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -416,7 +416,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,7 +107,7 @@ if ($id > 0)
|
|||||||
print $form->showphoto('memberphoto', $object, 64);
|
print $form->showphoto('memberphoto', $object, 64);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
// foreach($objecto->attribute_label as $key=>$value){
|
// foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$value){
|
||||||
// print "<tr><td>$value</td><td>".$object->array_options["options_$key"]." </td></tr>\n";
|
// print "<tr><td>$value</td><td>".$object->array_options["options_$key"]." </td></tr>\n";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|||||||
@ -40,9 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticketsup.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/ticketsup.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/ticketsup.lib.php';
|
||||||
|
|
||||||
// Load traductions files requiredby by page
|
// Load traductions files requiredby by page
|
||||||
$langs->load("companies");
|
$langs->loadLangs(array("companies","other","ticketsup"));
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("ticketsup");
|
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$track_id = GETPOST('track_id', 'alpha');
|
$track_id = GETPOST('track_id', 'alpha');
|
||||||
@ -201,10 +199,10 @@ if ($action == "view_ticketlist") {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attribute_label as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
if ($extrafields->attribute_type[$key] != 'separate') {
|
if ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate') {
|
||||||
$arrayfields["ef." . $key] = array('label' => $extrafields->attribute_label[$key], 'checked' => $extrafields->attribute_list[$key], 'position' => $extrafields->attribute_pos[$key], 'enabled' => $extrafields->attribute_perms[$key]);
|
$arrayfields["ef." . $key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'checked' => $extrafields->attributes[$object->table_element]['list'][$key], 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], 'enabled' => $extrafields->attributes[$object->table_element]['perms'][$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,8 +295,9 @@ if ($action == "view_ticketlist") {
|
|||||||
$sql .= " t.tms,";
|
$sql .= " t.tms,";
|
||||||
$sql .= " type.label as type_label, category.label as category_label, severity.label as severity_label";
|
$sql .= " type.label as type_label, category.label as category_label, severity.label as severity_label";
|
||||||
// Add fields for extrafields
|
// Add fields for extrafields
|
||||||
foreach ($extrafields->attribute_list as $key => $val) {
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
$sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef." . $key . ' as options_' . $key : '');
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
|
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef." . $key . ' as options_' . $key : '');
|
||||||
}
|
}
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "ticketsup as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "ticketsup as t";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_ticketsup_type as type ON type.code=t.type_code";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_ticketsup_type as type ON type.code=t.type_code";
|
||||||
@ -310,7 +309,7 @@ if ($action == "view_ticketlist") {
|
|||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "element_contact as ec ON ec.element_id=t.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "element_contact as ec ON ec.element_id=t.rowid";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc ON ec.fk_c_type_contact=tc.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc ON ec.fk_c_type_contact=tc.rowid";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople sp ON ec.fk_socpeople=sp.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople sp ON ec.fk_socpeople=sp.rowid";
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "ticketsup_extrafields as ef on (t.rowid = ef.fk_object)";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "ticketsup_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
}
|
}
|
||||||
$sql .= " WHERE t.entity IN (" . getEntity('ticketsup') . ")";
|
$sql .= " WHERE t.entity IN (" . getEntity('ticketsup') . ")";
|
||||||
@ -408,8 +407,8 @@ if ($action == "view_ticketlist") {
|
|||||||
print_liste_field_titre($arrayfields['t.tms']['label'], $url_page_current, 't.tms', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['t.tms']['label'], $url_page_current, 't.tms', '', $param, '', $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attribute_label as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
if (!empty($arrayfields["ef." . $key]['checked'])) {
|
if (!empty($arrayfields["ef." . $key]['checked'])) {
|
||||||
$align = $extrafields->getAlignFlag($key);
|
$align = $extrafields->getAlignFlag($key);
|
||||||
print_liste_field_titre($extralabels[$key], $url_page_current, "ef." . $key, "", $param, ($align ? 'align="' . $align . '"' : ''), $sortfield, $sortorder);
|
print_liste_field_titre($extralabels[$key], $url_page_current, "ef." . $key, "", $param, ($align ? 'align="' . $align . '"' : ''), $sortfield, $sortorder);
|
||||||
@ -490,8 +489,8 @@ if ($action == "view_ticketlist") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attribute_label as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
if (!empty($arrayfields["ef." . $key]['checked'])) {
|
if (!empty($arrayfields["ef." . $key]['checked'])) {
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
@ -613,8 +612,8 @@ if ($action == "view_ticketlist") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attribute_label as $key => $val) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
if (!empty($arrayfields["ef." . $key]['checked'])) {
|
if (!empty($arrayfields["ef." . $key]['checked'])) {
|
||||||
print '<td';
|
print '<td';
|
||||||
$align = $extrafields->getAlignFlag($key);
|
$align = $extrafields->getAlignFlag($key);
|
||||||
|
|||||||
@ -285,7 +285,7 @@ if ($action == 'create' || $object->fetch($id) > 0)
|
|||||||
$parameters=array('objectsrc' => $objectsrc);
|
$parameters=array('objectsrc' => $objectsrc);
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1431,7 +1431,7 @@ else
|
|||||||
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -2018,7 +2018,7 @@ else
|
|||||||
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1151,7 +1151,7 @@ if ($action == 'create')
|
|||||||
$parameters = array('colspan' => ' colspan="3"');
|
$parameters = array('colspan' => ' colspan="3"');
|
||||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
if (empty($reshook)) {
|
||||||
print $object->showOptionals($extrafields, 'edit');
|
print $object->showOptionals($extrafields, 'edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -73,9 +73,6 @@ top_httphead('text/css');
|
|||||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||||
else header('Cache-Control: no-cache');
|
else header('Cache-Control: no-cache');
|
||||||
|
|
||||||
// On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1.
|
|
||||||
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); }
|
|
||||||
|
|
||||||
if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL
|
if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL
|
||||||
if (GETPOST('lang','aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
if (GETPOST('lang','aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
||||||
|
|
||||||
|
|||||||
@ -74,9 +74,6 @@ top_httphead('text/css');
|
|||||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||||
else header('Cache-Control: no-cache');
|
else header('Cache-Control: no-cache');
|
||||||
|
|
||||||
// On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1.
|
|
||||||
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); }
|
|
||||||
|
|
||||||
if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL
|
if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL
|
||||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
||||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||||
|
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -76,25 +77,38 @@ if ($id || $track_id || $ref) {
|
|||||||
// Security check
|
// Security check
|
||||||
$result = restrictedArea($user, 'ticketsup', $object->id);
|
$result = restrictedArea($user, 'ticketsup', $object->id);
|
||||||
|
|
||||||
|
$triggermodname = 'TICKETSUP_MODIFY';
|
||||||
|
$permissiontoadd = $user->rights->ticketsup->write;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$actionobject = new ActionsTicketsup($db);
|
$actionobject = new ActionsTicketsup($db);
|
||||||
$actionobject->doActions($action, $object);
|
$actionobject->doActions($action, $object);
|
||||||
|
|
||||||
if ($action == "update_extras" && $user->rights->ticketsup->write && !GETPOST('cancel','alpha'))
|
// Action to update one extrafield
|
||||||
|
if ($action == "update_extras" && ! empty($permissiontoadd))
|
||||||
{
|
{
|
||||||
$triggermodname = 'TICKETSUP_MODIFY';
|
$object->fetch(GETPOST('id','int'), '', GETPOST('track_id','alpha'));
|
||||||
|
|
||||||
$res = $object->fetch(GETPOST('id','int'), '', GETPOST('track_id','alpha'));
|
|
||||||
$attributekey = GETPOST('attribute','alpha');
|
$attributekey = GETPOST('attribute','alpha');
|
||||||
$attributekeylong = 'options_'.$attributekey;
|
$attributekeylong = 'options_'.$attributekey;
|
||||||
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong,' alpha');
|
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong,' alpha');
|
||||||
|
|
||||||
$result = $object->updateExtraField($attributekey, $triggermodname, $user);
|
$result = $object->insertExtraFields(empty($triggermodname)?'':$triggermodname, $user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
|
|||||||
@ -586,8 +586,8 @@ class Ticketsup extends CommonObject
|
|||||||
$sql .= " t.tms";
|
$sql .= " t.tms";
|
||||||
$sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label";
|
$sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label";
|
||||||
// Add fields for extrafields
|
// Add fields for extrafields
|
||||||
foreach ($extrafields->attribute_list as $key => $val) {
|
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
|
||||||
$sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef." . $key . ' as options_' . $key : '');
|
$sql .= ($extrafields->attributes[$this->table_element]['type'][$key] != 'separate' ? ",ef." . $key . ' as options_' . $key : '');
|
||||||
}
|
}
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "ticketsup as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "ticketsup as t";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_ticketsup_type as type ON type.code=t.type_code";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_ticketsup_type as type ON type.code=t.type_code";
|
||||||
@ -596,7 +596,7 @@ class Ticketsup extends CommonObject
|
|||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid=t.fk_soc";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid=t.fk_soc";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as uc ON uc.rowid=t.fk_user_create";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as uc ON uc.rowid=t.fk_user_create";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as ua ON ua.rowid=t.fk_user_assign";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as ua ON ua.rowid=t.fk_user_assign";
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label'])) {
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "ticketsup_extrafields as ef on (t.rowid = ef.fk_object)";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "ticketsup_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
}
|
}
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||||
@ -690,8 +690,8 @@ class Ticketsup extends CommonObject
|
|||||||
$line->date_close = $this->db->jdate($obj->date_close);
|
$line->date_close = $this->db->jdate($obj->date_close);
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
|
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label'])) {
|
||||||
foreach ($extrafields->attribute_label as $key => $val) {
|
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
|
||||||
$tmpkey = 'options_' . $key;
|
$tmpkey = 'options_' . $key;
|
||||||
$line->{$tmpkey} = $obj->$tmpkey;
|
$line->{$tmpkey} = $obj->$tmpkey;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,12 +36,26 @@ session_cache_limiter(FALSE);
|
|||||||
require_once '../../main.inc.php';
|
require_once '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
|
// Define css type
|
||||||
|
top_httphead('text/css');
|
||||||
|
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
|
||||||
|
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||||
|
else header('Cache-Control: no-cache');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
html {
|
html {
|
||||||
min-height: 100%; height: 100%;
|
min-height: 100%; height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
<?php
|
||||||
|
if (! empty($conf->global->TICKETS_SHOW_MODULE_LOGO)) {
|
||||||
|
print 'background: url("../public/img/bg_ticket.png") no-repeat 95% 90%;';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-size: 0.88em;
|
font-size: 0.88em;
|
||||||
background: none;
|
background: none;
|
||||||
|
|||||||
@ -105,11 +105,12 @@ foreach($object->fields as $key => $val)
|
|||||||
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
@ -202,7 +203,7 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object
|
|||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql=preg_replace('/, $/','', $sql);
|
$sql=preg_replace('/, $/','', $sql);
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."ticketsup_extrafields as ef on (t.rowid = ef.fk_object)";
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."ticketsup_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('ticketsup').")";
|
if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('ticketsup').")";
|
||||||
else $sql.=" WHERE 1 = 1";
|
else $sql.=" WHERE 1 = 1";
|
||||||
foreach($search as $key => $val)
|
foreach($search as $key => $val)
|
||||||
@ -231,18 +232,19 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object)
|
|||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
/* If a group by is required
|
/* If a group by is required
|
||||||
$sql.= " GROUP BY "
|
$sql.= " GROUP BY "
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
$sql.='t.'.$key.', ';
|
$sql.='t.'.$key.', ';
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
// Add where from hooks
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||||
$parameters=array();
|
// Add where from hooks
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
$parameters=array();
|
||||||
$sql.=$hookmanager->resPrint;
|
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
*/
|
$sql.=$hookmanager->resPrint;
|
||||||
|
*/
|
||||||
|
|
||||||
$sql.=$db->order($sortfield,$sortorder);
|
$sql.=$db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
@ -467,8 +469,8 @@ if ($search_fk_status == 'non_closed') {
|
|||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
/*$moreforfilter.='<div class="divsearchfield">';
|
/*$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||||
$moreforfilter.= '</div>';*/
|
$moreforfilter.= '</div>';*/
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
@ -535,7 +537,6 @@ print '<td class="liste_titre" align="right">';
|
|||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
@ -562,13 +563,12 @@ print '</tr>'."\n";
|
|||||||
|
|
||||||
// Detect if we need a fetch on each output line
|
// Detect if we need a fetch on each output line
|
||||||
$needToFetchEachLine=0;
|
$needToFetchEachLine=0;
|
||||||
foreach ($extrafields->attribute_computed as $key => $val)
|
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Loop on record
|
// Loop on record
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -672,8 +672,6 @@ print '</div>'."\n";
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||||
{
|
{
|
||||||
$hidegeneratedfilelistifempty=1;
|
$hidegeneratedfilelistifempty=1;
|
||||||
@ -694,5 +692,5 @@ if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nb
|
|||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter('');
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -1070,7 +1070,7 @@ if ($action == 'create' || $action == 'adduserldap')
|
|||||||
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
|
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -2322,7 +2322,7 @@ else
|
|||||||
$parameters=array('colspan' => ' colspan="2"');
|
$parameters=array('colspan' => ' colspan="2"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -304,7 +304,7 @@ if ($action == 'create')
|
|||||||
$parameters=array('object' => $object, 'colspan' => ' colspan="2"');
|
$parameters=array('object' => $object, 'colspan' => ' colspan="2"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
@ -570,7 +570,7 @@ else
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print $object->showOptionals($extrafields,'edit');
|
print $object->showOptionals($extrafields,'edit');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -216,7 +216,13 @@ class FactureTest extends PHPUnit_Framework_TestCase
|
|||||||
$newlocalobject=new Facture($this->savdb);
|
$newlocalobject=new Facture($this->savdb);
|
||||||
$newlocalobject->initAsSpecimen();
|
$newlocalobject->initAsSpecimen();
|
||||||
$this->changeProperties($newlocalobject);
|
$this->changeProperties($newlocalobject);
|
||||||
$this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('newref','oldref','id','lines','client','thirdparty','brouillon','user_author','date_creation','date_validation','datem','ref','statut','paye','specimen','facnumber','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement','cond_reglement_doc','situation_cycle_ref','situation_counter','situation_final','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','fk_multicurrency','multicurrency_code','multicurrency_tx')), array()); // Actual, Expected
|
|
||||||
|
// Hack to avoid test to be wrong when module sellyoursaas is on
|
||||||
|
unset($localobject->array_options['options_commission']);
|
||||||
|
unset($localobject->array_options['options_reseller']);
|
||||||
|
|
||||||
|
$arraywithdiff = $this->objCompare($localobject,$newlocalobject,true,array('newref','oldref','id','lines','client','thirdparty','brouillon','user_author','date_creation','date_validation','datem','ref','statut','paye','specimen','facnumber','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement','cond_reglement_doc','situation_cycle_ref','situation_counter','situation_final','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','fk_multicurrency','multicurrency_code','multicurrency_tx'));
|
||||||
|
$this->assertEquals($arraywithdiff, array()); // Actual, Expected
|
||||||
|
|
||||||
return $localobject;
|
return $localobject;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user