FIX Save of filters into export profiles failed.
This commit is contained in:
parent
f437bd2d6d
commit
c218843cdb
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -18,7 +19,6 @@
|
||||
* \file htdocs/core/boxes/box_task.php
|
||||
* \ingroup Projet
|
||||
* \brief Module to Task activity of the current year
|
||||
* \version $Id: box_task.php,v 1.1 2012/09/11 Charles-François BENKE
|
||||
*/
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php");
|
||||
@ -39,11 +39,11 @@ class box_task extends ModeleBoxes
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function box_task()
|
||||
{
|
||||
global $langs;
|
||||
@ -120,8 +120,7 @@ class box_task extends ModeleBoxes
|
||||
|
||||
|
||||
// Add the sum à the bottom of the boxes
|
||||
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead);
|
||||
$this->info_box_contents[$i][1] = array('td' => '', 'text' => "");
|
||||
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" colspan="2" ', 'text' => $langs->trans("Total")." ".$textHead);
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks"));
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5));
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5));
|
||||
|
||||
@ -400,7 +400,7 @@ class RssParser
|
||||
{
|
||||
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
|
||||
{
|
||||
$itemLink = (string) $item['link']['href'];
|
||||
$itemLink = (isset($item['link']['href']) ? (string) $item['link']['href'] : '');
|
||||
$itemTitle = (string) $item['title'];
|
||||
$itemDescription = (string) $item['summary'];
|
||||
$itemPubDate = (string) $item['created'];
|
||||
@ -409,7 +409,7 @@ class RssParser
|
||||
}
|
||||
else
|
||||
{
|
||||
$itemLink = (string) $item['link']['href'];
|
||||
$itemLink = (isset($item['link']['href']) ? (string) $item['link']['href'] : '');
|
||||
$itemTitle = (string) $item['title'];
|
||||
$itemDescription = (string) $item['summary'];
|
||||
$itemPubDate = (string) $item['created'];
|
||||
|
||||
@ -210,7 +210,7 @@ class modUser extends DolibarrModules
|
||||
$this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs';
|
||||
$this->export_permission[$r]=array(array("user","user","export"));
|
||||
$this->export_fields_array[$r]=array('u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.office_phone'=>'Phone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",'u.admin'=>"Administrator",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion','u.fk_socpeople'=>"IdContact",'u.fk_societe'=>"IdCompany",'u.fk_member'=>"MemberId");
|
||||
$this->export_TypeFields_array[$r]=array('u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.office_phone'=>'Text','u.office_fax'=>'Text','u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date','u.datepreviouslogin'=>'Date','u.fk_societe'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:nom");
|
||||
$this->export_TypeFields_array[$r]=array('u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.office_phone'=>'Text','u.office_fax'=>'Text','u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date','u.datepreviouslogin'=>'Date','u.fk_societe'=>"Text",'u.fk_member'=>"Text");
|
||||
|
||||
$this->export_entities_array[$r]=array('u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.office_phone'=>'user','u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_societe'=>"company",'u.fk_member'=>"member");
|
||||
if (empty($conf->adherent->enabled))
|
||||
|
||||
@ -46,7 +46,6 @@ class Export
|
||||
|
||||
// To store export modules
|
||||
var $hexa;
|
||||
var $hexafilter;
|
||||
var $hexafiltervalue;
|
||||
var $datatoexport;
|
||||
var $model_name;
|
||||
@ -627,9 +626,6 @@ class Export
|
||||
$this->db->begin();
|
||||
|
||||
$filter='';
|
||||
if (! empty($this->hexafilter) && ! empty($this->hexafiltervalue)) {
|
||||
$filter = json_encode(array('field' => $this->hexafilter, 'value' => $this->hexafiltervalue));
|
||||
}
|
||||
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'export_model (';
|
||||
$sql.= 'label,';
|
||||
@ -638,12 +634,12 @@ class Export
|
||||
$sql.= 'filter';
|
||||
$sql.= ') VALUES (';
|
||||
$sql.= "'".$this->db->escape($this->model_name)."',";
|
||||
$sql.= "'".$this->datatoexport."',";
|
||||
$sql.= "'".$this->hexa."',";
|
||||
$sql.= (! empty($filter)?"'".$filter."'":"null");
|
||||
$sql.= "'".$this->db->escape($this->datatoexport)."',";
|
||||
$sql.= "'".$this->db->escape($this->hexa)."',";
|
||||
$sql.= "'".$this->db->escape($this->hexafiltervalue)."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("Export::create", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -667,7 +663,7 @@ class Export
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = 'SELECT em.rowid, em.field, em.label, em.type, em.filter';
|
||||
$sql = 'SELECT em.rowid, em.label, em.type, em.field, em.filter';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'export_model as em';
|
||||
$sql.= ' WHERE em.rowid = '.$id;
|
||||
|
||||
@ -679,13 +675,11 @@ class Export
|
||||
if ($obj)
|
||||
{
|
||||
$this->id = $obj->rowid;
|
||||
$this->hexa = $obj->field;
|
||||
$this->model_name = $obj->label;
|
||||
$this->datatoexport = $obj->type;
|
||||
|
||||
$filter = json_decode($obj->filter, true);
|
||||
$this->hexafilter = (isset($filter['field'])?$filter['field']:'');
|
||||
$this->hexafiltervalue = (isset($filter['value'])?$filter['value']:'');
|
||||
|
||||
$this->hexa = $obj->field;
|
||||
$this->hexafiltervalue = $obj->filter;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ $entitytolang = array(
|
||||
);
|
||||
|
||||
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
|
||||
$array_filtervalue=isset($_SESSION["export_FilterValue_fields"])?$_SESSION["export_FilterValue_fields"]:array();
|
||||
$array_filtervalue=isset($_SESSION["export_filtered_fields"])?$_SESSION["export_filtered_fields"]:array();
|
||||
$datatoexport=GETPOST("datatoexport");
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
@ -222,7 +222,6 @@ if ($action=='downfield' || $action=='upfield')
|
||||
if ($step == 1 || $action == 'cleanselect')
|
||||
{
|
||||
$_SESSION["export_selected_fields"]=array();
|
||||
//$_SESSION["export_FilterValue_fields"]=array();
|
||||
$_SESSION["export_filtered_fields"]=array();
|
||||
$array_selected=array();
|
||||
$array_filtervalue=array();
|
||||
@ -280,12 +279,15 @@ if ($action == 'add_export_model')
|
||||
}
|
||||
|
||||
$hexafiltervalue='';
|
||||
foreach($array_filtervalue as $key=>$val)
|
||||
if (! empty($array_filtervalue) && is_array($array_filtervalue))
|
||||
{
|
||||
if ($hexafilter) $hexafiltervalue.=',';
|
||||
$hexafiltervalue.=$key.'='.$val;
|
||||
foreach($array_filtervalue as $key=>$val)
|
||||
{
|
||||
if ($hexafiltervalue) $hexafiltervalue.=',';
|
||||
$hexafiltervalue.=$key.'='.$val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$objexport->model_name = $export_name;
|
||||
$objexport->datatoexport = $datatoexport;
|
||||
$objexport->hexa = $hexa;
|
||||
@ -311,10 +313,11 @@ if ($action == 'add_export_model')
|
||||
}
|
||||
}
|
||||
|
||||
// Reload an predefined export model
|
||||
if ($step == 2 && $action == 'select_model')
|
||||
{
|
||||
$_SESSION["export_selected_fields"]=array();
|
||||
$_SESSION["export_FilterValue_fields"]=array();
|
||||
$_SESSION["export_filtered_fields"]=array();
|
||||
|
||||
$array_selected=array();
|
||||
$array_filtervalue=array();
|
||||
@ -331,16 +334,15 @@ if ($step == 2 && $action == 'select_model')
|
||||
}
|
||||
$_SESSION["export_selected_fields"]=$array_selected;
|
||||
|
||||
$fieldsarray=explode(',',$objexport->hexafilter);
|
||||
$fieldsarrayvalue=explode(',',$objexport->hexafiltervalue);
|
||||
$i=1;
|
||||
foreach($fieldsarray as $val)
|
||||
foreach($fieldsarrayvalue as $val)
|
||||
{
|
||||
$tmp=explode('=',$val);
|
||||
$array_filtervalue[$tmp[0]]=$tmp[1];
|
||||
$i++;
|
||||
}
|
||||
$_SESSION["export_FilterValue_fields"]=$array_filtervalue;
|
||||
$_SESSION["export_filtered_fields"]=$array_filtervalue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,7 +352,7 @@ if ($step == 4 && $action == 'submitFormField')
|
||||
// on boucle sur les champs selectionne pour recuperer la valeur
|
||||
if (is_array($objexport->array_export_TypeFields[0]))
|
||||
{
|
||||
$_SESSION["export_FilterValue_fields"]=array();
|
||||
$_SESSION["export_filtered_fields"]=array();
|
||||
//var_dump($_POST);
|
||||
foreach($objexport->array_export_TypeFields[0] as $code => $type) // $code: s.fieldname $value: Text|Boolean|List:ccc
|
||||
{
|
||||
@ -366,7 +368,7 @@ if ($step == 4 && $action == 'submitFormField')
|
||||
}
|
||||
}
|
||||
$array_filtervalue=(! empty($objexport->array_export_FilterValue[0])?$objexport->array_export_FilterValue[0]:'');
|
||||
$_SESSION["export_FilterValue_fields"]=$array_filtervalue;
|
||||
$_SESSION["export_filtered_fields"]=$array_filtervalue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user