Compare commits
8 Commits
SD-32
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
|
556b2e4c0d | ||
|
7bb27a363f | ||
|
70938275b8 | ||
|
ba4bc06720 | ||
|
d307db6b60 | ||
|
2d4ff1529a | ||
|
a8680bf0e0 | ||
|
a0fd8a9210 |
@ -146,7 +146,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
* @var string
|
||||
*/
|
||||
protected $_pendingDeletes = array();
|
||||
|
||||
|
||||
/**
|
||||
* Array of pending un links in format alias => keys to be executed after save
|
||||
*
|
||||
@ -254,7 +254,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
}
|
||||
|
||||
$repository = $this->_table->getRepository();
|
||||
|
||||
|
||||
// Fix for #1682 and #1841.
|
||||
// Doctrine_Table does not have the repository yet during dummy record creation.
|
||||
if ($repository) {
|
||||
@ -393,9 +393,9 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
$event = new Doctrine_Event($this, Doctrine_Event::RECORD_VALIDATE);
|
||||
$this->preValidate($event);
|
||||
$this->getTable()->getRecordListener()->preValidate($event);
|
||||
|
||||
|
||||
if ( ! $event->skipOperation) {
|
||||
|
||||
|
||||
$validator = new Doctrine_Validator();
|
||||
$validator->validateRecord($this);
|
||||
$this->validate();
|
||||
@ -547,7 +547,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
|
||||
/**
|
||||
* Empty template method to provide concrete Record classes with the possibility
|
||||
* to hook into the validation procedure. Useful for cleaning up data before
|
||||
* to hook into the validation procedure. Useful for cleaning up data before
|
||||
* validating it.
|
||||
*/
|
||||
public function preValidate($event)
|
||||
@ -581,14 +581,14 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Empty template method to provide Record classes with the ability to alter hydration
|
||||
* Empty template method to provide Record classes with the ability to alter hydration
|
||||
* before it runs
|
||||
*/
|
||||
public function preHydrate($event)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Empty template method to provide Record classes with the ability to alter hydration
|
||||
* Empty template method to provide Record classes with the ability to alter hydration
|
||||
* after it runs
|
||||
*/
|
||||
public function postHydrate($event)
|
||||
@ -627,7 +627,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
if ( ! $this->_errorStack) {
|
||||
$this->_errorStack = new Doctrine_Validator_ErrorStack(get_class($this));
|
||||
}
|
||||
|
||||
|
||||
return $this->_errorStack;
|
||||
}
|
||||
|
||||
@ -846,7 +846,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$event = new Doctrine_Event($this, Doctrine_Event::RECORD_UNSERIALIZE);
|
||||
|
||||
|
||||
$manager = Doctrine_Manager::getInstance();
|
||||
$connection = $manager->getConnectionForComponent(get_class($this));
|
||||
|
||||
@ -854,7 +854,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
self::$_index++;
|
||||
|
||||
$this->_table = $connection->getTable(get_class($this));
|
||||
|
||||
|
||||
$this->preUnserialize($event);
|
||||
$this->getTable()->getRecordListener()->preUnserialize($event);
|
||||
|
||||
@ -904,7 +904,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
if ($state == null) {
|
||||
return $this->_state;
|
||||
}
|
||||
|
||||
|
||||
$err = false;
|
||||
if (is_integer($state)) {
|
||||
if ($state >= 1 && $state <= 7) {
|
||||
@ -1079,37 +1079,37 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
// only load the data from database if the Doctrine_Record is in proxy state
|
||||
if ($this->_state == Doctrine_Record::STATE_PROXY) {
|
||||
$id = $this->identifier();
|
||||
|
||||
|
||||
if ( ! is_array($id)) {
|
||||
$id = array($id);
|
||||
}
|
||||
|
||||
|
||||
if (empty($id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = empty($data) ? $this->getTable()->find($id, Doctrine::HYDRATE_ARRAY) : $data;
|
||||
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if ( ! isset($this->_data[$field]) || $this->_data[$field] === self::$_null) {
|
||||
// Ticket #2031: null value was causing removal of field during load
|
||||
if ($value === null) {
|
||||
$value = self::$_null;
|
||||
if ($value === null) {
|
||||
$value = self::$_null;
|
||||
}
|
||||
|
||||
$this->_data[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($this->isModified()) {
|
||||
$this->_state = Doctrine_Record::STATE_DIRTY;
|
||||
} else if (count($data) >= $this->_table->getColumnCount()) {
|
||||
$this->_state = Doctrine_Record::STATE_CLEAN;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1117,8 +1117,8 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
* sets a fieldname to have a custom accessor or check if a field has a custom
|
||||
* accessor defined (when called without $accessor parameter).
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $accessor
|
||||
* @param string $fieldName
|
||||
* @param string $accessor
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasAccessor($fieldName, $accessor = null)
|
||||
@ -1134,7 +1134,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
/**
|
||||
* clears the accessor for a field name
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $fieldName
|
||||
* @return void
|
||||
*/
|
||||
public function clearAccessor($fieldName)
|
||||
@ -1146,7 +1146,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
/**
|
||||
* gets the custom accessor for a field name
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $fieldName
|
||||
* @return string $accessor
|
||||
*/
|
||||
public function getAccessor($fieldName)
|
||||
@ -1172,8 +1172,8 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
* sets a fieldname to have a custom mutator or check if a field has a custom
|
||||
* mutator defined (when called without the $mutator parameter)
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $mutator
|
||||
* @param string $fieldName
|
||||
* @param string $mutator
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasMutator($fieldName, $mutator = null)
|
||||
@ -1189,7 +1189,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
/**
|
||||
* gets the custom mutator for a field name
|
||||
*
|
||||
* @param string $fieldname
|
||||
* @param string $fieldname
|
||||
* @return string
|
||||
*/
|
||||
public function getMutator($fieldName)
|
||||
@ -1203,7 +1203,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
/**
|
||||
* clears the custom mutator for a field name
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $fieldName
|
||||
* @return void
|
||||
*/
|
||||
public function clearMutator($fieldName)
|
||||
@ -1249,7 +1249,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
if ($this->_table->getAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE) || $this->hasAccessor($fieldName)) {
|
||||
$componentName = $this->_table->getComponentName();
|
||||
|
||||
$accessor = $this->hasAccessor($fieldName)
|
||||
$accessor = $this->hasAccessor($fieldName)
|
||||
? $this->getAccessor($fieldName)
|
||||
: 'get' . Doctrine_Inflector::classify($fieldName);
|
||||
|
||||
@ -1280,10 +1280,10 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
} else {
|
||||
$value = $this->_data[$fieldName];
|
||||
}
|
||||
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
if ( ! isset($this->_references[$fieldName]) && $load) {
|
||||
$rel = $this->_table->getRelation($fieldName);
|
||||
@ -1371,10 +1371,10 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
} else {
|
||||
$old = $this->_data[$fieldName];
|
||||
}
|
||||
|
||||
|
||||
if ($this->_isValueModified($type, $old, $value)) {
|
||||
if ($value === null) {
|
||||
$default = $this->_table->getDefaultValueOf($fieldName);
|
||||
$default = $this->_table->getDefaultValueOf($fieldName);
|
||||
$value = ($default === null) ? self::$_null : $default;
|
||||
}
|
||||
$this->_data[$fieldName] = $value;
|
||||
@ -1450,7 +1450,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
/**
|
||||
* Places a related component in the object graph.
|
||||
*
|
||||
* This method inserts a related component instance in this record
|
||||
* This method inserts a related component instance in this record
|
||||
* relations, populating the foreign keys accordingly.
|
||||
*
|
||||
* @param string $name related component alias in the relation
|
||||
@ -1460,11 +1460,11 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
public function coreSetRelated($name, $value)
|
||||
{
|
||||
$rel = $this->_table->getRelation($name);
|
||||
|
||||
|
||||
if ($value === null) {
|
||||
$value = self::$_null;
|
||||
}
|
||||
|
||||
|
||||
// one-to-many or one-to-one relation
|
||||
if ($rel instanceof Doctrine_Relation_ForeignKey || $rel instanceof Doctrine_Relation_LocalKey) {
|
||||
if ( ! $rel->isOneToOne()) {
|
||||
@ -1665,7 +1665,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
|
||||
/**
|
||||
* retrieves an array of modified fields and associated new values.
|
||||
*
|
||||
*
|
||||
* @param boolean $old pick the old values (instead of the new ones)
|
||||
* @param boolean $last pick only lastModified values (@see getLastModified())
|
||||
* @return array $a
|
||||
@ -1677,8 +1677,8 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
$modified = $last ? $this->_lastModified:$this->_modified;
|
||||
foreach ($modified as $fieldName) {
|
||||
if ($old) {
|
||||
$a[$fieldName] = isset($this->_oldValues[$fieldName])
|
||||
? $this->_oldValues[$fieldName]
|
||||
$a[$fieldName] = isset($this->_oldValues[$fieldName])
|
||||
? $this->_oldValues[$fieldName]
|
||||
: $this->getTable()->getDefaultValueOf($fieldName);
|
||||
} else {
|
||||
$a[$fieldName] = $this->_data[$fieldName];
|
||||
@ -1702,7 +1702,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
* Retrieves data prepared for a sql transaction.
|
||||
*
|
||||
* Returns an array of modified fields and values with data preparation;
|
||||
* adds column aggregation inheritance and converts Records into primary
|
||||
* adds column aggregation inheritance and converts Records into primary
|
||||
* key values.
|
||||
*
|
||||
* @param array $array
|
||||
@ -1789,10 +1789,10 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
if ($this->_state == self::STATE_LOCKED || $this->_state == self::STATE_TLOCKED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$stateBeforeLock = $this->_state;
|
||||
$this->_state = $this->exists() ? self::STATE_LOCKED : self::STATE_TLOCKED;
|
||||
|
||||
|
||||
$a = array();
|
||||
|
||||
foreach ($this as $column => $value) {
|
||||
@ -1950,7 +1950,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
// Eliminate relationships missing in the $array
|
||||
foreach ($this->_references as $name => $relation) {
|
||||
$rel = $this->getTable()->getRelation($name);
|
||||
|
||||
|
||||
if ( ! isset($array[$name]) && ( ! $rel->isOneToOne() || ! isset($array[$rel->getLocalFieldName()]))) {
|
||||
unset($this->$name);
|
||||
}
|
||||
@ -2330,7 +2330,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
// fix for #1622
|
||||
if ( ! isset($this->_references[$alias]) && $this->hasRelation($alias)) {
|
||||
$this->loadReference($alias);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->_references[$alias])) {
|
||||
foreach ($this->_references[$alias] as $k => $record) {
|
||||
@ -2497,8 +2497,8 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the modified array and store the old array in lastModified so it
|
||||
* can be accessed by users after saving a record, since the modified array
|
||||
* Reset the modified array and store the old array in lastModified so it
|
||||
* can be accessed by users after saving a record, since the modified array
|
||||
* is reset after the object is saved.
|
||||
*
|
||||
* @return void
|
||||
@ -2551,7 +2551,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
{
|
||||
$this->getNode()->delete();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helps freeing the memory occupied by the entity.
|
||||
* Cuts all references the entity has to other entities and removes the entity
|
||||
|
@ -31,7 +31,7 @@
|
||||
* @since 1.0
|
||||
* @todo Composite key support?
|
||||
*/
|
||||
class Doctrine_Relation_Parser
|
||||
class Doctrine_Relation_Parser
|
||||
{
|
||||
/**
|
||||
* @var Doctrine_Table $_table the table object this parser belongs to
|
||||
@ -53,7 +53,7 @@ class Doctrine_Relation_Parser
|
||||
*
|
||||
* @param Doctrine_Table $table the table object this parser belongs to
|
||||
*/
|
||||
public function __construct(Doctrine_Table $table)
|
||||
public function __construct(Doctrine_Table $table)
|
||||
{
|
||||
$this->_table = $table;
|
||||
}
|
||||
@ -73,12 +73,12 @@ class Doctrine_Relation_Parser
|
||||
*
|
||||
* @return array an array defining a pending relation
|
||||
*/
|
||||
public function getPendingRelation($name)
|
||||
public function getPendingRelation($name)
|
||||
{
|
||||
if ( ! isset($this->_pending[$name])) {
|
||||
throw new Doctrine_Relation_Exception('Unknown pending relation ' . $name);
|
||||
}
|
||||
|
||||
|
||||
return $this->_pending[$name];
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ class Doctrine_Relation_Parser
|
||||
*
|
||||
* @return array an array containing all the pending relations
|
||||
*/
|
||||
public function getPendingRelations()
|
||||
public function getPendingRelations()
|
||||
{
|
||||
return $this->_pending;
|
||||
}
|
||||
@ -98,7 +98,7 @@ class Doctrine_Relation_Parser
|
||||
*
|
||||
* @param string relation to remove
|
||||
*/
|
||||
public function unsetPendingRelations($name)
|
||||
public function unsetPendingRelations($name)
|
||||
{
|
||||
unset($this->_pending[$name]);
|
||||
}
|
||||
@ -106,7 +106,7 @@ class Doctrine_Relation_Parser
|
||||
/**
|
||||
* Check if a relation alias exists
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @return boolean $bool
|
||||
*/
|
||||
public function hasRelation($name)
|
||||
@ -114,7 +114,7 @@ class Doctrine_Relation_Parser
|
||||
if ( ! isset($this->_pending[$name]) && ! isset($this->_relations[$name])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -141,7 +141,9 @@ class Doctrine_Relation_Parser
|
||||
unset($this->_pending[$alias]);
|
||||
}
|
||||
|
||||
$this->_pending[$alias] = array_merge($options, array('class' => $name, 'alias' => $alias));
|
||||
$this->_pending[$alias] = array_merge($options,
|
||||
array('class' => $name,
|
||||
'alias' => $alias));
|
||||
|
||||
return $this->_pending[$alias];
|
||||
}
|
||||
|
@ -1,46 +1,44 @@
|
||||
<?php
|
||||
$file = $_REQUEST['q'];
|
||||
$type = $_REQUEST['type'];
|
||||
if(!empty($type)){
|
||||
switch($type){
|
||||
case 'pdf':
|
||||
$content_type = 'application/pdf';
|
||||
$path = PATH_DATA.'/pdf/';
|
||||
break;
|
||||
case 'logos':
|
||||
$explode = explode('.', $file);
|
||||
switch($explode[1]){
|
||||
case 'png': $content_type = 'image/png'; break;
|
||||
case 'gif': $content_type = 'image/gif'; break;
|
||||
case 'jpeg':
|
||||
case 'jpg': $content_type = 'image/jpeg'; break;
|
||||
}
|
||||
$path = PATH_DATA.'/logos/';
|
||||
break;
|
||||
case 'conso':
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
$path = PATH_DATA.'/conso/';
|
||||
break;
|
||||
case 'surveillance':
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
$path = PATH_DATA.'/surveillance/';
|
||||
break;
|
||||
default: exit; break;
|
||||
}
|
||||
}else{
|
||||
$path = PATH_DATA.'/';
|
||||
if (empty($type) == false) {
|
||||
switch ($type) {
|
||||
case 'pdf':
|
||||
$content_type = 'application/pdf';
|
||||
break;
|
||||
case 'logos':
|
||||
$explode = explode('.', $file);
|
||||
switch ($explode[1]) {
|
||||
case 'png' : $content_type = 'image/png'; break;
|
||||
case 'gif' : $content_type = 'image/gif'; break;
|
||||
case 'jpeg':
|
||||
case 'jpg' : $content_type = 'image/jpeg'; break;
|
||||
}
|
||||
break;
|
||||
case 'consommation':
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
break;
|
||||
case 'surveillance':
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
break;
|
||||
default:
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
$path = PATH_DATA.'/'.$type.'/';
|
||||
} else {
|
||||
$path = PATH_DATA.'/';
|
||||
}
|
||||
$firephp->log($path.$file, 'path');
|
||||
if(file_exists($path.$file))
|
||||
{
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: '.$content_type.'');
|
||||
header('Content-Length: '.filesize($path.$file));
|
||||
header('Content-MD5: '.base64_encode(md5_file($path.$file)));
|
||||
header('Content-Disposition: filename="'.basename($path.$file).'"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression','0');
|
||||
echo file_get_contents($path.$file);
|
||||
if (file_exists($path.$file)) {
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: '.$content_type.'');
|
||||
header('Content-Length: '.filesize($path.$file));
|
||||
header('Content-MD5: '.base64_encode(md5_file($path.$file)));
|
||||
header('Content-Disposition: filename="'.basename($path.$file).'"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression', '0');
|
||||
echo file_get_contents($path.$file);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -19,9 +19,13 @@ $tabScripts = array(
|
||||
'pages' => array('ratios', 'rsynthese'),
|
||||
),
|
||||
'scripts_surveillance' => array(
|
||||
'list' => array('jquery.tablesorter.js', 'surveillance.js'),
|
||||
'list' => array('jquery.tablesorter.js', 'telechargement.js'),
|
||||
'pages' => array('surveillance'),
|
||||
),
|
||||
'scripts_telechargement' => array(
|
||||
'list' => array('telechargement.js'),
|
||||
'pages' => array('moncompte', 'administration'),
|
||||
),
|
||||
'scripts_portefeuille' => array(
|
||||
'list' => array('jquery.qtip.js', 'jquery.tablesorter.js'),
|
||||
'pages' => array('portefeuille'),
|
||||
|
@ -1,61 +0,0 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("select[name=type]").change(function(){
|
||||
var value = $(this).val();
|
||||
if (value == '-'){
|
||||
$(location).attr('href','./?page=surveillance');
|
||||
}else{
|
||||
$(location).attr('href','./?page=surveillance&vue=source&source='+value+'');
|
||||
}
|
||||
});
|
||||
|
||||
//Récupération du fichier de surveillance
|
||||
var holdTheInterval;
|
||||
var nbEssai = 25;
|
||||
var essai = 0;
|
||||
var login;
|
||||
var date;
|
||||
var url = '';
|
||||
var source = '-';
|
||||
|
||||
//$.ajaxSetup({timeout: 4001});
|
||||
|
||||
$('#getSurveillanceCsv').click(function()
|
||||
{
|
||||
//On disable tout les champs
|
||||
$('select[name=source]').attr('disabled', true);
|
||||
//Valeur
|
||||
source = $('select[name=source]').val();
|
||||
checkFile();
|
||||
holdTheInterval = setInterval(checkFile, 4000);
|
||||
});
|
||||
|
||||
function checkFile()
|
||||
{
|
||||
essai++;
|
||||
if(essai>nbEssai){
|
||||
essai = 0;
|
||||
updateInfo('Le temps maximum d\'attente a été atteint. Merci de rééssayez.');
|
||||
}else{
|
||||
$('#getSurveillanceMsg').text('Patientez pendant la construction du fichier ('+essai+')...');
|
||||
$.post( 'pages/ajax/surveillance.php', { source: source, url: url, start: essai},
|
||||
function (data, textStatus){
|
||||
if( data!='' && data!='FALSE' ){
|
||||
if(essai==1) {
|
||||
url = data;
|
||||
if(url ==''){updateInfo('Erreur');}
|
||||
}
|
||||
else updateInfo(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateInfo(data)
|
||||
{
|
||||
$('#getSurveillanceMsg').html(data);
|
||||
clearInterval(holdTheInterval);
|
||||
$('select[name=source]').removeAttr('disabled');
|
||||
essai = 0;
|
||||
}
|
||||
});
|
89
www/js/telechargement.js
Normal file
89
www/js/telechargement.js
Normal file
@ -0,0 +1,89 @@
|
||||
// --------------------------------------------------------------------------- //
|
||||
// telechargement.js
|
||||
// --------------------------------------------------------------------------- //
|
||||
$(document).ready(
|
||||
function() {
|
||||
// Récupération du fichier de surveillance
|
||||
var holdTheInterval;
|
||||
var nbEssai = 25;
|
||||
var essai = 0;
|
||||
var url = '';
|
||||
var menuD;
|
||||
var caseC;
|
||||
var caseC2;
|
||||
var page;
|
||||
var argv;
|
||||
|
||||
$('#telechargementjs').click(
|
||||
function() {
|
||||
if ($('select[name=telechargementjsMenu]').val() == 'invalide') {
|
||||
$('#telechargementjsMsg').
|
||||
html('Vous devez sélectionner une période.');
|
||||
return;
|
||||
}
|
||||
// On disable tout les champs
|
||||
$('select[name=telechargementjsMenu]').attr('disabled', true);
|
||||
$( 'input[name=telechargementjsCase]:checkbox').
|
||||
attr('disabled', true);
|
||||
$( 'input[name=telechargementjsCase2]:checkbox').
|
||||
attr('disabled', true);
|
||||
// Valeur
|
||||
menuD = $('select[name=telechargementjsMenu]').val();
|
||||
caseC = $( 'input[name=telechargementjsCase]').
|
||||
attr('checked') ? true : false;
|
||||
caseC2 = $( 'input[name=telechargementjsCase2]').
|
||||
attr('checked') ? true : false;
|
||||
page = $( 'input[name=page]').val();
|
||||
argv = $( 'input[name=argv]').val();
|
||||
checkFile();
|
||||
holdTheInterval = setInterval(checkFile, 4000);
|
||||
}
|
||||
);
|
||||
|
||||
function checkFile() {
|
||||
essai++;
|
||||
if (essai > nbEssai) {
|
||||
essai = 0;
|
||||
updateInfo('Le temps maximum d\'attente a été atteint.' +
|
||||
' Merci de réessayez.');
|
||||
$('select[name=telechargementjsMenu]').removeAttr('disabled');
|
||||
$( 'input[name=telechargementjsCase]:checkbox').
|
||||
removeAttr('disabled');
|
||||
$( 'input[name=telechargementjsCase2]:checkbox').
|
||||
removeAttr('disabled');
|
||||
} else {
|
||||
$('#telechargementjsMsg').
|
||||
text('Patientez pendant la construction du fichier (' +
|
||||
essai + ')...');
|
||||
$.post('pages/ajax/telechargement.php',
|
||||
{ menuD: menuD, caseC: caseC, caseC2: caseC2,
|
||||
url: url, start: essai, page: page, argv: argv },
|
||||
function (data, textStatus) {
|
||||
if (data != '' &&
|
||||
data != 'FALSE') {
|
||||
if (essai == 1) {
|
||||
url = data;
|
||||
if (url == '') {
|
||||
updateInfo('Erreur');
|
||||
}
|
||||
} else {
|
||||
updateInfo(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function updateInfo(data) {
|
||||
$('#telechargementjsMsg').html(data);
|
||||
clearInterval(holdTheInterval);
|
||||
$('select[name=telechargementjsMenu]').removeAttr('disabled');
|
||||
$( 'input[name=telechargementjsCase]:checkbox').
|
||||
removeAttr('disabled');
|
||||
$( 'input[name=telechargementjsCase2]:checkbox').
|
||||
removeAttr('disabled');
|
||||
essai = 0;
|
||||
}
|
||||
}
|
||||
);
|
@ -49,122 +49,91 @@ try {
|
||||
die();
|
||||
}
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
#utilisateur { border-collapse:collapse; margin:0 5px;}
|
||||
#utilisateur tr.titre td { background-color: #D9EEF1; font-weight:bold; }
|
||||
#utilisateur tr.border td { border:1px dashed #939393; padding:5px; margin:0;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
var holdTheInterval;
|
||||
var nbEssai = 25;
|
||||
var essai = 0;
|
||||
var login;
|
||||
var date;
|
||||
var url;
|
||||
var details = false;
|
||||
var all = false;
|
||||
var dl = false;
|
||||
|
||||
//$.ajaxSetup({timeout: 4001});
|
||||
|
||||
$('#submitmois').click(function()
|
||||
{
|
||||
//On disable tout les champs
|
||||
$('input[name=details]:checkbox').attr('disabled', true);
|
||||
$('select[name=mois]').attr('disabled', true);
|
||||
$('input[name=all]:checkbox').attr('disabled', true);
|
||||
//Valeur de la date
|
||||
date = $('select[name=mois]').val();
|
||||
//Vérification
|
||||
if(date!='' && date!='-'){
|
||||
login = $('input[name=utilisateur]').val();
|
||||
details = $('input[name=details]').attr('checked') ? true : false ;
|
||||
all = $('input[name=all]').attr('checked') ? true : false ;
|
||||
checkFile();
|
||||
holdTheInterval = setInterval(checkFile, 4000);
|
||||
}
|
||||
});
|
||||
|
||||
$('input[name=details]:checkbox').click(function()
|
||||
{
|
||||
if( $('input[name=all]:checkbox').attr('checked') && $('input[name=details]:checkbox').attr('checked') ){
|
||||
var ok = confirm('Le Détail et l\'option Tous les clients ont été selectionnées, le téléchargement risque d\'être long. Voulez-vous continuez ?');
|
||||
if(!ok){ $('input[name=details]:checkbox').attr('checked', false); }
|
||||
}
|
||||
})
|
||||
|
||||
function checkFile()
|
||||
{
|
||||
essai++;
|
||||
if(essai>nbEssai){
|
||||
essai = 0;
|
||||
updateInfo('Le temps maximum d\'attente a été atteint. Merci de rééssayez.');
|
||||
$('input[name=details]:checkbox').removeAttr('disabled');
|
||||
$('select[name=mois]').removeAttr('disabled');
|
||||
$('input[name=all]:checkbox').removeAttr('disabled');
|
||||
}else if(essai==1){
|
||||
$('#message').text('Patientez pendant la construction du fichier ('+essai+')...');
|
||||
$.post( 'pages/ajax/conso.php',
|
||||
{ login: login, date: date, details: details, all: all, start: essai},
|
||||
function (data, textStatus) { url = data; }
|
||||
);
|
||||
}else{
|
||||
$('#message').text('Patientez pendant la construction du fichier ('+essai+')...');
|
||||
$.post( 'pages/ajax/conso.php',
|
||||
{ login: login, date: date, details: details, all: all, start: essai, url: url},
|
||||
function (data, textStatus) { if( data!='' && data!='FALSE' ){ updateInfo(data); } });
|
||||
}
|
||||
}
|
||||
|
||||
function updateInfo(data)
|
||||
{
|
||||
$('#message').html(data);
|
||||
clearInterval(holdTheInterval);
|
||||
$('input[name=details]:checkbox').removeAttr('disabled');
|
||||
$('select[name=mois]').removeAttr('disabled');
|
||||
$('input[name=all]:checkbox').removeAttr('disabled');
|
||||
essai = 0;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div id="center">
|
||||
<h1>ADMINISTRATION</h1>
|
||||
|
||||
<?php
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Relevé de consommation complet
|
||||
// --------------------------------------------------------------------------- //
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(
|
||||
function() {
|
||||
$('input[name=telechargementjsCase]:checkbox').click(
|
||||
function() {
|
||||
if ($('input[name=telechargementjsCase]:checkbox').
|
||||
attr('checked') &&
|
||||
$('input[name=telechargementjsCase2]:checkbox').
|
||||
attr('checked')) {
|
||||
var ok =
|
||||
confirm('Le Détail et l\'option Tous les clients' +
|
||||
' ont été selectionnées, le téléchargement' +
|
||||
' risque d\'être long. Voulez-vous continuez ?');
|
||||
if (!ok) {
|
||||
$('input[name=telechargementjsCase]:checkbox').
|
||||
attr('checked', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
$('input[name=telechargementjsCase2]:checkbox').click(
|
||||
function() {
|
||||
if ($('input[name=telechargementjsCase]:checkbox').
|
||||
attr('checked') &&
|
||||
$('input[name=telechargementjsCase2]:checkbox').
|
||||
attr('checked')) {
|
||||
var ok =
|
||||
confirm('Le Détail et l\'option Tous les clients' +
|
||||
' ont été selectionnées, le téléchargement' +
|
||||
' risque d\'être long. Voulez-vous continuez ?');
|
||||
if (!ok) {
|
||||
$('input[name=telechargementjsCase2]:checkbox').
|
||||
attr('checked', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
</script>
|
||||
<h2>Relevé de consommation complet</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td>
|
||||
<input type="hidden" name="utilisateur" value=""/>
|
||||
<?php
|
||||
if($_SESSION['tabInfo']['profil']=='SuperAdministrateur')
|
||||
{
|
||||
?>
|
||||
<label title="Renvoi les logs de tous les clients. Avec le détails le téléchargement peut être long.">Tous les clients</label><input type="checkbox" name="all" value="1"/>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<label>Détails</label><input type="checkbox" name="details" value="1"/>
|
||||
<label>Sélectionnez le mois :</label>
|
||||
<select name="mois">
|
||||
<option value="-">-</option>
|
||||
<?php
|
||||
for($i=1; $i<=12; $i++ ){
|
||||
$date =
|
||||
date('m', mktime(0, 0, 0, date('m')-$i, 1, date('Y'))).'/'.
|
||||
date('Y', mktime(0, 0, 0, date('m')-$i, 1, date('Y')));
|
||||
print '<option value="'.$date.'">'.$date.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<a href="#" id="submitmois">Ok</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td width="30"> </td><td><div id="message"></div></td></tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
if ($_SESSION['tabInfo']['profil'] == 'SuperAdministrateur') {
|
||||
print '<label title="Renvoi les logs de tous les clients.'.
|
||||
' Avec le détails le téléchargement peut être long.">'.
|
||||
'Tous les clients</label>';
|
||||
print '<input type="checkbox" name="telechargementjsCase2" value="1"/>';
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="page" value="<?print $page; ?>"/>
|
||||
<label>Détails</label>
|
||||
<input type="checkbox" name="telechargementjsCase" value="1" class="noborder"/>
|
||||
<select name="telechargementjsMenu">
|
||||
<option value="invalide">Mois/Année</option>
|
||||
<?php
|
||||
for ($i = 1; $i <= 12; ++$i) {
|
||||
$date = date('m', mktime(0, 0, 0, date('m') - $i, 1, date('Y'))).'/'.
|
||||
date('Y', mktime(0, 0, 0, date('m') - $i, 1, date('Y')));
|
||||
print '<option value="'.$date.'">'.$date.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<a href="#" id="telechargementjs">Ok</a>
|
||||
<div id="telechargementjsMsg" class="infoData last"></div>
|
||||
|
||||
<?php
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Liste des profils utilisateurs
|
||||
// --------------------------------------------------------------------------- //
|
||||
?>
|
||||
<h2>Liste des profils utilisateurs</h2>
|
||||
<table id="utilisateur" >
|
||||
<?php
|
||||
|
@ -1,78 +0,0 @@
|
||||
<?php
|
||||
require_once 'common/curl.php';
|
||||
|
||||
isset($_REQUEST['start']) ? $start=$_REQUEST['start'] : $start=0;
|
||||
isset($_REQUEST['url']) ? $url=$_REQUEST['url'] : $url='';
|
||||
isset($_REQUEST['source']) && $_REQUEST['source']!='-' ? $source=$_REQUEST['source'] : $source='';
|
||||
$path = PATH_DATA.'/surveillance/';
|
||||
|
||||
//Debug
|
||||
|
||||
$return = '';
|
||||
|
||||
//Connection au webservice
|
||||
$client = new SoapClient(null, array( 'trace' => 1,
|
||||
'soap_version' => SOAP_1_1,
|
||||
'location' => 'http://78.31.45.206/ws2/',
|
||||
'uri' => 'http://78.31.45.206/',
|
||||
'login' => $_SESSION['tabInfo']['login'],
|
||||
'password' => $_SESSION['tabInfo']['password'],
|
||||
));
|
||||
|
||||
//Recuperation de l'url pour le telechargement du fichier
|
||||
if($start==1){
|
||||
$firephp->log($source, 'source');
|
||||
try {
|
||||
$O = $client->getListeSurveillancesCsv($source, $_SESSION['tabInfo']['login']);
|
||||
$surveillances = $O['result'];
|
||||
$url = $surveillances['Url'];
|
||||
$firephp->log($url, 'URL');
|
||||
$return = $url;
|
||||
} catch (SoapFault $fault) {
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
$firephp->log($url, 'url');
|
||||
//Recuperation du nom du fichier
|
||||
$tableau = explode('/',$url);
|
||||
$file = $tableau[sizeof($tableau)-1];
|
||||
|
||||
//Suppression du fichier si le temps de cache est depasse
|
||||
if( file_exists($path.$file) && filemtime($path.$file) > mktime(date("H")+1, date("i"), date("s"), date("m"), date("d"), date("Y")) )
|
||||
{
|
||||
unlink($path.$file);
|
||||
}
|
||||
|
||||
//Recuperation du fichier sur le serveur
|
||||
if ( !file_exists($path.$file))
|
||||
{
|
||||
$firephp->info('Demarage recuperation du fichier');
|
||||
//On check si le fichier est present sur l'url
|
||||
(isset($_REQUEST['url']) && url!='')? $url=$_REQUEST['url']: '';
|
||||
$page = getUrl($url, '', '', '', false);
|
||||
//Fichier non disponible
|
||||
if($page['code']==408 || $page['code']==400 || $page['code']==404){
|
||||
$return = 'FALSE';
|
||||
//Ecriture du fichier sur le serveur en local
|
||||
}else{
|
||||
if(!file_exists($path)) mkdir($path);
|
||||
$body = $page['body'];
|
||||
$fp = fopen($path.$file, 'w');
|
||||
fwrite($fp, $body);
|
||||
fclose($fp);
|
||||
$return = 'FALSE';
|
||||
}
|
||||
}
|
||||
|
||||
//Le fichier existe sur l'extranet, etc....
|
||||
if (file_exists($path.$file) && filesize($path.$file)>0)
|
||||
{
|
||||
$firephp->info('Fichier sur le serveur local');
|
||||
$return = '<u><a title="Télécharger le fichier" target="_blank" href="/datafile.php?q='.$file.'&type=surveillance">Cliquez-ici pour télécharger le fichier.</a></u>';
|
||||
}elseif (file_exists($path.$file) && filesize($path.$file)==0){
|
||||
$return = 'Aucune surveillance enregistrée.';
|
||||
}
|
||||
}
|
||||
echo $return;
|
139
www/pages/ajax/telechargement.php
Normal file
139
www/pages/ajax/telechargement.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
// --------------------------------------------------------------------------- //
|
||||
// telechargement.php
|
||||
// --------------------------------------------------------------------------- //
|
||||
$page = $_POST['page' ];
|
||||
if ($page == 'moncompte' ||
|
||||
$page == 'administration') {
|
||||
$page = 'consommation';
|
||||
}
|
||||
$start = $_POST['start'];
|
||||
$return = '';
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Parametres supplementaires
|
||||
// --------------------------------------------------------------------------- //
|
||||
if (isset($_POST['argv']) == true) {
|
||||
$firephp->log("argv='$_POST[argv]'");
|
||||
}
|
||||
$idClient = 0;
|
||||
if (empty($_POST['argv']) == false) {
|
||||
$argv = explode(',', $_POST['argv']);
|
||||
for ($i = 0; $i < count($argv); $i += 2) {
|
||||
if (empty($argv[$i]) == false) {
|
||||
$$argv[$i] = $argv[$i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($start == 1) {
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Recuperation de l'url du fichier
|
||||
// --------------------------------------------------------------------------- //
|
||||
$client = new SoapClient(null,
|
||||
array('trace' => 1,
|
||||
'soap_version' => SOAP_1_1,
|
||||
'location' => 'http://78.31.45.206/ws2/',
|
||||
'uri' => 'http://78.31.45.206/',
|
||||
'login' => $_SESSION['tabInfo']['login'],
|
||||
'password' => $_SESSION['tabInfo']['password']));
|
||||
try {
|
||||
switch ($page) {
|
||||
// ------------------------------------------------------------------- //
|
||||
// Surveillance
|
||||
// ------------------------------------------------------------------- //
|
||||
case 'surveillance':
|
||||
$res = $client->
|
||||
getListeSurveillancesCsv($_POST['menuD'],
|
||||
$_SESSION['tabInfo']['login']);
|
||||
break;
|
||||
// ------------------------------------------------------------------- //
|
||||
// Consommation
|
||||
// ------------------------------------------------------------------- //
|
||||
case 'consommation':
|
||||
$date = substr($_POST['menuD'], 3, 4).
|
||||
substr($_POST['menuD'], 0, 2);
|
||||
$detail = ($_POST['caseC'] == 'true') ? true : false;
|
||||
if (isset($_POST['caseC2']) == true) {
|
||||
$tous = ($_POST['caseC2'] == 'true') ? true : false;
|
||||
} else {
|
||||
$tous = false;
|
||||
}
|
||||
if (isset($login) == false) {
|
||||
$login = '';
|
||||
}
|
||||
$firephp->log("date='$date'");
|
||||
$firephp->log("detail='$detail'");
|
||||
$firephp->log("idClient='$idClient'");
|
||||
$firephp->log("login='$login'");
|
||||
$firephp->log("tous='$tous'");
|
||||
$res = $client->
|
||||
getLogsClients($date, $detail, $idClient, $login, $tous);
|
||||
break;
|
||||
}
|
||||
if (isset($res['result']['Url']) == true) {
|
||||
$return = $res['result']['Url'];
|
||||
} else {
|
||||
$return = 'FALSE';
|
||||
}
|
||||
} catch (SoapFault $e) {
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client, $e, $_SESSION['tabInfo']);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Recuperation du fichier
|
||||
// --------------------------------------------------------------------------- //
|
||||
require_once 'common/curl.php';
|
||||
|
||||
$url = (isset($_POST['url']) == true) ? $_POST['url'] : '';
|
||||
$path = PATH_DATA.'/'.$page.'/';
|
||||
|
||||
// Recuperation du nom du fichier
|
||||
$tableau = explode('/', $url);
|
||||
$file = $tableau[sizeof($tableau) - 1];
|
||||
|
||||
// Suppression du fichier si le temps de cache est depasse
|
||||
if (file_exists($path.$file) &&
|
||||
filemtime($path.$file) > mktime(date("H") + 1, date("i"), date("s"),
|
||||
date("m"), date("d"), date("Y"))) {
|
||||
unlink($path.$file);
|
||||
}
|
||||
|
||||
// Recuperation du fichier sur le serveur
|
||||
if (!file_exists($path.$file)) {
|
||||
// On check si le fichier est present sur l'url
|
||||
$url_tab = getUrl($url, '', '', '', false);
|
||||
if ($url_tab['code'] == 408 ||
|
||||
$url_tab['code'] == 400 ||
|
||||
$url_tab['code'] == 404) {
|
||||
// Fichier non disponible
|
||||
$return = 'FALSE';
|
||||
} else {
|
||||
// Ecriture du fichier sur le serveur en local
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path);
|
||||
}
|
||||
$body = $url_tab['body'];
|
||||
$fp = fopen($path.$file, 'w');
|
||||
fwrite($fp, $body);
|
||||
fclose($fp);
|
||||
chmod($path.$file, 0666);
|
||||
$return = 'FALSE';
|
||||
}
|
||||
}
|
||||
|
||||
// Le fichier existe sur l'extranet
|
||||
if (file_exists($path.$file)) {
|
||||
if (filesize($path.$file) > 0) {
|
||||
$return = '<u><a title="Télécharger le fichier"'.
|
||||
' target="_blank" href="/datafile.php?q='.$file.
|
||||
'&type='.$page.'">Cliquez-ici pour télécharger'.
|
||||
' le fichier.</a></u>';
|
||||
} else {
|
||||
$return = 'Aucune '.$page.' enregistrée.';
|
||||
}
|
||||
}
|
||||
}
|
||||
print $return;
|
@ -57,10 +57,7 @@ if ($action == 'html') {
|
||||
->from('Report')
|
||||
->where('order_id = ? and format = "html"', $commande_id)
|
||||
->fetchOne();
|
||||
$contenu = preg_replace('/background: #FFFFFF;/', '', $rapport->content);
|
||||
$contenu = preg_replace('@<script[^>]*?>.*?</script>@si', '', $contenu);
|
||||
print $contenu;
|
||||
print '</div>';
|
||||
print $rapport->content;
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -166,15 +163,13 @@ function tableFin() {
|
||||
// boutonPost
|
||||
// --------------------------------------------------------------------------- //
|
||||
function boutonPost($action, $nom, $valeur, $etat_enq) {
|
||||
if ($action == 'xml' ||
|
||||
$action == 'pdf' ||
|
||||
$action == 'doc') {
|
||||
$extra = 'action="pages/international_commandes.php" ';
|
||||
if ($action == 'html') {
|
||||
$extra = 'target="_blank" ';
|
||||
} else {
|
||||
$extra = '';
|
||||
}
|
||||
print
|
||||
'<form method="post" '.$extra.'style="float:left">'.
|
||||
print '<form method="post" action="pages/international_commandes.php" '.
|
||||
$extra.'style="float:left">'.
|
||||
'<input type="hidden" name="action" value="'.$action.'" />'.
|
||||
'<input type="hidden" name="'.$nom.'" value="'.$valeur.'" />'.
|
||||
'<input type="hidden" name="etat_enq" value="'.$etat_enq.'" />'.
|
||||
|
@ -112,96 +112,39 @@ div.submit p.required-note span{color:#4B911C;_color:#666;font-size:170%;vertica
|
||||
#message {margin-left:30px;}
|
||||
#dialog { display:none; }
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var holdTheInterval;
|
||||
var nbEssai = 25;
|
||||
var essai = 0;
|
||||
var login;
|
||||
var date;
|
||||
var url;
|
||||
var details = false;
|
||||
var all = false;
|
||||
var dl = false;
|
||||
$(document).ready(
|
||||
function() {
|
||||
$("#dialog").dialog({
|
||||
bgiframe: true,
|
||||
autoOpen: false,
|
||||
height: 180,
|
||||
modal: true,
|
||||
buttons: {
|
||||
'Modifier': function() {
|
||||
var pass = $('input[name=npass1]').val();
|
||||
if (pass != $('input[name=npass2]').val()) {
|
||||
$('#form-message').html('Mots de passe différents.');
|
||||
} else {
|
||||
$('input[name=frmOptions[changepwd]]').val('1');
|
||||
$('input[name=frmOptions[password]]').val(pass);
|
||||
$('#password').html('Sauver pour enregistrer' +
|
||||
' la modification du mot de passe');
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
'Annuler': function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#password').click(function() {
|
||||
$("#dialog").dialog('open');
|
||||
});
|
||||
|
||||
//$.ajaxSetup({timeout: 4001});
|
||||
|
||||
$('#submitmois').click(function(){
|
||||
//On disable tout les champs
|
||||
$('input[name=details]:checkbox').attr('disabled', true);
|
||||
$('select[name=mois]').attr('disabled', true);
|
||||
$('input[name=all]:checkbox').attr('disabled', true);
|
||||
//Valeur de la date
|
||||
date = $('select[name=mois]').val();
|
||||
//Vérification
|
||||
if(date!='' && date!='-'){
|
||||
login = $('input[name=utilisateur]').val();
|
||||
details = $('input[name=details]').attr('checked') ? true : false ;
|
||||
all = $('input[name=all]').attr('checked') ? true : false ;
|
||||
checkFile();
|
||||
holdTheInterval = setInterval(checkFile, 4000);
|
||||
}
|
||||
});
|
||||
|
||||
function checkFile(){
|
||||
essai++;
|
||||
if(essai>nbEssai){
|
||||
essai = 0;
|
||||
updateInfo('Le temps maximum d\'attente a été atteint. Merci de rééssayez.');
|
||||
$('input[name=details]:checkbox').removeAttr('disabled');
|
||||
$('select[name=mois]').removeAttr('disabled');
|
||||
$('input[name=all]:checkbox').removeAttr('disabled');
|
||||
}else if(essai==1){
|
||||
$('#message').text('Patientez pendant la construction du fichier ('+essai+')...');
|
||||
$.post( 'pages/ajax/conso.php',
|
||||
{ login: login, date: date, details: details, all: all, start: essai},
|
||||
function (data, textStatus) { url = data; }
|
||||
);
|
||||
}else{
|
||||
$('#message').text('Patientez pendant la construction du fichier ('+essai+')...');
|
||||
$.post( 'pages/ajax/conso.php',
|
||||
{ login: login, date: date, details: details, all: all, start: essai, url: url},
|
||||
function (data, textStatus) { if( data!='' && data!='FALSE' ){ updateInfo(data); } });
|
||||
}
|
||||
}
|
||||
|
||||
function updateInfo(data){
|
||||
$('#message').html(data);
|
||||
clearInterval(holdTheInterval);
|
||||
$('input[name=details]:checkbox').removeAttr('disabled');
|
||||
$('select[name=mois]').removeAttr('disabled');
|
||||
$('input[name=all]:checkbox').removeAttr('disabled');
|
||||
essai = 0;
|
||||
}
|
||||
|
||||
$("#dialog").dialog({
|
||||
bgiframe: true,
|
||||
autoOpen: false,
|
||||
height: 180,
|
||||
modal: true,
|
||||
buttons: {
|
||||
'Modifier': function() {
|
||||
var pass = $('input[name=npass1]').val();
|
||||
if( pass!=$('input[name=npass2]').val() ){
|
||||
$('#form-message').html('Mots de passe différents.');
|
||||
}else{
|
||||
$('input[name=frmOptions[changepwd]]').val('1');
|
||||
$('input[name=frmOptions[password]]').val(pass);
|
||||
$('#password').html('Sauver pour enregistrer la modification du mot de passe');
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
'Annuler': function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#password').click(function(){
|
||||
$("#dialog").dialog('open');
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<div id="center">
|
||||
@ -307,31 +250,44 @@ Numéros de téléphone<br/><i>(Fixe, Fax, Mobile)</i>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if( $tabInfo['profil']=='Administrateur' ||
|
||||
$tabInfo['profil']=='SuperAdministrateur' )
|
||||
{
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Consommation
|
||||
// --------------------------------------------------------------------------- //
|
||||
if ($tabInfo['profil'] == 'Administrateur' ||
|
||||
$tabInfo['profil'] == 'SuperAdministrateur') {
|
||||
$argv = '';
|
||||
if (isset($loginVu) == true) {
|
||||
$argv .= "login,$loginVu,";
|
||||
}
|
||||
if (isset($idClient) == true) {
|
||||
$argv .= "idClient,$idClient";
|
||||
}
|
||||
?>
|
||||
<div class="infoTitle StyleInfoLib">Relevé de consommation</div>
|
||||
<div class="infoData">
|
||||
<input type="hidden" name="utilisateur" value="<?=$loginVu?>"/>
|
||||
<label>Détails</label>
|
||||
<input type="checkbox" name="details" value="1" class="noborder"/>
|
||||
<select name="mois">
|
||||
<option value="-">Mois/Année</option>
|
||||
<?php
|
||||
for($i=1; $i<=12; $i++ ){
|
||||
$date =
|
||||
date('m', mktime(0, 0, 0, date('m')-$i, 1, date('Y'))).'/'.
|
||||
date('Y', mktime(0, 0, 0, date('m')-$i, 1, date('Y')));
|
||||
echo '<option value="'.$date.'">'.$date.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<a href="#" id="submitmois">Ok</a>
|
||||
<input type="hidden" name="page" value="<?print $page; ?>"/>
|
||||
<input type="hidden" name="argv" value="<?php print $argv; ?>"/>
|
||||
<label>Détails</label>
|
||||
<input type="checkbox" name="telechargementjsCase" value="1" class="noborder"/>
|
||||
<select name="telechargementjsMenu">
|
||||
<option value="invalide">Mois/Année</option>
|
||||
<?php
|
||||
for ($i = 1; $i <= 12; ++$i) {
|
||||
$date = date('m', mktime(0, 0, 0, date('m') - $i, 1, date('Y'))).'/'.
|
||||
date('Y', mktime(0, 0, 0, date('m') - $i, 1, date('Y')));
|
||||
print '<option value="'.$date.'">'.$date.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<a href="#" id="telechargementjs">Ok</a>
|
||||
</div>
|
||||
<div id="message" class="infoData last"></div>
|
||||
<div id="telechargementjsMsg" class="infoData last"></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Moteur de recherche
|
||||
// --------------------------------------------------------------------------- //
|
||||
?>
|
||||
<h2>Moteur de recherche</h2>
|
||||
<div class="infoTitle StyleInfoLib">Résultats par page</div>
|
||||
@ -399,7 +355,7 @@ if ($_SESSION['tabInfo']['login']=='ylenaour')
|
||||
$login['profil'] : 'Utilisateur';?>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">Droits d'accès</div>
|
||||
<div class="infoTitle StyleInfoLib">Droits d'accès</div>
|
||||
<div class="infoData">
|
||||
<?php
|
||||
FB::log($login, 'login');
|
||||
|
@ -120,7 +120,7 @@ if($vue=='default'){
|
||||
?>
|
||||
<table id="info">
|
||||
<tr>
|
||||
<td width="200" class="StyleInfoLib">Nombre d'entités affichées</td>
|
||||
<td width="200" class="StyleInfoLib">Nombre d'entités affichées</td>
|
||||
<td><?=$nbEtab?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -139,49 +139,72 @@ if($vue=='default'){
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Extraction
|
||||
// --------------------------------------------------------------------------- //
|
||||
?>
|
||||
<h2>Extraction des surveillances</h2>
|
||||
<p class="options">
|
||||
<label>Extraire uniquement les surveillances de type</label>
|
||||
<select name="source">
|
||||
<option value="-">toutes</option>
|
||||
<?php
|
||||
foreach($tabSource as $s => $perm)
|
||||
{
|
||||
if(hasPerm('surv'.$perm))
|
||||
{
|
||||
?>
|
||||
<option value="<?=$s?>" <?php if(isset($source) && $source==$s){print 'selected';}?>><?=$s?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<a href="#" id="getSurveillanceCsv">Ok</a>
|
||||
<input type="hidden" name="page" value="<?=$page?>"/>
|
||||
<label>Extraire uniquement les surveillances de type</label>
|
||||
<select name="telechargementjsMenu">
|
||||
<option value="-">toutes</option>
|
||||
<?php
|
||||
foreach ($tabSource as $s => $perm) {
|
||||
if (hasPerm('surv'.$perm)) {
|
||||
print '<option value="'.$s.'"';
|
||||
if (isset($source) && $source == $s) {
|
||||
print 'selected';
|
||||
}
|
||||
print '>'.$s.'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<a href="#" id="telechargementjs">Ok</a>
|
||||
</p>
|
||||
<div id="getSurveillanceMsg"></div>
|
||||
|
||||
<div id="telechargementjsMsg"></div>
|
||||
|
||||
<?php
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Affichage
|
||||
// --------------------------------------------------------------------------- //
|
||||
?>
|
||||
<h2>Options de tri</h2>
|
||||
<p class="options">
|
||||
Afficher uniquement les suveillances de type
|
||||
<select name="type">
|
||||
<option value="-">toutes</option>
|
||||
<?php
|
||||
foreach($tabSource as $s => $perm)
|
||||
{
|
||||
if(hasPerm('surv'.$perm))
|
||||
{
|
||||
?>
|
||||
<option value="<?=$s?>"
|
||||
<?=(isset($source) && $source==$s) ? 'selected' : '' ;?>><?=$s?>
|
||||
</option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label>Afficher uniquement les suveillances de type</label>
|
||||
<select name="type">
|
||||
<option value="-">toutes</option>
|
||||
<?php
|
||||
foreach($tabSource as $s => $perm) {
|
||||
if (hasPerm('surv'.$perm)) {
|
||||
print '<option value="'.$s.'"';
|
||||
if (isset($source) && $source == $s) {
|
||||
print 'selected';
|
||||
}
|
||||
print '>'.$s.'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("select[name=type]").change(function() {
|
||||
var value = $(this).val();
|
||||
if (value == '-') {
|
||||
$(location).attr('href', './?page=surveillance');
|
||||
} else {
|
||||
$(location).attr('href',
|
||||
'./?page=surveillance&vue=source&source=' +
|
||||
value + '');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<p class="options">
|
||||
<ul id="tri">
|
||||
<li>
|
||||
@ -204,7 +227,7 @@ Tri par Référence
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?=lienTri('dateajout', $vue, $source, $siret, $idEntreprise)?>">
|
||||
Tri par Date d'ajout
|
||||
Tri par Date d'ajout
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -1,4 +1,19 @@
|
||||
<?
|
||||
namespace SD {
|
||||
// --------------------------------------------------------------------------- //
|
||||
// DomDocument2
|
||||
// --------------------------------------------------------------------------- //
|
||||
class DomDocument2 extends \DOMDocument
|
||||
{
|
||||
function getValueFromTag($tagName) {
|
||||
$items = $this->getElementsByTagName($tagName);
|
||||
foreach ($items as $item) {
|
||||
return $item->nodeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} namespace {
|
||||
|
||||
define('CREDITSAFE_WS_URL', 'https://www.creditsafe.fr/getdata/service/CSFRServices.asmx');
|
||||
define('CREDITSAFE_WS_URI', 'https://www.creditsafe.fr/getdata/service/');
|
||||
@ -27,8 +42,7 @@ $idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; /
|
||||
if (($siret*1)==0 && $idEntreprise==0) die('Paramètres incorrects !');
|
||||
$siren=substr($siret,0,9);
|
||||
$raisonSociale = etabSession($siren, $idEntreprise);
|
||||
$action=$_REQUEST['action'];
|
||||
if ($action<>'' && $action<>'commande') die('Paramètres incorrects !');
|
||||
$action = (isset($_GET['action']) == true) ? $_GET['action'] : '';
|
||||
|
||||
require_once 'partenaires/classMTva.php';
|
||||
require_once 'partenaires/classMMap.php';
|
||||
@ -74,7 +88,7 @@ $req='<xmlrequest>'.
|
||||
$O = $client->setLog('scorecsf', $siret, 0, 'local');
|
||||
}
|
||||
|
||||
$dom_object = new DomDocument2();
|
||||
$dom_object = new SD\DomDocument2();
|
||||
//TODO : Chemin !!
|
||||
$dom_object->load(PATH_DATA.'/creditsafe/xml/'.$fichier);
|
||||
$companyname=$dom_object->getValueFromTag('companyname');
|
||||
@ -131,7 +145,7 @@ $req='<xmlrequest>'.
|
||||
else echo $raisonSociale;
|
||||
?></td>
|
||||
</tr>
|
||||
<? if ($etab['NumRC']*1<>0) { ?>
|
||||
<? if (isset($etab['NumRC']) == true) { ?>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Numéro R.C.</td>
|
||||
@ -215,17 +229,21 @@ if ($action<>'commande') {
|
||||
<?php
|
||||
}
|
||||
|
||||
class DomDocument2 extends DOMDocument {
|
||||
|
||||
function getValueFromTag($tagName) {
|
||||
$items=$this->getElementsByTagName($tagName);
|
||||
foreach ($items as $item) {
|
||||
|
||||
return $item->nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Export
|
||||
// --------------------------------------------------------------------------- //
|
||||
require_once 'export.php';
|
||||
if (isset($siret) == true) {
|
||||
$fileName = $page.'-'.$siret;
|
||||
} else {
|
||||
$fileName = $page.'-'.$idEntreprise;
|
||||
}
|
||||
$fileName = realpath('../cache/').'/'.$fileName.'.xml';
|
||||
$dom_object->save($fileName);
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
} // namespace
|
||||
?>
|
||||
|
@ -141,5 +141,29 @@ if(!empty($ratio))
|
||||
<br/><br/>
|
||||
<?php
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Export
|
||||
// --------------------------------------------------------------------------- //
|
||||
require_once 'export.php';
|
||||
if (isset($siret) == true) {
|
||||
$fileName = $page.'-'.$siret;
|
||||
} else {
|
||||
$fileName = $page.'-'.$idEntreprise;
|
||||
}
|
||||
|
||||
$parseTab = new tabExport;
|
||||
$parseTab->tab = array($data);
|
||||
$parseTab->type = array();
|
||||
|
||||
$array2csv = new ExportCSV;
|
||||
$array2csv->records = $parseTab->convertTable();
|
||||
$array2csv->writeCSV($fileName);
|
||||
|
||||
$array2xml = new ExportXML;
|
||||
$array2xml->rootName = $page.'s';
|
||||
$array2xml->defaultTagName = $page;
|
||||
$array2xml->records = $data;
|
||||
$array2xml->writeXML($fileName);
|
||||
?>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user