Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
1280499110
@ -90,9 +90,9 @@ if ($action == 'add')
|
|||||||
if (! $error && $fk_user != 0) // We will add fk_user = 0 later.
|
if (! $error && $fk_user != 0) // We will add fk_user = 0 later.
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
||||||
$sql.= "box_id, position, box_order, fk_user";
|
$sql.= "box_id, position, box_order, fk_user, entity";
|
||||||
$sql.= ") values (";
|
$sql.= ") values (";
|
||||||
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', ".$fk_user;
|
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', ".$fk_user.", ".$conf->entity;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog("boxes.php activate box sql=".$sql);
|
dol_syslog("boxes.php activate box sql=".$sql);
|
||||||
@ -109,9 +109,9 @@ if ($action == 'add')
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
||||||
$sql.= "box_id, position, box_order, fk_user";
|
$sql.= "box_id, position, box_order, fk_user, entity";
|
||||||
$sql.= ") values (";
|
$sql.= ") values (";
|
||||||
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', 0";
|
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', 0, ".$conf->entity;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog("boxes.php activate box sql=".$sql);
|
dol_syslog("boxes.php activate box sql=".$sql);
|
||||||
@ -137,9 +137,9 @@ if ($action == 'add')
|
|||||||
|
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "SELECT box_id FROM ".MAIN_DB_PREFIX."boxes";
|
$sql = "SELECT box_id FROM ".MAIN_DB_PREFIX."boxes";
|
||||||
$sql.= " WHERE rowid=".$rowid;
|
$sql.= " WHERE rowid=".$rowid;
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$obj=$db->fetch_object($resql);
|
$obj=$db->fetch_object($resql);
|
||||||
if (! empty($obj->box_id))
|
if (! empty($obj->box_id))
|
||||||
@ -152,7 +152,9 @@ if ($action == 'delete')
|
|||||||
// $resql = $db->query($sql);
|
// $resql = $db->query($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
||||||
$sql.= " WHERE box_id=".$obj->box_id;
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
|
$sql.= " AND box_id=".$obj->box_id;
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -182,12 +184,12 @@ if ($action == 'switch')
|
|||||||
$newsecondnum=preg_replace('/[a-zA-Z]+/','',$newsecond);
|
$newsecondnum=preg_replace('/[a-zA-Z]+/','',$newsecond);
|
||||||
$newsecond=sprintf("%s%02d",$newsecondchar?$newsecondchar:'A',$newsecondnum+1);
|
$newsecond=sprintf("%s%02d",$newsecondchar?$newsecondchar:'A',$newsecondnum+1);
|
||||||
}
|
}
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$newfirst."' WHERE rowid=".$objfrom->rowid;
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$newfirst."' WHERE rowid=".$objfrom->rowid;
|
||||||
dol_syslog($sql);
|
dol_syslog($sql);
|
||||||
$resultupdatefrom = $db->query($sql);
|
$resultupdatefrom = $db->query($sql);
|
||||||
if (! $resultupdatefrom) { dol_print_error($db); }
|
if (! $resultupdatefrom) { dol_print_error($db); }
|
||||||
|
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$newsecond."' WHERE rowid=".$objto->rowid;
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$newsecond."' WHERE rowid=".$objto->rowid;
|
||||||
dol_syslog($sql);
|
dol_syslog($sql);
|
||||||
$resultupdateto = $db->query($sql);
|
$resultupdateto = $db->query($sql);
|
||||||
if (! $resultupdateto) { dol_print_error($db); }
|
if (! $resultupdateto) { dol_print_error($db); }
|
||||||
@ -231,8 +233,8 @@ $actives = array();
|
|||||||
$sql = "SELECT b.rowid, b.box_id, b.position, b.box_order,";
|
$sql = "SELECT b.rowid, b.box_id, b.position, b.box_order,";
|
||||||
$sql.= " bd.rowid as boxid";
|
$sql.= " bd.rowid as boxid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd";
|
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd";
|
||||||
$sql.= " WHERE b.box_id = bd.rowid";
|
$sql.= " WHERE b.entity = ".$conf->entity;
|
||||||
$sql.= " AND bd.entity = ".$conf->entity;
|
$sql.= " AND b.box_id = bd.rowid";
|
||||||
$sql.= " AND b.fk_user=0";
|
$sql.= " AND b.fk_user=0";
|
||||||
$sql.= " ORDER by b.position, b.box_order";
|
$sql.= " ORDER by b.position, b.box_order";
|
||||||
|
|
||||||
@ -256,7 +258,7 @@ if ($resql)
|
|||||||
// This occurs just after an insert.
|
// This occurs just after an insert.
|
||||||
if ($decalage)
|
if ($decalage)
|
||||||
{
|
{
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$decalage."' WHERE rowid=".$obj->rowid;
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$decalage."' WHERE rowid=".$obj->rowid;
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -267,7 +269,8 @@ if ($resql)
|
|||||||
// This occurs just after an insert.
|
// This occurs just after an insert.
|
||||||
$sql = "SELECT box_order";
|
$sql = "SELECT box_order";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes";
|
$sql.= " FROM ".MAIN_DB_PREFIX."boxes";
|
||||||
$sql.= " WHERE length(box_order) <= 2";
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
|
$sql.= " AND LENGTH(box_order) <= 2";
|
||||||
|
|
||||||
dol_syslog("Execute requests to renumber box order sql=".$sql);
|
dol_syslog("Execute requests to renumber box order sql=".$sql);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -280,13 +283,13 @@ if ($resql)
|
|||||||
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
|
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
|
||||||
{
|
{
|
||||||
$box_order = "A0".$record['box_order'];
|
$box_order = "A0".$record['box_order'];
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'";
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
}
|
}
|
||||||
else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
|
else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
|
||||||
{
|
{
|
||||||
$box_order = "B0".$record['box_order'];
|
$box_order = "B0".$record['box_order'];
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'";
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,13 +298,13 @@ if ($resql)
|
|||||||
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
|
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
|
||||||
{
|
{
|
||||||
$box_order = "A".$record['box_order'];
|
$box_order = "A".$record['box_order'];
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'";
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
}
|
}
|
||||||
else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
|
else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
|
||||||
{
|
{
|
||||||
$box_order = "B".$record['box_order'];
|
$box_order = "B".$record['box_order'];
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'";
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,7 +137,8 @@ if ($_POST["delete"])
|
|||||||
$obj=$db->fetch_object($resql);
|
$obj=$db->fetch_object($resql);
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
||||||
$sql.= " WHERE box_id = ".$obj->rowid;
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
|
$sql.= " AND box_id = ".$obj->rowid;
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -45,9 +45,9 @@ $modules = array(
|
|||||||
// Conditions pour que l'option soit proposee
|
// Conditions pour que l'option soit proposee
|
||||||
$conditions = array(
|
$conditions = array(
|
||||||
'SOCIETE' => 1,
|
'SOCIETE' => 1,
|
||||||
'PRODUCTDESC' => ($conf->product->enabled||$conf->service->enabled),
|
'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)),
|
||||||
'MAILING' => $conf->mailing->enabled,
|
'MAILING' => ! empty($conf->mailing->enabled),
|
||||||
'DETAILS' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled),
|
'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)),
|
||||||
);
|
);
|
||||||
// Picto
|
// Picto
|
||||||
$picto = array(
|
$picto = array(
|
||||||
@ -129,14 +129,14 @@ else
|
|||||||
print '<td>'.$langs->trans($desc).'</td>';
|
print '<td>'.$langs->trans($desc).'</td>';
|
||||||
print '<td align="center" width="100">';
|
print '<td align="center" width="100">';
|
||||||
$constante = 'FCKEDITOR_ENABLE_'.$const;
|
$constante = 'FCKEDITOR_ENABLE_'.$const;
|
||||||
$value = $conf->global->$constante;
|
$value = (isset($conf->global->$constante)?$conf->global->$constante:0);
|
||||||
if($value == 0)
|
if ($value == 0)
|
||||||
{
|
{
|
||||||
print '<a href="fckeditor.php?action=activate_'.strtolower($const).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=activate_'.strtolower($const).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
}
|
}
|
||||||
else if($value == 1)
|
else if ($value == 1)
|
||||||
{
|
{
|
||||||
print '<a href="fckeditor.php?action=disable_'.strtolower($const).'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=disable_'.strtolower($const).'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</td>";
|
print "</td>";
|
||||||
@ -164,7 +164,7 @@ else
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2007-2012 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
|
||||||
|
|||||||
@ -72,10 +72,13 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
|
|||||||
*/
|
*/
|
||||||
function fetch($rowid)
|
function fetch($rowid)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
// Recupere liste des boites d'un user si ce dernier a sa propre liste
|
// Recupere liste des boites d'un user si ce dernier a sa propre liste
|
||||||
$sql = "SELECT b.rowid, b.box_id, b.position, b.box_order, b.fk_user";
|
$sql = "SELECT b.rowid, b.box_id, b.position, b.box_order, b.fk_user";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b";
|
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b";
|
||||||
$sql.= " WHERE b.rowid = ".$rowid;
|
$sql.= " WHERE b.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND b.rowid = ".$rowid;
|
||||||
dol_syslog(get_class($this)."::fetch rowid=".$rowid);
|
dol_syslog(get_class($this)."::fetch rowid=".$rowid);
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class InfoBox
|
|||||||
$sql.= " d.rowid as box_id, d.file, d.note, d.tms";
|
$sql.= " d.rowid as box_id, d.file, d.note, d.tms";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
||||||
$sql.= " WHERE b.box_id = d.rowid";
|
$sql.= " WHERE b.box_id = d.rowid";
|
||||||
$sql.= " AND d.entity = ".$conf->entity;
|
$sql.= " AND b.entity = ".$conf->entity;
|
||||||
if ($zone >= 0) $sql.= " AND b.position = ".$zone;
|
if ($zone >= 0) $sql.= " AND b.position = ".$zone;
|
||||||
if ($user->id && ! empty($user->conf->$confuserzone)) $sql.= " AND b.fk_user = ".$user->id;
|
if ($user->id && ! empty($user->conf->$confuserzone)) $sql.= " AND b.fk_user = ".$user->id;
|
||||||
else $sql.= " AND b.fk_user = 0";
|
else $sql.= " AND b.fk_user = 0";
|
||||||
@ -60,7 +60,15 @@ class InfoBox
|
|||||||
{
|
{
|
||||||
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
|
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) {
|
||||||
|
|
||||||
|
$sql.= " WHERE entity IN (1,".$conf->entity.")"; // TODO add method for define another master entity
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class()."::listBoxes get default box list sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class()."::listBoxes get default box list sql=".$sql, LOG_DEBUG);
|
||||||
@ -176,11 +184,9 @@ class InfoBox
|
|||||||
|
|
||||||
// Delete all lines
|
// Delete all lines
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
||||||
$sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def";
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
$sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid";
|
$sql.= " AND fk_user = ".$userid;
|
||||||
$sql.= " AND ".MAIN_DB_PREFIX."boxes_def.entity = ".$conf->entity;
|
$sql.= " AND position = ".$zone;
|
||||||
$sql.= " AND ".MAIN_DB_PREFIX."boxes.fk_user = ".$userid;
|
|
||||||
$sql.= " AND ".MAIN_DB_PREFIX."boxes.position = ".$zone;
|
|
||||||
|
|
||||||
dol_syslog(get_class()."::saveboxorder sql=".$sql);
|
dol_syslog(get_class()."::saveboxorder sql=".$sql);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -204,12 +210,13 @@ class InfoBox
|
|||||||
$i++;
|
$i++;
|
||||||
$ii=sprintf('%02d',$i);
|
$ii=sprintf('%02d',$i);
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes";
|
||||||
$sql.= "(box_id, position, box_order, fk_user)";
|
$sql.= "(box_id, position, box_order, fk_user, entity)";
|
||||||
$sql.= " values (";
|
$sql.= " values (";
|
||||||
$sql.= " ".$id.",";
|
$sql.= " ".$id.",";
|
||||||
$sql.= " ".$zone.",";
|
$sql.= " ".$zone.",";
|
||||||
$sql.= " '".$colonne.$ii."',";
|
$sql.= " '".$colonne.$ii."',";
|
||||||
$sql.= " ".$userid;
|
$sql.= " ".$userid.",";
|
||||||
|
$sql.= " ".$conf->entity;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class()."::saveboxorder sql=".$sql);
|
dol_syslog(get_class()."::saveboxorder sql=".$sql);
|
||||||
|
|||||||
@ -565,12 +565,11 @@ function dol_unescapefile($filename)
|
|||||||
* @param int $disablevirusscan 1=Disable virus scan
|
* @param int $disablevirusscan 1=Disable virus scan
|
||||||
* @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error'])
|
* @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error'])
|
||||||
* @param int $notrigger Disable all triggers
|
* @param int $notrigger Disable all triggers
|
||||||
* @param string $upload_dir Directory where to store uploaded file (note: also find in first part of dest_file)
|
* @param string $varfiles _FILES var name
|
||||||
* @param array $upload_file Values of uploaded file ($_FILES['field'])
|
|
||||||
* @return int >0 if OK, <0 or string if KO
|
* @return int >0 if OK, <0 or string if KO
|
||||||
* @see dolCheckUploadedFile, dol_move
|
* @see dolCheckUploadedFile, dol_move
|
||||||
*/
|
*/
|
||||||
function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $notrigger=0, $upload_dir='', $upload_file=null)
|
function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $notrigger=0, $varfiles='addedfile')
|
||||||
{
|
{
|
||||||
global $db, $hookmanager;
|
global $db, $hookmanager;
|
||||||
global $object;
|
global $object;
|
||||||
@ -591,7 +590,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
|||||||
}
|
}
|
||||||
$hookmanager->initHooks(array('fileslib'));
|
$hookmanager->initHooks(array('fileslib'));
|
||||||
|
|
||||||
$parameters=array('upload_dir' => $upload_dir, 'upload_file' => $upload_file, 'allowoverwrite' => $allowoverwrite, 'notrigger' => $notrigger);
|
$parameters=array('dest_file' => $dest_file, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite, 'notrigger' => $notrigger);
|
||||||
$reshook=$hookmanager->executeHooks('dolMoveUploadedFile', $parameters, $object);
|
$reshook=$hookmanager->executeHooks('dolMoveUploadedFile', $parameters, $object);
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
@ -1052,7 +1051,7 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=
|
|||||||
{
|
{
|
||||||
if (dol_mkdir($upload_dir) >= 0)
|
if (dol_mkdir($upload_dir) >= 0)
|
||||||
{
|
{
|
||||||
$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $upload_dir . "/" . $_FILES[$varfiles]['name'], $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $upload_dir, $_FILES[$varfiles]);
|
$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $upload_dir . "/" . $_FILES[$varfiles]['name'], $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
|
||||||
if (is_numeric($resupload) && $resupload > 0)
|
if (is_numeric($resupload) && $resupload > 0)
|
||||||
{
|
{
|
||||||
if (empty($donotupdatesession))
|
if (empty($donotupdatesession))
|
||||||
|
|||||||
@ -615,8 +615,8 @@ abstract class DolibarrModules
|
|||||||
{
|
{
|
||||||
$lastid=$this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def","rowid");
|
$lastid=$this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def","rowid");
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id,position,box_order,fk_user)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id,position,box_order,fk_user,entity)";
|
||||||
$sql.= " VALUES (".$lastid.", 0, '0', 0)";
|
$sql.= " VALUES (".$lastid.", 0, '0', 0, ".$conf->entity.")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert_boxes sql=".$sql);
|
dol_syslog(get_class($this)."::insert_boxes sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -671,7 +671,7 @@ abstract class DolibarrModules
|
|||||||
$sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def";
|
$sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def";
|
||||||
$sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid";
|
$sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid";
|
||||||
$sql.= " AND ".MAIN_DB_PREFIX."boxes_def.file = '".$this->db->escape($file)."'";
|
$sql.= " AND ".MAIN_DB_PREFIX."boxes_def.file = '".$this->db->escape($file)."'";
|
||||||
$sql.= " AND ".MAIN_DB_PREFIX."boxes_def.entity = ".$conf->entity;
|
$sql.= " AND ".MAIN_DB_PREFIX."boxes.entity = ".$conf->entity;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete_boxes sql=".$sql);
|
dol_syslog(get_class($this)."::delete_boxes sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
@ -139,7 +139,8 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$nbrows=ROWS_2;
|
$nbrows=ROWS_2;
|
||||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||||
$doleditor=new DolEditor('product_desc', GETPOST('product_desc'), '', 150, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
|
$enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
|
||||||
|
$doleditor=new DolEditor('product_desc', GETPOST('product_desc'), '', 150, 'dolibarr_details', '', false, true, $enable, $nbrows, 70);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
@ -192,10 +193,11 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
<tr id="service_duration_area" <?php echo $bcnd[$var]; ?>>
|
<tr id="service_duration_area" <?php echo $bcnd[$var]; ?>>
|
||||||
<td colspan="<?php echo $colspan; ?>">
|
<td colspan="<?php echo $colspan; ?>">
|
||||||
<?php
|
<?php
|
||||||
|
$hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:'');
|
||||||
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
echo $form->select_date('','date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
echo $form->select_date('','date_start',$hourmin,$hourmin,1,"addproduct");
|
||||||
echo ' '.$langs->trans('to').' ';
|
echo ' '.$langs->trans('to').' ';
|
||||||
echo $form->select_date('','date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
|
echo $form->select_date('','date_end',$hourmin,$hourmin,1,"addproduct");
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -60,7 +60,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<span id="price_base_type" class="hideobject"></span>
|
<span id="price_base_type" class="hideobject"></span>
|
||||||
|
|
||||||
<?php } else if ($line->fk_product > 0) { ?>
|
<?php } else if ($line->fk_product > 0) { ?>
|
||||||
|
|
||||||
<a href="<?php echo DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product; ?>">
|
<a href="<?php echo DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product; ?>">
|
||||||
<?php
|
<?php
|
||||||
@ -73,10 +73,9 @@
|
|||||||
echo ' - '.nl2br($line->product_label);
|
echo ' - '.nl2br($line->product_label);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<br>
|
<?php } ?>
|
||||||
<?php
|
|
||||||
}
|
<br>
|
||||||
?>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
@ -87,10 +86,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// editeur wysiwyg
|
// editeur wysiwyg
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$nbrows=ROWS_2;
|
$nbrows=ROWS_2;
|
||||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
$enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
|
||||||
$doleditor=new DolEditor('product_desc',$line->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
|
$doleditor=new DolEditor('product_desc',$line->description,'',164,'dolibarr_details','',false,true,$enable,$nbrows,70);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
@ -135,9 +135,10 @@
|
|||||||
<tr id="service_duration_area" <?php echo $bc[$var]; ?>>
|
<tr id="service_duration_area" <?php echo $bc[$var]; ?>>
|
||||||
<td colspan="11"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
|
<td colspan="11"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
|
||||||
<?php
|
<?php
|
||||||
echo $form->select_date($line->date_start,'date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$line->date_start?0:1,"updateligne");
|
$hourmin=(isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:'');
|
||||||
|
echo $form->select_date($line->date_start,'date_start',$hourmin,$hourmin,$line->date_start?0:1,"updateligne");
|
||||||
echo ' '.$langs->trans('to').' ';
|
echo ' '.$langs->trans('to').' ';
|
||||||
echo $form->select_date($line->date_end,'date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$line->date_end?0:1,"updateligne");
|
echo $form->select_date($line->date_end,'date_end',$hourmin,$hourmin,$line->date_end?0:1,"updateligne");
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
171
htdocs/ecm/ajax/ecmdatabase.php
Normal file
171
htdocs/ecm/ajax/ecmdatabase.php
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2012 Regis Houssin <regis@dolibarr.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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/ecm/ajax/ecmdatabases.php
|
||||||
|
* \brief File to build ecm database
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
|
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
|
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$element = GETPOST('element', 'alpha');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
top_httphead();
|
||||||
|
|
||||||
|
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||||
|
|
||||||
|
// Load original field value
|
||||||
|
if (isset($action) && ! empty($action))
|
||||||
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
if ($action == 'build' && ! empty($element))
|
||||||
|
{
|
||||||
|
require DOL_DOCUMENT_ROOT . '/ecm/class/ecmdirectory.class.php';
|
||||||
|
|
||||||
|
$ecmdirstatic = new EcmDirectory($db);
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
$diroutputslash=str_replace('\\', '/', $conf->$element->dir_output);
|
||||||
|
$diroutputslash.='/';
|
||||||
|
|
||||||
|
// Scan directory tree on disk
|
||||||
|
$disktree=dol_dir_list($conf->$element->dir_output,'directories',1,'',array('^temp$'),'','',0);
|
||||||
|
|
||||||
|
// Scan directory tree in database
|
||||||
|
$sqltree=$ecmdirstatic->get_full_arbo(0);
|
||||||
|
|
||||||
|
$adirwascreated=0;
|
||||||
|
|
||||||
|
// Now we compare both trees to complete missing trees into database
|
||||||
|
//var_dump($disktree);
|
||||||
|
//var_dump($sqltree);
|
||||||
|
foreach($disktree as $dirdesc) // Loop on tree onto disk
|
||||||
|
{
|
||||||
|
set_time_limit(0); // To force restarts the timeout counter from zero
|
||||||
|
|
||||||
|
$dirisindatabase=0;
|
||||||
|
foreach($sqltree as $dirsqldesc)
|
||||||
|
{
|
||||||
|
if ($conf->$element->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname'])
|
||||||
|
{
|
||||||
|
$dirisindatabase=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $dirisindatabase)
|
||||||
|
{
|
||||||
|
$txt="Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
|
||||||
|
dol_syslog($txt);
|
||||||
|
|
||||||
|
// We must first find the fk_parent of directory to create $dirdesc['fullname']
|
||||||
|
$fk_parent=-1;
|
||||||
|
$relativepathmissing=str_replace($diroutputslash,'',$dirdesc['fullname']);
|
||||||
|
$relativepathtosearchparent=$relativepathmissing;
|
||||||
|
//dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent);
|
||||||
|
if (preg_match('/\//',$relativepathtosearchparent))
|
||||||
|
//while (preg_match('/\//',$relativepathtosearchparent))
|
||||||
|
{
|
||||||
|
$relativepathtosearchparent=preg_replace('/\/[^\/]*$/','',$relativepathtosearchparent);
|
||||||
|
$txt="Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?";
|
||||||
|
dol_syslog($txt);
|
||||||
|
//print $txt." -> ";
|
||||||
|
$parentdirisindatabase=0;
|
||||||
|
foreach($sqltree as $dirsqldesc)
|
||||||
|
{
|
||||||
|
if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent)
|
||||||
|
{
|
||||||
|
$parentdirisindatabase=$dirsqldesc['id'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($parentdirisindatabase > 0)
|
||||||
|
{
|
||||||
|
dol_syslog("Yes with id ".$parentdirisindatabase);
|
||||||
|
//print "Yes with id ".$parentdirisindatabase."<br>\n";
|
||||||
|
$fk_parent=$parentdirisindatabase;
|
||||||
|
//break; // We found parent, we can stop the while loop
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("No");
|
||||||
|
//print "No<br>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("Parent is root");
|
||||||
|
$fk_parent=0; // Parent is root
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($fk_parent >= 0)
|
||||||
|
{
|
||||||
|
$ecmdirtmp=new EcmDirectory($db);
|
||||||
|
$ecmdirtmp->ref = 'NOTUSEDYET';
|
||||||
|
$ecmdirtmp->label = dol_basename($dirdesc['fullname']);
|
||||||
|
$ecmdirtmp->description = '';
|
||||||
|
$ecmdirtmp->fk_parent = $fk_parent;
|
||||||
|
|
||||||
|
$txt="We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
|
||||||
|
dol_syslog($txt);
|
||||||
|
//print $txt."<br>\n";
|
||||||
|
$id = $ecmdirtmp->create($user);
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$newdirsql=array('id'=>$id,
|
||||||
|
'id_mere'=>$ecmdirtmp->fk_parent,
|
||||||
|
'label'=>$ecmdirtmp->label,
|
||||||
|
'description'=>$ecmdirtmp->description,
|
||||||
|
'fullrelativename'=>$relativepathmissing);
|
||||||
|
$sqltree[]=$newdirsql; // We complete fulltree for following loops
|
||||||
|
//var_dump($sqltree);
|
||||||
|
$adirwascreated=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$txt="Parent of ".$dirdesc['fullname']." not found";
|
||||||
|
dol_syslog($txt);
|
||||||
|
//print $txt."<br>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown"
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (! defined('REQUIRE_JQUERY_LAYOUT')) define('REQUIRE_JQUERY_LAYOUT','1');
|
if (! defined('REQUIRE_JQUERY_LAYOUT')) define('REQUIRE_JQUERY_LAYOUT','1');
|
||||||
|
if (! defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1);
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
@ -430,8 +431,9 @@ else
|
|||||||
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
|
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:'').'" class="toolbarbutton" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">';
|
$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:'')));
|
||||||
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
|
print '<a href="'.$url.'" class="toolbarbutton" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">';
|
||||||
|
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -565,57 +567,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
|
|||||||
print '<tr><td colspan="6" style="padding-left: 20px">';
|
print '<tr><td colspan="6" style="padding-left: 20px">';
|
||||||
|
|
||||||
// Show filemanager tree
|
// Show filemanager tree
|
||||||
print '<div id="filetree" class="ecmfiletree">';
|
print '<div id="filetree" class="ecmfiletree"></div>';
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
$openeddir='/';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
function loadandshowpreview(filedirname,section)
|
|
||||||
{
|
|
||||||
//alert('filedirname='+filedirname);
|
|
||||||
jQuery('#ecmfileview').empty();
|
|
||||||
|
|
||||||
url='<?php echo dol_buildpath('/core/ajax/ajaxdirpreview.php',1); ?>?action=preview&module=ecm§ion='+section+'&file='+urlencode(filedirname);
|
|
||||||
|
|
||||||
jQuery.get(url, function(data) {
|
|
||||||
//alert('Load of url '+url+' was performed : '+data);
|
|
||||||
pos=data.indexOf("TYPE=directory",0);
|
|
||||||
//alert(pos);
|
|
||||||
if ((pos > 0) && (pos < 20))
|
|
||||||
{
|
|
||||||
filediractive=filedirname; // Save current dirname
|
|
||||||
filetypeactive='directory';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filediractive=filedirname; // Save current dirname
|
|
||||||
filetypeactive='file';
|
|
||||||
}
|
|
||||||
jQuery('#ecmfileview').append(data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
jQuery(document).ready( function() {
|
|
||||||
jQuery('#filetree').fileTree({ root: '<?php print dol_escape_js($openeddir); ?>',
|
|
||||||
// Called if we click on a file (not a dir)
|
|
||||||
script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart=ecm&openeddir='.urlencode($openeddir); ?>',
|
|
||||||
folderEvent: 'click',
|
|
||||||
multiFolder: false },
|
|
||||||
// Called if we click on a file (not a dir)
|
|
||||||
function(file) {
|
|
||||||
jQuery("#mesg").hide();
|
|
||||||
loadandshowpreview(file,0);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile');
|
if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile');
|
||||||
|
|
||||||
@ -815,7 +767,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
|
|||||||
|
|
||||||
|
|
||||||
// To attach new file
|
// To attach new file
|
||||||
if (empty($conf->global->MAIN_ECM_DISABLE_JS) || ! empty($section))
|
if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section))
|
||||||
{
|
{
|
||||||
$formfile=new FormFile($db);
|
$formfile=new FormFile($db);
|
||||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php', 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48);
|
$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php', 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48);
|
||||||
@ -832,6 +784,9 @@ else print ' ';
|
|||||||
<?php
|
<?php
|
||||||
// End of page
|
// End of page
|
||||||
|
|
||||||
|
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
|
||||||
|
include 'tpl/builddatabase.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
82
htdocs/ecm/tpl/builddatabase.tpl.php
Normal file
82
htdocs/ecm/tpl/builddatabase.tpl.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2012 Regis Houssin <regis@dolibarr.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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$openeddir='/';
|
||||||
|
|
||||||
|
// TODO: just use ajaxdirtree.php for load database after ajax refresh and not scan directories
|
||||||
|
// too slow every page loaded !
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- BEGIN PHP TEMPLATE FOR JQUERY -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready( function() {
|
||||||
|
$('#filetree').fileTree({ root: '<?php print dol_escape_js($openeddir); ?>',
|
||||||
|
// Called if we click on a file (not a dir)
|
||||||
|
script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart=ecm&openeddir='.urlencode($openeddir); ?>',
|
||||||
|
folderEvent: 'click',
|
||||||
|
multiFolder: false },
|
||||||
|
// Called if we click on a file (not a dir)
|
||||||
|
function(file) {
|
||||||
|
$("#mesg").hide();
|
||||||
|
loadandshowpreview(file,0);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#refreshbutton').click( function() {
|
||||||
|
ecmBuildDatabase();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadandshowpreview(filedirname,section)
|
||||||
|
{
|
||||||
|
//alert('filedirname='+filedirname);
|
||||||
|
$('#ecmfileview').empty();
|
||||||
|
|
||||||
|
var url = '<?php echo dol_buildpath('/core/ajax/ajaxdirpreview.php',1); ?>?action=preview&module=ecm§ion='+section+'&file='+urlencode(filedirname);
|
||||||
|
$.get(url, function(data) {
|
||||||
|
//alert('Load of url '+url+' was performed : '+data);
|
||||||
|
pos=data.indexOf("TYPE=directory",0);
|
||||||
|
//alert(pos);
|
||||||
|
if ((pos > 0) && (pos < 20))
|
||||||
|
{
|
||||||
|
filediractive=filedirname; // Save current dirname
|
||||||
|
filetypeactive='directory';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filediractive=filedirname; // Save current dirname
|
||||||
|
filetypeactive='file';
|
||||||
|
}
|
||||||
|
$('#ecmfileview').append(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ecmBuildDatabase = function() {
|
||||||
|
$.pleaseBePatient("<?php echo $langs->trans('PleaseBePatient'); ?>");
|
||||||
|
$.getJSON( "<?php echo DOL_URL_ROOT . '/ecm/ajax/ecmdatabase.php'; ?>", {
|
||||||
|
action: "build",
|
||||||
|
element: "ecm"
|
||||||
|
},
|
||||||
|
function(response) {
|
||||||
|
$.unblockUI();
|
||||||
|
location.href="<?php echo $_SERVER['PHP_SELF']; ?>";
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<!-- END PHP TEMPLATE FOR JQUERY -->
|
||||||
@ -89,6 +89,8 @@ ALTER TABLE llx_actioncomm MODIFY elementtype VARCHAR(32);
|
|||||||
|
|
||||||
-- TASK #107
|
-- TASK #107
|
||||||
ALTER TABLE llx_ecm_directories MODIFY COLUMN label varchar(64) NOT NULL;
|
ALTER TABLE llx_ecm_directories MODIFY COLUMN label varchar(64) NOT NULL;
|
||||||
|
ALTER TABLE llx_ecm_directories ADD COLUMN fullpath varchar(255) AFTER cachenbofdoc;
|
||||||
|
ALTER TABLE llx_ecm_directories ADD COLUMN extraparams varchar(255) AFTER fullpath;
|
||||||
ALTER TABLE llx_ecm_directories ADD COLUMN acl text;
|
ALTER TABLE llx_ecm_directories ADD COLUMN acl text;
|
||||||
ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_c (fk_user_c);
|
ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_c (fk_user_c);
|
||||||
ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_m (fk_user_m);
|
ALTER TABLE llx_ecm_directories ADD INDEX idx_ecm_directories_fk_user_m (fk_user_m);
|
||||||
@ -105,6 +107,7 @@ ALTER TABLE llx_ecm_documents DROP COLUMN cipher;
|
|||||||
ALTER TABLE llx_ecm_documents CHANGE COLUMN fullpath_dol fullpath varchar(255) NOT NULL;
|
ALTER TABLE llx_ecm_documents CHANGE COLUMN fullpath_dol fullpath varchar(255) NOT NULL;
|
||||||
ALTER TABLE llx_ecm_documents MODIFY COLUMN filemime varchar(128) NOT NULL;
|
ALTER TABLE llx_ecm_documents MODIFY COLUMN filemime varchar(128) NOT NULL;
|
||||||
ALTER TABLE llx_ecm_documents ADD COLUMN metadata text after description;
|
ALTER TABLE llx_ecm_documents ADD COLUMN metadata text after description;
|
||||||
|
ALTER TABLE llx_ecm_documents ADD COLUMN extraparams varchar(255) AFTER fk_directory;
|
||||||
ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents_ref (ref, fk_directory, entity);
|
ALTER TABLE llx_ecm_documents ADD UNIQUE INDEX idx_ecm_documents_ref (ref, fk_directory, entity);
|
||||||
ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_create (fk_create);
|
ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_create (fk_create);
|
||||||
ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_update (fk_update);
|
ALTER TABLE llx_ecm_documents ADD INDEX idx_ecm_documents_fk_update (fk_update);
|
||||||
@ -192,3 +195,10 @@ INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'AlertValidat
|
|||||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayDeducted', '1');
|
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayDeducted', '1');
|
||||||
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayEveryMonth', '2.08334');
|
INSERT INTO llx_holiday_config (rowid ,name ,value) VALUES (NULL , 'nbHolidayEveryMonth', '2.08334');
|
||||||
|
|
||||||
|
|
||||||
|
DELETE FROM llx_document_model WHERE (nom = 'oursin' AND type ='invoice') OR (nom = 'edison' AND type ='order') OR (nom = 'jaune' AND type ='propal');
|
||||||
|
|
||||||
|
ALTER TABLE llx_boxes DROP INDEX uk_boxes;
|
||||||
|
ALTER TABLE llx_boxes ADD COLUMN entity integer NOT NULL DEFAULT 1 AFTER rowid;
|
||||||
|
ALTER TABLE llx_boxes ADD UNIQUE INDEX uk_boxes (entity, box_id, position, fk_user);
|
||||||
|
UPDATE llx_boxes as b SET b.entity = (SELECT bd.entity FROM llx_boxes_def as bd WHERE bd.rowid = b.box_id);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
-- Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
-- Copyright (C) 2006-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
--
|
--
|
||||||
-- 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
|
||||||
@ -17,7 +18,7 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_boxes ADD UNIQUE INDEX uk_boxes (box_id, position, fk_user);
|
ALTER TABLE llx_boxes ADD UNIQUE INDEX uk_boxes (entity, box_id, position, fk_user);
|
||||||
|
|
||||||
-- Supprime orphelins pour permettre montee de la cle
|
-- Supprime orphelins pour permettre montee de la cle
|
||||||
-- V4 DELETE llx_boxes FROM llx_boxes LEFT JOIN llx_boxes_def ON llx_boxes.box_id = llx_boxes_def.rowid WHERE llx_boxes_def.rowid IS NULL;
|
-- V4 DELETE llx_boxes FROM llx_boxes LEFT JOIN llx_boxes_def ON llx_boxes.box_id = llx_boxes_def.rowid WHERE llx_boxes_def.rowid IS NULL;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
-- Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
-- Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
-- Copyright (C) 2006-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
--
|
--
|
||||||
-- 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
|
||||||
@ -24,10 +25,12 @@
|
|||||||
|
|
||||||
create table llx_boxes
|
create table llx_boxes
|
||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
box_id integer NOT NULL,
|
entity integer NOT NULL DEFAULT 1,
|
||||||
position smallint NOT NULL,
|
box_id integer NOT NULL,
|
||||||
box_order varchar(3) NOT NULL,
|
position smallint NOT NULL,
|
||||||
fk_user integer default 0 NOT NULL,
|
box_order varchar(3) NOT NULL,
|
||||||
maxline integer NULL
|
fk_user integer default 0 NOT NULL,
|
||||||
|
maxline integer NULL
|
||||||
|
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -23,10 +23,12 @@ create table llx_ecm_directories
|
|||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
label varchar(64) NOT NULL,
|
label varchar(64) NOT NULL,
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
fk_parent integer,
|
fk_parent integer,
|
||||||
description varchar(255) NOT NULL,
|
description varchar(255) NOT NULL,
|
||||||
cachenbofdoc integer NOT NULL DEFAULT 0,
|
cachenbofdoc integer NOT NULL DEFAULT 0,
|
||||||
|
fullpath varchar(255), -- can be NULL for virtual directory
|
||||||
|
extraparams varchar(255), -- for stock other parameters with json format
|
||||||
date_c datetime,
|
date_c datetime,
|
||||||
date_m timestamp,
|
date_m timestamp,
|
||||||
fk_user_c integer,
|
fk_user_c integer,
|
||||||
|
|||||||
@ -30,6 +30,7 @@ create table llx_ecm_documents
|
|||||||
metadata text,
|
metadata text,
|
||||||
fullpath varchar(255) NOT NULL,
|
fullpath varchar(255) NOT NULL,
|
||||||
fk_directory integer,
|
fk_directory integer,
|
||||||
|
extraparams varchar(255), -- for stock other parameters with json format
|
||||||
fk_create integer NOT NULL,
|
fk_create integer NOT NULL,
|
||||||
fk_update integer,
|
fk_update integer,
|
||||||
date_c datetime NOT NULL,
|
date_c datetime NOT NULL,
|
||||||
|
|||||||
@ -69,7 +69,7 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
|
|||||||
$found=false;
|
$found=false;
|
||||||
|
|
||||||
// Multiprice
|
// Multiprice
|
||||||
if ($price_level >= 1) // If we need a particular price level (from 1 to 6)
|
if (isset($price_level) && $price_level >= 1) // If we need a particular price level (from 1 to 6)
|
||||||
{
|
{
|
||||||
$sql = "SELECT price, price_ttc, price_base_type, tva_tx";
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_price ";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_price ";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user