2
0
forked from Wavyzz/dolibarr

Fix: rename function sanitizeFileName into dol_sanitizeFileName to avoir conflict with fckeditor

This commit is contained in:
Laurent Destailleur
2009-04-29 18:02:50 +00:00
parent 407d4e7d0b
commit 7322cd136e
63 changed files with 347 additions and 347 deletions

View File

@@ -71,7 +71,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
/* /*
* Creation repertoire si n'existe pas * Creation repertoire si n'existe pas
*/ */
$upload_dir = $conf->commercial->dir_actions.'/'.sanitizeFileName($objectid); $upload_dir = $conf->commercial->dir_actions.'/'.dol_sanitizeFileName($objectid);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@@ -95,7 +95,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
*/ */
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {
$upload_dir = $conf->commercial->dir_actions.'/'.sanitizeFileName($objectid); $upload_dir = $conf->commercial->dir_actions.'/'.dol_sanitizeFileName($objectid);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
} }
@@ -113,7 +113,7 @@ if ($objectid > 0)
$act = new ActionComm($db); $act = new ActionComm($db);
if ($act->fetch($objectid)) if ($act->fetch($objectid))
{ {
$upload_dir = $conf->commercial->dir_actions.'/'.sanitizeFileName($objectid); $upload_dir = $conf->commercial->dir_actions.'/'.dol_sanitizeFileName($objectid);
$company=new Societe($db); $company=new Societe($db);
$company->fetch($act->societe->id); $company->fetch($act->societe->id);

View File

@@ -147,7 +147,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
@@ -202,7 +202,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
if ($conf->commande->enabled && $user->rights->commande->lire) if ($conf->commande->enabled && $user->rights->commande->lire)
{ {
$langs->load("orders"); $langs->load("orders");
$sql = "SELECT c.rowid, c.ref, c.total_ttc, s.rowid as socid, s.nom, s.client"; $sql = "SELECT c.rowid, c.ref, c.total_ttc, s.rowid as socid, s.nom, s.client";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
@@ -314,8 +314,8 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
if (($objp->fk_statut <= 1) && $objp->dp < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); if (($objp->fk_statut <= 1) && $objp->dp < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '<td width="16" align="center" class="nobordernopadding">'; print '<td width="16" align="center" class="nobordernopadding">';
$filename=sanitizeFileName($objp->ref); $filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->propale->dir_output . '/' . sanitizeFileName($objp->ref); $filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid; $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
@@ -513,8 +513,8 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
if ($obj->dp < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); if ($obj->dp < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '<td width="16" align="center" class="nobordernopadding">'; print '<td width="16" align="center" class="nobordernopadding">';
$filename=sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propale->dir_output . '/' . sanitizeFileName($obj->ref); $filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$obj->propalid; $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$obj->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@@ -404,7 +404,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
$propal= new Propal($db); $propal= new Propal($db);
if ( $propal->fetch($_POST['propalid']) ) if ( $propal->fetch($_POST['propalid']) )
{ {
$propalref = sanitizeFileName($propal->ref); $propalref = dol_sanitizeFileName($propal->ref);
$file = $conf->propale->dir_output . '/' . $propalref . '/' . $propalref . '.pdf'; $file = $conf->propale->dir_output . '/' . $propalref . '/' . $propalref . '.pdf';
if (is_readable($file)) if (is_readable($file))
@@ -1785,7 +1785,7 @@ if ($id > 0 || ! empty($ref))
// Send // Send
if ($propal->statut == 1 && $user->rights->propale->envoyer) if ($propal->statut == 1 && $user->rights->propale->envoyer)
{ {
$propref = sanitizeFileName($propal->ref); $propref = dol_sanitizeFileName($propal->ref);
$file = $conf->propale->dir_output . '/'.$propref.'/'.$propref.'.pdf'; $file = $conf->propale->dir_output . '/'.$propref.'/'.$propref.'.pdf';
if (file_exists($file)) if (file_exists($file))
{ {
@@ -1849,8 +1849,8 @@ if ($id > 0 || ! empty($ref))
/* /*
* Documents generes * Documents generes
*/ */
$filename=sanitizeFileName($propal->ref); $filename=dol_sanitizeFileName($propal->ref);
$filedir=$conf->propale->dir_output . "/" . sanitizeFileName($propal->ref); $filedir=$conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);
$urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id; $urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id;
$genallowed=$user->rights->propale->creer; $genallowed=$user->rights->propale->creer;
$delallowed=$user->rights->propale->supprimer; $delallowed=$user->rights->propale->supprimer;
@@ -1910,7 +1910,7 @@ if ($id > 0 || ! empty($ref))
*/ */
if ($_GET['action'] == 'presend') if ($_GET['action'] == 'presend')
{ {
$ref = sanitizeFileName($propal->ref); $ref = dol_sanitizeFileName($propal->ref);
$file = $conf->propale->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->propale->dir_output . '/' . $ref . '/' . $ref . '.pdf';
print '<br>'; print '<br>';
@@ -2115,8 +2115,8 @@ else
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($objp->ref); $filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->propale->dir_output . '/' . sanitizeFileName($objp->ref); $filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid; $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);

View File

@@ -133,7 +133,7 @@ if ($_GET["propalid"] > 0)
/* /*
* Documents * Documents
*/ */
$propalref = sanitizeFileName($propal->ref); $propalref = dol_sanitizeFileName($propal->ref);
$dir_output = $conf->propale->dir_output . "/"; $dir_output = $conf->propale->dir_output . "/";
$filepath = $dir_output . $propalref . "/"; $filepath = $dir_output . $propalref . "/";
$file = $filepath . $propalref . ".pdf"; $file = $filepath . $propalref . ".pdf";

View File

@@ -72,7 +72,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
if ($propal->fetch($propalid)) if ($propal->fetch($propalid))
{ {
$upload_dir = $conf->propale->dir_output . "/" . sanitizeFileName($propal->ref); $upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@@ -100,7 +100,7 @@ if ($action=='delete')
$propalid=$_GET["id"]; $propalid=$_GET["id"];
if ($propal->fetch($propalid)) if ($propal->fetch($propalid))
{ {
$upload_dir = $conf->propale->dir_output . "/" . sanitizeFileName($propal->ref); $upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@@ -119,7 +119,7 @@ if ($propalid > 0)
$propal = new Propal($db); $propal = new Propal($db);
if ($propal->fetch($propalid)) if ($propal->fetch($propalid))
{ {
$upload_dir = $conf->propale->dir_output.'/'.sanitizeFileName($propal->ref); $upload_dir = $conf->propale->dir_output.'/'.dol_sanitizeFileName($propal->ref);
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($propal->socid); $societe->fetch($propal->socid);

View File

@@ -126,7 +126,7 @@ if ($_GET["id"] > 0) {
/* /*
* Documents * Documents
*/ */
$commanderef = sanitizeFileName($commande->ref); $commanderef = dol_sanitizeFileName($commande->ref);
$dir_output = $conf->commande->dir_output . "/"; $dir_output = $conf->commande->dir_output . "/";
$filepath = $dir_output . $commanderef . "/"; $filepath = $dir_output . $commanderef . "/";
$file = $filepath . $commanderef . ".pdf"; $file = $filepath . $commanderef . ".pdf";

View File

@@ -257,8 +257,8 @@ class Commande extends CommonObject
{ {
// On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref) // On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref)
// afin de ne pas perdre les fichiers attach<63>s // afin de ne pas perdre les fichiers attach<63>s
$comref = sanitizeFileName($this->ref); $comref = dol_sanitizeFileName($this->ref);
$snum = sanitizeFileName($num); $snum = dol_sanitizeFileName($num);
$dirsource = $conf->commande->dir_output.'/'.$comref; $dirsource = $conf->commande->dir_output.'/'.$comref;
$dirdest = $conf->commande->dir_output.'/'.$snum; $dirdest = $conf->commande->dir_output.'/'.$snum;
if (file_exists($dirsource)) if (file_exists($dirsource))
@@ -699,7 +699,7 @@ class Commande extends CommonObject
function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0) function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0)
{ {
dol_syslog("Commande::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG); dol_syslog("Commande::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG);
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
// Clean parameters // Clean parameters
@@ -763,7 +763,7 @@ class Commande extends CommonObject
$ligne->total_tva=$total_tva; $ligne->total_tva=$total_tva;
$ligne->total_ttc=$total_ttc; $ligne->total_ttc=$total_ttc;
$ligne->product_type=$type; $ligne->product_type=$type;
// \TODO Ne plus utiliser // \TODO Ne plus utiliser
$ligne->price=$price; $ligne->price=$price;
$ligne->remise=$remise; $ligne->remise=$remise;
@@ -1066,7 +1066,7 @@ class Commande extends CommonObject
{ {
$this->lignes=array(); // deprecated $this->lignes=array(); // deprecated
$this->lines=array(); $this->lines=array();
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,'; $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,';
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.marge_tx, l.marque_tx, l.rang, l.info_bits,'; $sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.marge_tx, l.marque_tx, l.rang, l.info_bits,';
$sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.date_start, l.date_end,'; $sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.date_start, l.date_end,';
@@ -1799,7 +1799,7 @@ class Commande extends CommonObject
} }
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
$comref = sanitizeFileName($this->ref); $comref = dol_sanitizeFileName($this->ref);
if ($conf->commande->dir_output) if ($conf->commande->dir_output)
{ {
$dir = $conf->commande->dir_output . "/" . $comref ; $dir = $conf->commande->dir_output . "/" . $comref ;
@@ -2170,7 +2170,7 @@ class Commande extends CommonObject
$clause = "AND"; $clause = "AND";
} }
$sql.= " ".$clause." s.entity = ".$conf->entity; $sql.= " ".$clause." s.entity = ".$conf->entity;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@@ -75,7 +75,7 @@ if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0)
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
$upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref); $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@@ -97,7 +97,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Delete // Delete
if ($action=='delete') if ($action=='delete')
{ {
$upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref); $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@@ -114,7 +114,7 @@ $html = new Form($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$upload_dir = $conf->commande->dir_output.'/'.sanitizeFileName($commande->ref); $upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($commande->ref);
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($commande->socid); $societe->fetch($commande->socid);

View File

@@ -724,7 +724,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
$result=$commande->fetch($_POST['orderid']); $result=$commande->fetch($_POST['orderid']);
if ($result) if ($result)
{ {
$ref = sanitizeFileName($commande->ref); $ref = dol_sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (is_readable($file)) if (is_readable($file))
@@ -1267,7 +1267,7 @@ else
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$commande->ref),'confirm_clone',$formquestion,'yes'); $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$commande->ref),'confirm_clone',$formquestion,'yes');
print '<br>'; print '<br>';
} }
/* /*
* Commande * Commande
*/ */
@@ -1966,7 +1966,7 @@ else
{ {
if ($user->rights->commande->envoyer) if ($user->rights->commande->envoyer)
{ {
$comref = sanitizeFileName($commande->ref); $comref = dol_sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf'; $file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
if (file_exists($file)) if (file_exists($file))
{ {
@@ -2075,7 +2075,7 @@ else
* Documents generes * Documents generes
* *
*/ */
$comref = sanitizeFileName($commande->ref); $comref = dol_sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf'; $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
$relativepath = $comref.'/'.$comref.'.pdf'; $relativepath = $comref.'/'.$comref.'.pdf';
$filedir = $conf->commande->dir_output . '/' . $comref; $filedir = $conf->commande->dir_output . '/' . $comref;
@@ -2142,7 +2142,7 @@ else
*/ */
if ($_GET['action'] == 'presend') if ($_GET['action'] == 'presend')
{ {
$ref = sanitizeFileName($commande->ref); $ref = dol_sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
print '<br>'; print '<br>';

View File

@@ -157,8 +157,8 @@ if ( $db->query($sql) )
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
@@ -193,7 +193,7 @@ $sql.= " ORDER BY c.rowid DESC";
if ( $db->query($sql) ) if ( $db->query($sql) )
{ {
$num = $db->num_rows(); $num = $db->num_rows();
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("OnProcessOrders").' ('.$num.')</td></tr>'; print '<td colspan="3">'.$langs->trans("OnProcessOrders").' ('.$num.')</td></tr>';
@@ -222,8 +222,8 @@ if ( $db->query($sql) )
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
@@ -290,8 +290,8 @@ if ($resql)
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@@ -199,14 +199,14 @@ if ($resql)
print '<td width="90" class="nobordernopadding" nowrap="nowrap">'; print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
print $generic_commande->getNomUrl(1,$objp->fk_statut); print $generic_commande->getNomUrl(1,$objp->fk_statut);
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $objp->date_commande < ($now - $conf->commande->traitement->warning_delay)) print img_picto($langs->trans("Late"),"warning"); if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $objp->date_commande < ($now - $conf->commande->traitement->warning_delay)) print img_picto($langs->trans("Late"),"warning");
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($objp->ref); $filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($objp->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
@@ -214,9 +214,9 @@ if ($resql)
print '</td>'; print '</td>';
print '<td><a href="../comm/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>'; print '<td><a href="../comm/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
print '<td>'.$objp->ref_client.'</td>'; print '<td>'.$objp->ref_client.'</td>';
// Date // Date
$y = dol_print_date($objp->date_commande,'%Y'); $y = dol_print_date($objp->date_commande,'%Y');
$m = dol_print_date($objp->date_commande,'%m'); $m = dol_print_date($objp->date_commande,'%m');

View File

@@ -41,16 +41,16 @@ if ($_POST["action"] == 'add')
{ {
// Creation compte // Creation compte
$account = new Account($db,0); $account = new Account($db,0);
$account->ref = sanitizeFileName(trim($_POST["ref"])); $account->ref = dol_sanitizeFileName(trim($_POST["ref"]));
$account->label = trim($_POST["label"]); $account->label = trim($_POST["label"]);
$account->courant = $_POST["type"]; $account->courant = $_POST["type"];
$account->clos = $_POST["clos"]; $account->clos = $_POST["clos"];
$account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1; $account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
$account->url = $_POST["url"]; $account->url = $_POST["url"];
$account->account_number = trim($_POST["account_number"]); $account->account_number = trim($_POST["account_number"]);
$account->solde = $_POST["solde"]; $account->solde = $_POST["solde"];
$account->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); $account->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
@@ -60,7 +60,7 @@ if ($_POST["action"] == 'add')
$account->min_allowed = $_POST["account_min_allowed"]; $account->min_allowed = $_POST["account_min_allowed"];
$account->min_desired = $_POST["account_min_desired"]; $account->min_desired = $_POST["account_min_desired"];
$account->comment = trim($_POST["account_comment"]); $account->comment = trim($_POST["account_comment"]);
if ($account->label) if ($account->label)
{ {
$id = $account->create($user->id); $id = $account->create($user->id);
@@ -187,7 +187,7 @@ if ($_GET["action"] == 'create')
print '<input type="hidden" name="account_number" value="'.$account->account_number.'">'; print '<input type="hidden" name="account_number" value="'.$account->account_number.'">';
} }
// Currency // Currency
print '<tr><td valign="top">'.$langs->trans("Currency").'</td>'; print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
/* /*
@@ -199,7 +199,7 @@ if ($_GET["action"] == 'create')
print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">'; print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">';
print '</td></tr>'; print '</td></tr>';
// Pays // Pays
print '<tr><td valign="top">'.$langs->trans("Country").'</td>'; print '<tr><td valign="top">'.$langs->trans("Country").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$selectedcode=$account->account_country_code; $selectedcode=$account->account_country_code;
@@ -256,19 +256,19 @@ if ($_GET["action"] == 'create')
/* ************************************************************************** */ /* ************************************************************************** */
else else
{ {
if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit') if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit')
{ {
$account = new Account($db); $account = new Account($db);
if ($_GET["id"]) if ($_GET["id"])
{ {
$account->fetch($_GET["id"]); $account->fetch($_GET["id"]);
} }
if ($_GET["ref"]) if ($_GET["ref"])
{ {
$account->fetch(0,$_GET["ref"]); $account->fetch(0,$_GET["ref"]);
$_GET["id"]=$account->id; $_GET["id"]=$account->id;
} }
/* /*
* Affichage onglets * Affichage onglets
*/ */
@@ -276,7 +276,7 @@ else
// Onglets // Onglets
$head=bank_prepare_head($account); $head=bank_prepare_head($account);
dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount")); dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"));
/* /*
* Confirmation de la suppression * Confirmation de la suppression
*/ */
@@ -285,30 +285,30 @@ else
$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); $form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
print '<br />'; print '<br />';
} }
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>'; print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($account,'ref','',1,'ref'); print $form->showrefnav($account,'ref','',1,'ref');
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Label").'</td>'; print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$account->label.'</td></tr>'; print '<td colspan="3">'.$account->label.'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>'; print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>'; print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Status").'</td>'; print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>'; print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>'; print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($account->type == 0 || $account->type == 1) print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); if ($account->type == 0 || $account->type == 1) print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
if ($account->type == 2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; if ($account->type == 2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
print '</td></tr>'; print '</td></tr>';
// Code compta // Code compta
if ($conf->comptaexpert->enabled) if ($conf->comptaexpert->enabled)
{ {
@@ -316,7 +316,7 @@ else
print '<td colspan="3">'.$account->account_number.'</td></tr>'; print '<td colspan="3">'.$account->account_number.'</td></tr>';
} }
// Currency // Currency
print '<tr><td valign="top">'.$langs->trans("Currency").'</td>'; print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
/* /*
@@ -327,10 +327,10 @@ else
print $langs->trans("Currency".$conf->monnaie); print $langs->trans("Currency".$conf->monnaie);
print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">'; print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">';
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>'; print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td colspan="3">'.$account->min_allowed.'</td></tr>'; print '<td colspan="3">'.$account->min_allowed.'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>'; print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<td colspan="3">'.$account->min_desired.'</td></tr>'; print '<td colspan="3">'.$account->min_desired.'</td></tr>';
@@ -339,34 +339,34 @@ else
print $account->url; print $account->url;
if ($account->url) print '</a>'; if ($account->url) print '</a>';
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>'; print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
print '<td colspan="3">'.$account->comment.'</td></tr>'; print '<td colspan="3">'.$account->comment.'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
/* /*
* Barre d'actions * Barre d'actions
* *
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->banque->configurer) if ($user->rights->banque->configurer)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Modify").'</a>';
} }
$canbedeleted=$account->can_be_deleted(); // Renvoi vrai si compte sans mouvements $canbedeleted=$account->can_be_deleted(); // Renvoi vrai si compte sans mouvements
if ($user->rights->banque->configurer && $canbedeleted) if ($user->rights->banque->configurer && $canbedeleted)
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$account->id.'">'.$langs->trans("Delete").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$account->id.'">'.$langs->trans("Delete").'</a>';
} }
print '</div>'; print '</div>';
} }
/* ************************************************************************** */ /* ************************************************************************** */
@@ -374,46 +374,46 @@ else
/* Edition */ /* Edition */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($_GET["id"] && $_GET["action"] == 'edit' && $user->rights->banque->configurer) if ($_GET["id"] && $_GET["action"] == 'edit' && $user->rights->banque->configurer)
{ {
$account = new Account($db, $_GET["id"]); $account = new Account($db, $_GET["id"]);
$account->fetch($_GET["id"]); $account->fetch($_GET["id"]);
print_titre($langs->trans("EditFinancialAccount")); print_titre($langs->trans("EditFinancialAccount"));
print "<br>"; print "<br>";
if ($message) { print "$message<br>\n"; } if ($message) { print "$message<br>\n"; }
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$_GET["id"].'">'."\n\n"; print '<input type="hidden" name="id" value="'.$_GET["id"].'">'."\n\n";
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td valign="top">'.$langs->trans("Ref").'</td>'; print '<tr><td valign="top">'.$langs->trans("Ref").'</td>';
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.$account->ref.'"></td></tr>'; print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.$account->ref.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("Label").'</td>'; print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.$account->label.'"></td></tr>'; print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.$account->label.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>'; print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->select_type_comptes_financiers($account->type,"type"); print $form->select_type_comptes_financiers($account->type,"type");
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Status").'</td>'; print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$form->select_array("clos",array(0=>$account->status[0],1=>$account->status[1]),$account->clos); $form->select_array("clos",array(0=>$account->status[0],1=>$account->status[1]),$account->clos);
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>'; print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
if ($account->type == 0 || $account->type == 1) print '<input type="checkbox" class="flat" name="norappro" '.($account->rappro?'':'checked="true"').'"> '.$langs->trans("DisableConciliation"); if ($account->type == 0 || $account->type == 1) print '<input type="checkbox" class="flat" name="norappro" '.($account->rappro?'':'checked="true"').'"> '.$langs->trans("DisableConciliation");
if ($account->type == 2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; if ($account->type == 2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
print '</td></tr>'; print '</td></tr>';
// Code compta // Code compta
if ($conf->comptaexpert->enabled) if ($conf->comptaexpert->enabled)
{ {
@@ -425,7 +425,7 @@ else
print '<input type="hidden" name="account_number" value="'.$account->account_number.'">'; print '<input type="hidden" name="account_number" value="'.$account->account_number.'">';
} }
// Currency // Currency
print '<tr><td valign="top">'.$langs->trans("Currency"); print '<tr><td valign="top">'.$langs->trans("Currency");
print '<input type="hidden" value="'.$account->currency_code.'">'; print '<input type="hidden" value="'.$account->currency_code.'">';
print '</td>'; print '</td>';
@@ -438,10 +438,10 @@ else
print $langs->trans("Currency".$conf->monnaie); print $langs->trans("Currency".$conf->monnaie);
print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">'; print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">';
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>'; print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.$account->min_allowed.'"></td></tr>'; print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.$account->min_allowed.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>'; print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.$account->min_desired.'"></td></tr>'; print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.$account->min_desired.'"></td></tr>';
@@ -466,7 +466,7 @@ else
print dol_htmlentitiesbr_decode($account->comment).'</textarea>'; print dol_htmlentitiesbr_decode($account->comment).'</textarea>';
} }
print '</td></tr>'; print '</td></tr>';
print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">'; print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
print ' &nbsp; <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">'; print ' &nbsp; <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
print '</td></tr>'; print '</td></tr>';
@@ -474,7 +474,7 @@ else
print '</form>'; print '</form>';
} }
} }

View File

@@ -526,7 +526,7 @@ if ($id > 0 || ! empty($ref))
* Documents g<>n<EFBFBD>r<EFBFBD>s * Documents g<>n<EFBFBD>r<EFBFBD>s
* *
*/ */
$comref = sanitizeFileName($commande->ref); $comref = dol_sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf'; $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
$relativepath = $comref.'/'.$comref.'.pdf'; $relativepath = $comref.'/'.$comref.'.pdf';
$filedir = $conf->commande->dir_output . '/' . $comref; $filedir = $conf->commande->dir_output . '/' . $comref;

View File

@@ -132,28 +132,28 @@ if ($resql)
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td width="20%" nowrap="nowrap">'; print '<td width="20%" nowrap="nowrap">';
$generic_commande->id=$objp->rowid; $generic_commande->id=$objp->rowid;
$generic_commande->ref=$objp->ref; $generic_commande->ref=$objp->ref;
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td width="90" class="nobordernopadding" nowrap="nowrap">'; print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
print $generic_commande->getNomUrl(1); print $generic_commande->getNomUrl(1);
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
if (($objp->date_commande < ($now - $conf->commande->traitement->warning_delay)) && $objp->statutid == 1 ) print img_picto($langs->trans("Late"),"warning"); if (($objp->date_commande < ($now - $conf->commande->traitement->warning_delay)) && $objp->statutid == 1 ) print img_picto($langs->trans("Late"),"warning");
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($objp->ref); $filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($objp->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
print '</td>'; print '</td>';
print "<td><a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid."\">".img_object($langs->trans("ShowCompany"),"company")." ".$objp->nom."</a>"; print "<td><a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid."\">".img_object($langs->trans("ShowCompany"),"company")." ".$objp->nom."</a>";

View File

@@ -454,7 +454,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
/* /*
* Documents g<>n<EFBFBD>r<EFBFBD>s * Documents g<>n<EFBFBD>r<EFBFBD>s
*/ */
$filename=sanitizeFileName($don->id); $filename=dol_sanitizeFileName($don->id);
$filedir=$conf->don->dir_output . '/' . get_exdir($filename,2); $filedir=$conf->don->dir_output . '/' . get_exdir($filename,2);
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$don->id; $urlsource=$_SERVER['PHP_SELF'].'?rowid='.$don->id;
// $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer); // $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer);

View File

@@ -1150,7 +1150,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
$result=$fac->fetch($_POST['facid']); $result=$fac->fetch($_POST['facid']);
if ($result) if ($result)
{ {
$ref = sanitizeFileName($fac->ref); $ref = dol_sanitizeFileName($fac->ref);
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (is_readable($file)) if (is_readable($file))
@@ -3338,8 +3338,8 @@ else
/* /*
* Documents g<>n<EFBFBD>r<EFBFBD>s * Documents g<>n<EFBFBD>r<EFBFBD>s
*/ */
$filename=sanitizeFileName($fac->ref); $filename=dol_sanitizeFileName($fac->ref);
$filedir=$conf->facture->dir_output . '/' . sanitizeFileName($fac->ref); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($fac->ref);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
$genallowed=$user->rights->facture->creer; $genallowed=$user->rights->facture->creer;
$delallowed=$user->rights->facture->supprimer; $delallowed=$user->rights->facture->supprimer;
@@ -3474,7 +3474,7 @@ else
*/ */
if ($_GET['action'] == 'presend') if ($_GET['action'] == 'presend')
{ {
$ref = sanitizeFileName($fac->ref); $ref = dol_sanitizeFileName($fac->ref);
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
// Construit PDF si non existant // Construit PDF si non existant
@@ -3541,7 +3541,7 @@ else
if ($_GET['action'] == 'prerelance') if ($_GET['action'] == 'prerelance')
{ {
$ref = sanitizeFileName($fac->ref); $ref = dol_sanitizeFileName($fac->ref);
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
// Construit PDF si non existant // Construit PDF si non existant
@@ -3787,8 +3787,8 @@ else
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($objp->facnumber); $filename=dol_sanitizeFileName($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitizeFileName($objp->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
print '</td>'; print '</td>';

View File

@@ -136,7 +136,7 @@ if ($_GET["facid"] > 0)
/* /*
* Documents * Documents
*/ */
$facref = sanitizeFileName($fac->ref); $facref = dol_sanitizeFileName($fac->ref);
$dir_output = $conf->facture->dir_output . "/"; $dir_output = $conf->facture->dir_output . "/";
$filepath = $dir_output . $facref . "/"; $filepath = $dir_output . $facref . "/";
$file = $filepath . $facref . ".pdf"; $file = $filepath . $facref . ".pdf";

View File

@@ -73,7 +73,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$facture = new Facture($db); $facture = new Facture($db);
if ($facture->fetch($facid)) if ($facture->fetch($facid))
{ {
$upload_dir = $conf->facture->dir_output . "/" . sanitizeFileName($facture->ref); $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($facture->ref);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@@ -101,7 +101,7 @@ if ($action=='delete')
$facid=$_GET["id"]; $facid=$_GET["id"];
if ($facture->fetch($facid)) if ($facture->fetch($facid))
{ {
$upload_dir = $conf->facture->dir_output . "/" . sanitizeFileName($facture->ref); $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($facture->ref);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@@ -119,7 +119,7 @@ if ($facid > 0)
$facture = new Facture($db); $facture = new Facture($db);
if ($facture->fetch($facid)) if ($facture->fetch($facid))
{ {
$upload_dir = $conf->facture->dir_output.'/'.sanitizeFileName($facture->ref); $upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($facture->ref);
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($facture->socid); $societe->fetch($facture->socid);

View File

@@ -96,8 +96,8 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
create_exdir($diroutputpdf); create_exdir($diroutputpdf);
// Save merged file // Save merged file
$filename=strtolower(sanitizeFileName($langs->transnoentities("Unpayed"))); $filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Unpayed")));
if ($option=='late') $filename.='_'.strtolower(sanitizeFileName($langs->transnoentities("Late"))); if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
if ($pagecount) if ($pagecount)
{ {
$file=$diroutputpdf.'/'.$filename.'_'.dol_print_date(mktime(),'dayhourlog').'.pdf'; $file=$diroutputpdf.'/'.$filename.'_'.dol_print_date(mktime(),'dayhourlog').'.pdf';
@@ -338,8 +338,8 @@ if ($result)
// PDF Picto // PDF Picto
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($objp->facnumber); $filename=dol_sanitizeFileName($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitizeFileName($objp->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber);
$foundpdf=$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1,$param); $foundpdf=$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1,$param);
print '</td>'; print '</td>';

View File

@@ -555,8 +555,8 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';
@@ -651,8 +651,8 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
if ($obj->datelimite < ($now - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late")); if ($obj->datelimite < ($now - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($obj->facnumber); $filename=dol_sanitizeFileName($obj->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitizeFileName($obj->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@@ -491,8 +491,8 @@ if ($id > 0 || ! empty($ref))
/* /*
* Documents generes * Documents generes
*/ */
$filename=sanitizeFileName($propal->ref); $filename=dol_sanitizeFileName($propal->ref);
$filedir=$conf->propale->dir_output . "/" . sanitizeFileName($propal->ref); $filedir=$conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);
$urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id; $urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id;
$genallowed=0; $genallowed=0;
$delallowed=0; $delallowed=0;
@@ -773,8 +773,8 @@ else
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($objp->ref); $filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->propale->dir_output . '/' . sanitizeFileName($objp->ref); $filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid; $urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1); $formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);

View File

@@ -85,8 +85,8 @@ $db->close();
$output = $v->getVCard(); $output = $v->getVCard();
$filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf" $filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
$filenameurlencoded = sanitizeFileName(urlencode($filename)); $filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
//$filename = sanitizeFileName($filename); //$filename = dol_sanitizeFileName($filename);
Header("Content-Disposition: attachment; filename=\"$filename\""); Header("Content-Disposition: attachment; filename=\"$filename\"");
Header("Content-Length: ".strlen($output)); Header("Content-Length: ".strlen($output));

View File

@@ -63,7 +63,7 @@ $pagenext = $page + 1;
$contrat = new Contrat($db); $contrat = new Contrat($db);
$contrat->fetch($_GET["id"]); $contrat->fetch($_GET["id"]);
$upload_dir = $conf->contrat->dir_output.'/'.sanitizeFileName($contrat->ref); $upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($contrat->ref);
$modulepart='contract'; $modulepart='contract';

View File

@@ -38,31 +38,31 @@ class EcmDirectory // extends CommonObject
var $errors=array(); //!< To return several error codes (or messages) var $errors=array(); //!< To return several error codes (or messages)
//var $element='ecm_directories'; //!< Id that identify managed objects //var $element='ecm_directories'; //!< Id that identify managed objects
//var $table_element='ecm_directories'; //!< Name of table without prefix where object is stored //var $table_element='ecm_directories'; //!< Name of table without prefix where object is stored
var $id; var $id;
var $label; var $label;
var $fk_parent; var $fk_parent;
var $description; var $description;
var $cachenbofdoc; var $cachenbofdoc;
var $date_c; var $date_c;
var $date_m; var $date_m;
var $cats=array(); var $cats=array();
var $motherof=array(); var $motherof=array();
/** /**
* \brief Constructor * \brief Constructor
* \param DB Database handler * \param DB Database handler
*/ */
function EcmDirectory($DB) function EcmDirectory($DB)
{ {
$this->db = $DB; $this->db = $DB;
return 1; return 1;
} }
/** /**
* \brief Create in database * \brief Create in database
* \param user User that create * \param user User that create
@@ -71,9 +71,9 @@ class EcmDirectory // extends CommonObject
function create($user) function create($user)
{ {
global $conf, $langs; global $conf, $langs;
$now=time(); $now=time();
// Clean parameters // Clean parameters
$this->label=dol_string_nospecial(trim($this->label)); $this->label=dol_string_nospecial(trim($this->label));
$this->fk_parent=trim($this->fk_parent); $this->fk_parent=trim($this->fk_parent);
@@ -112,12 +112,12 @@ class EcmDirectory // extends CommonObject
{ {
$this->error="ErrorDirAlreadyExists"; $this->error="ErrorDirAlreadyExists";
dol_syslog("EcmDirectories::create ".$this->error, LOG_WARNING); dol_syslog("EcmDirectories::create ".$this->error, LOG_WARNING);
return -1; return -1;
} }
else else
{ {
$this->db->begin(); $this->db->begin();
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."ecm_directories("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."ecm_directories(";
$sql.= "label,"; $sql.= "label,";
@@ -136,23 +136,23 @@ class EcmDirectory // extends CommonObject
$sql.= " ".$this->db->idate($this->date_c).","; $sql.= " ".$this->db->idate($this->date_c).",";
$sql.= " '".$this->fk_user_c."'"; $sql.= " '".$this->fk_user_c."'";
$sql.= ")"; $sql.= ")";
dol_syslog("EcmDirectories::create sql=".$sql, LOG_DEBUG); dol_syslog("EcmDirectories::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ecm_directories"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ecm_directories");
$dir=$conf->ecm->dir_output.'/'.$this->getRelativePath(); $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
$result=create_exdir($dir); $result=create_exdir($dir);
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
@@ -183,26 +183,26 @@ class EcmDirectory // extends CommonObject
function update($user=0, $notrigger=0) function update($user=0, $notrigger=0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
// Clean parameters // Clean parameters
$this->label=trim($this->label); $this->label=trim($this->label);
$this->fk_parent=trim($this->fk_parent); $this->fk_parent=trim($this->fk_parent);
$this->description=trim($this->description); $this->description=trim($this->description);
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
$this->db->begin(); $this->db->begin();
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
$sql.= " label='".addslashes($this->label)."',"; $sql.= " label='".addslashes($this->label)."',";
$sql.= " fk_parent='".$this->fk_parent."',"; $sql.= " fk_parent='".$this->fk_parent."',";
$sql.= " description='".addslashes($this->description)."'"; $sql.= " description='".addslashes($this->description)."'";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dol_syslog("EcmDirectories::update sql=".$sql, LOG_DEBUG); dol_syslog("EcmDirectories::update sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
@@ -211,7 +211,7 @@ class EcmDirectory // extends CommonObject
$this->error="Error ".$this->db->lasterror(); $this->error="Error ".$this->db->lasterror();
dol_syslog("EcmDirectories::update ".$this->error, LOG_ERR); dol_syslog("EcmDirectories::update ".$this->error, LOG_ERR);
} }
if (! $error && ! $notrigger) if (! $error && ! $notrigger)
{ {
// Appel des triggers // Appel des triggers
@@ -221,7 +221,7 @@ class EcmDirectory // extends CommonObject
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
} }
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
@@ -233,8 +233,8 @@ class EcmDirectory // extends CommonObject
return -1; return -1;
} }
} }
/** /**
* \brief Update database * \brief Update database
* \sign '+' or '-' * \sign '+' or '-'
@@ -243,7 +243,7 @@ class EcmDirectory // extends CommonObject
function changeNbOfFiles($sign) function changeNbOfFiles($sign)
{ {
global $conf, $langs; global $conf, $langs;
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
$sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1"; $sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1";
@@ -261,7 +261,7 @@ class EcmDirectory // extends CommonObject
return 1; return 1;
} }
/** /**
* \brief Load object in memory from database * \brief Load object in memory from database
* \param id id object * \param id id object
@@ -281,7 +281,7 @@ class EcmDirectory // extends CommonObject
$sql.= " ".$this->db->pdate('t.date_m')." as date_m"; $sql.= " ".$this->db->pdate('t.date_m')." as date_m";
$sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t"; $sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t";
$sql.= " WHERE t.rowid = ".$id; $sql.= " WHERE t.rowid = ".$id;
dol_syslog("EcmDirectories::fetch sql=".$sql, LOG_DEBUG); dol_syslog("EcmDirectories::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@@ -291,7 +291,7 @@ class EcmDirectory // extends CommonObject
{ {
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->label = $obj->label; $this->label = $obj->label;
$this->fk_parent = $obj->fk_parent; $this->fk_parent = $obj->fk_parent;
$this->description = $obj->description; $this->description = $obj->description;
@@ -301,9 +301,9 @@ class EcmDirectory // extends CommonObject
$this->date_c = $obj->date_c; $this->date_c = $obj->date_c;
$this->date_m = $obj->date_m; $this->date_m = $obj->date_m;
} }
$this->db->free($resql); $this->db->free($resql);
return $obj?1:0; return $obj?1:0;
} }
else else
@@ -313,8 +313,8 @@ class EcmDirectory // extends CommonObject
return -1; return -1;
} }
} }
/** /**
* \brief Delete object in database * \brief Delete object in database
* \param user User that delete * \param user User that delete
@@ -323,10 +323,10 @@ class EcmDirectory // extends CommonObject
function delete($user) function delete($user)
{ {
global $conf, $langs; global $conf, $langs;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dol_syslog("EcmDirectories::delete sql=".$sql); dol_syslog("EcmDirectories::delete sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
@@ -335,10 +335,10 @@ class EcmDirectory // extends CommonObject
dol_syslog("EcmDirectories::delete ".$this->error, LOG_ERR); dol_syslog("EcmDirectories::delete ".$this->error, LOG_ERR);
return -1; return -1;
} }
$file = $conf->ecm->dir_output . "/" . $this->label; $file = $conf->ecm->dir_output . "/" . $this->label;
$result=@dol_delete_dir($file); $result=@dol_delete_dir($file);
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
@@ -349,7 +349,7 @@ class EcmDirectory // extends CommonObject
return 1; return 1;
} }
/** /**
* \brief Initialise object with example values * \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen. * \remarks id must be 0 if object instance is a specimen.
@@ -357,13 +357,13 @@ class EcmDirectory // extends CommonObject
function initAsSpecimen() function initAsSpecimen()
{ {
$this->id=0; $this->id=0;
$this->label='MyDirectory'; $this->label='MyDirectory';
$this->fk_parent='0'; $this->fk_parent='0';
$this->description='This is a directory'; $this->description='This is a directory';
} }
/** /**
\brief Renvoie nom clicable (avec eventuellement le picto) \brief Renvoie nom clicable (avec eventuellement le picto)
\param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
@@ -373,21 +373,21 @@ class EcmDirectory // extends CommonObject
function getNomUrl($withpicto=0,$option='') function getNomUrl($withpicto=0,$option='')
{ {
global $langs; global $langs;
$result=''; $result='';
$lien = '<a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$this->id.'">';
if ($option == 'index') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true">'; if ($option == 'index') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true">';
if ($option == 'indexexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=false">'; if ($option == 'indexexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=false">';
if ($option == 'indexnotexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true">'; if ($option == 'indexnotexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true">';
$lienfin='</a>'; $lienfin='</a>';
//$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif'; //$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
$picto='dir'; $picto='dir';
$newref=eregi_replace('_',' ',$this->ref); $newref=eregi_replace('_',' ',$this->ref);
$newlabel=$langs->trans("ShowECMSection").': '.$newref; $newlabel=$langs->trans("ShowECMSection").': '.$newref;
if ($withpicto) $result.=($lien.img_object($newlabel,$picto,'',1).$lienfin); if ($withpicto) $result.=($lien.img_object($newlabel,$picto,'',1).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$newref.$lienfin; if ($withpicto != 2) $result.=$lien.$newref.$lienfin;
@@ -402,7 +402,7 @@ class EcmDirectory // extends CommonObject
function getRelativePath($force=0) function getRelativePath($force=0)
{ {
$this->get_full_arbo($force); $this->get_full_arbo($force);
$ret=''; $ret='';
$idtosearch=$this->id; $idtosearch=$this->id;
$i=0; $i=0;
@@ -418,21 +418,21 @@ class EcmDirectory // extends CommonObject
} }
} }
//print "c=".$idtosearch."-".$cursorindex; //print "c=".$idtosearch."-".$cursorindex;
if ($cursorindex >= 0) if ($cursorindex >= 0)
{ {
// Path is label sanitized (no space and no special char) and concatenated // Path is label sanitized (no space and no special char) and concatenated
$ret=sanitizeFileName($this->cats[$cursorindex]['label']).'/'.$ret; $ret=dol_sanitizeFileName($this->cats[$cursorindex]['label']).'/'.$ret;
$idtosearch=$this->cats[$cursorindex]['id_mere']; $idtosearch=$this->cats[$cursorindex]['id_mere'];
$i++; $i++;
} }
} }
while ($cursorindex >= 0 && ! empty($idtosearch) && $i < 100); // i avoid infinite loop while ($cursorindex >= 0 && ! empty($idtosearch) && $i < 100); // i avoid infinite loop
return $ret; return $ret;
} }
/** /**
* \brief Load this->motherof that is array(id_son=>id_parent, ...) * \brief Load this->motherof that is array(id_son=>id_parent, ...)
* \return int <0 if KO, >0 if OK * \return int <0 if KO, >0 if OK
@@ -440,15 +440,15 @@ class EcmDirectory // extends CommonObject
function load_motherof() function load_motherof()
{ {
global $conf; global $conf;
$this->motherof=array(); $this->motherof=array();
// Charge tableau des meres // Charge tableau des meres
$sql = "SELECT fk_parent as id_parent, rowid as id_son"; $sql = "SELECT fk_parent as id_parent, rowid as id_son";
$sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories"; $sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories";
$sql.= " WHERE fk_parent != 0"; $sql.= " WHERE fk_parent != 0";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
dol_syslog("EcmDirectory::get_full_arbo sql=".$sql); dol_syslog("EcmDirectory::get_full_arbo sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@@ -465,7 +465,7 @@ class EcmDirectory // extends CommonObject
return -1; return -1;
} }
} }
/** /**
* \brief Reconstruit l'arborescence des categories sous la forme d'un tableau * \brief Reconstruit l'arborescence des categories sous la forme d'un tableau
@@ -488,14 +488,14 @@ class EcmDirectory // extends CommonObject
function get_full_arbo($force=0) function get_full_arbo($force=0)
{ {
global $conf; global $conf;
if (empty($force) && $this->full_arbo_loaded) if (empty($force) && $this->full_arbo_loaded)
{ {
return $this->cats; return $this->cats;
} }
// Init this->motherof that is array(id_son=>id_parent, ...) // Init this->motherof that is array(id_son=>id_parent, ...)
$this->load_motherof(); $this->load_motherof();
// Charge tableau des categories // Charge tableau des categories
$sql = "SELECT c.rowid as rowid, c.label as label,"; $sql = "SELECT c.rowid as rowid, c.label as label,";
@@ -528,7 +528,7 @@ class EcmDirectory // extends CommonObject
$this->cats[$obj->rowid]['date_c'] = $obj->date_c; $this->cats[$obj->rowid]['date_c'] = $obj->date_c;
$this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c; $this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c;
$this->cats[$obj->rowid]['login_c'] = $obj->login_c; $this->cats[$obj->rowid]['login_c'] = $obj->login_c;
if ($obj->rowid_fille) if ($obj->rowid_fille)
{ {
if (is_array($this->cats[$obj->rowid]['id_children'])) if (is_array($this->cats[$obj->rowid]['id_children']))
@@ -542,7 +542,7 @@ class EcmDirectory // extends CommonObject
//print "this->cats[".$obj->rowid."]['id_children'] n'est pas encore un tableau<br>"; //print "this->cats[".$obj->rowid."]['id_children'] n'est pas encore un tableau<br>";
$this->cats[$obj->rowid]['id_children']=array($obj->rowid_fille); $this->cats[$obj->rowid]['id_children']=array($obj->rowid_fille);
} }
} }
$i++; $i++;
} }
@@ -552,20 +552,20 @@ class EcmDirectory // extends CommonObject
dol_print_error ($this->db); dol_print_error ($this->db);
return -1; return -1;
} }
// On ajoute la propriete fullpath a tous les <20>l<EFBFBD>ments // On ajoute la propriete fullpath a tous les <20>l<EFBFBD>ments
foreach($this->cats as $key => $val) foreach($this->cats as $key => $val)
{ {
if (isset($motherof[$key])) continue; if (isset($motherof[$key])) continue;
$this->build_path_from_id_categ($key,0); $this->build_path_from_id_categ($key,0);
} }
$this->cats=dol_sort_array($this->cats, 'fulllabel', 'asc', true, false); $this->cats=dol_sort_array($this->cats, 'fulllabel', 'asc', true, false);
$this->full_arbo_loaded=1; $this->full_arbo_loaded=1;
return $this->cats; return $this->cats;
} }
/** /**
* \brief Calcule les proprietes fullpath et fulllabel d'une categorie * \brief Calcule les proprietes fullpath et fulllabel d'une categorie
* du tableau this->cats et de toutes ces enfants * du tableau this->cats et de toutes ces enfants
@@ -584,12 +584,12 @@ class EcmDirectory // extends CommonObject
} }
else else
{ {
$this->cats[$id_categ]['fullpath']='_'.$id_categ; $this->cats[$id_categ]['fullpath']='_'.$id_categ;
$this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label']; $this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label'];
} }
// We count number of _ to have level // We count number of _ to have level
$this->cats[$id_categ]['level']=strlen(eregi_replace('[^_]','',$this->cats[$id_categ]['fullpath'])); $this->cats[$id_categ]['level']=strlen(eregi_replace('[^_]','',$this->cats[$id_categ]['fullpath']));
// Traite ces enfants // Traite ces enfants
$protection++; $protection++;
if ($protection > 20) return; // On ne traite pas plus de 20 niveaux if ($protection > 20) return; // On ne traite pas plus de 20 niveaux
@@ -600,9 +600,9 @@ class EcmDirectory // extends CommonObject
$this->build_path_from_id_categ($val,$protection); $this->build_path_from_id_categ($val,$protection);
} }
} }
return 1; return 1;
} }
/** /**
* \brief Refresh value for cachenboffile * \brief Refresh value for cachenboffile
@@ -614,13 +614,13 @@ class EcmDirectory // extends CommonObject
{ {
global $conf; global $conf;
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$dir=$conf->ecm->dir_output.'/'.$this->getRelativePath(); $dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
$filelist=dol_dir_list($dir,'files',0,'','\.meta$'); $filelist=dol_dir_list($dir,'files',0,'','\.meta$');
// Test if filelist is in database // Test if filelist is in database
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
$sql.= " cachenbofdoc = '".sizeof($filelist)."'"; $sql.= " cachenbofdoc = '".sizeof($filelist)."'";
@@ -632,7 +632,7 @@ class EcmDirectory // extends CommonObject
{ {
$sql.= " WHERE entity = ".$conf->entity; $sql.= " WHERE entity = ".$conf->entity;
} }
dol_syslog("EcmDirectories::refreshcachenboffile sql=".$sql, LOG_DEBUG); dol_syslog("EcmDirectories::refreshcachenboffile sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@@ -646,7 +646,7 @@ class EcmDirectory // extends CommonObject
dol_syslog("EcmDirectories::refreshcachenboffile ".$this->error, LOG_ERR); dol_syslog("EcmDirectories::refreshcachenboffile ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
} }
?> ?>

View File

@@ -83,7 +83,7 @@ class Expedition extends CommonObject
// Clean parameters // Clean parameters
$this->brouillon = 1; $this->brouillon = 1;
$this->tracking_number = sanitizeFileName($this->tracking_number); $this->tracking_number = dol_sanitizeFileName($this->tracking_number);
$this->user = $user; $this->user = $user;
@@ -404,7 +404,7 @@ class Expedition extends CommonObject
} }
// On efface le r<>pertoire de pdf provisoire // On efface le r<>pertoire de pdf provisoire
$expeditionref = sanitizeFileName($provref); $expeditionref = dol_sanitizeFileName($provref);
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
$dir = $conf->expedition->dir_output . "/" . $expeditionref; $dir = $conf->expedition->dir_output . "/" . $expeditionref;
@@ -538,7 +538,7 @@ class Expedition extends CommonObject
$this->db->commit(); $this->db->commit();
// On efface le r<>pertoire de pdf provisoire // On efface le r<>pertoire de pdf provisoire
$expref = sanitizeFileName($this->ref); $expref = dol_sanitizeFileName($this->ref);
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
$dir = $conf->expedition->dir_output . "/" . $expref ; $dir = $conf->expedition->dir_output . "/" . $expref ;

View File

@@ -847,7 +847,7 @@ else
*/ */
if ($conf->expedition_bon->enabled) if ($conf->expedition_bon->enabled)
{ {
$expeditionref = sanitizeFileName($expedition->ref); $expeditionref = dol_sanitizeFileName($expedition->ref);
$filedir = $conf->expedition->dir_bon_expedition . "/" .$expeditionref; $filedir = $conf->expedition->dir_bon_expedition . "/" .$expeditionref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$expedition->id; $urlsource = $_SERVER["PHP_SELF"]."?id=".$expedition->id;

View File

@@ -1308,8 +1308,8 @@ class Facture extends CommonObject
{ {
// On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref) // On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref)
// afin de ne pas perdre les fichiers attach<63>s // afin de ne pas perdre les fichiers attach<63>s
$facref = sanitizeFileName($this->ref); $facref = dol_sanitizeFileName($this->ref);
$snumfa = sanitizeFileName($numfa); $snumfa = dol_sanitizeFileName($numfa);
$dirsource = $conf->facture->dir_output.'/'.$facref; $dirsource = $conf->facture->dir_output.'/'.$facref;
$dirdest = $conf->facture->dir_output.'/'.$snumfa; $dirdest = $conf->facture->dir_output.'/'.$snumfa;
if (file_exists($dirsource)) if (file_exists($dirsource))
@@ -2546,7 +2546,7 @@ class Facture extends CommonObject
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
$sql.= " AND f.fk_statut = 1"; $sql.= " AND f.fk_statut = 1";
if ($user->societe_id) $sql.= " AND f.fk_soc = ".$user->societe_id; if ($user->societe_id) $sql.= " AND f.fk_soc = ".$user->societe_id;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@@ -2674,7 +2674,7 @@ class Facture extends CommonObject
global $conf, $user; global $conf, $user;
$this->nb=array(); $this->nb=array();
$clause = "WHERE"; $clause = "WHERE";
$sql = "SELECT count(f.rowid) as nb"; $sql = "SELECT count(f.rowid) as nb";
@@ -2687,7 +2687,7 @@ class Facture extends CommonObject
$clause = "AND"; $clause = "AND";
} }
$sql.= " ".$clause." s.entity = ".$conf->entity; $sql.= " ".$clause." s.entity = ".$conf->entity;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@@ -109,7 +109,7 @@ if ($_GET["id"] > 0) {
/* /*
* Documents * Documents
*/ */
$fichinterref = sanitizeFileName($fichinter->ref); $fichinterref = dol_sanitizeFileName($fichinter->ref);
$dir_output = $conf->ficheinter->dir_output . "/"; $dir_output = $conf->ficheinter->dir_output . "/";
$filepath = $dir_output . $fichinterref . "/"; $filepath = $dir_output . $fichinterref . "/";
$file = $filepath . $fichinterref . ".pdf"; $file = $filepath . $fichinterref . ".pdf";

View File

@@ -64,7 +64,7 @@ $pagenext = $page + 1;
$object = new Fichinter($db); $object = new Fichinter($db);
$object->fetch($_GET["id"]); $object->fetch($_GET["id"]);
$upload_dir = $conf->ficheinter->dir_output.'/'.sanitizeFileName($object->ref); $upload_dir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($object->ref);
$modulepart='fichinter'; $modulepart='fichinter';

View File

@@ -509,10 +509,10 @@ elseif ($_GET["id"] > 0)
exit; exit;
} }
$fichinter->fetch_client(); $fichinter->fetch_client();
$societe=new Societe($db); $societe=new Societe($db);
$societe->fetch($fichinter->socid); $societe->fetch($fichinter->socid);
if ($mesg) print $mesg."<br>"; if ($mesg) print $mesg."<br>";
$head = fichinter_prepare_head($fichinter); $head = fichinter_prepare_head($fichinter);
@@ -902,7 +902,7 @@ elseif ($_GET["id"] > 0)
/* /*
* Built documents * Built documents
*/ */
$filename=sanitizeFileName($fichinter->ref); $filename=dol_sanitizeFileName($fichinter->ref);
$filedir=$conf->ficheinter->dir_output . "/".$fichinter->ref; $filedir=$conf->ficheinter->dir_output . "/".$fichinter->ref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id; $urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id;
$genallowed=$user->rights->ficheinter->creer; $genallowed=$user->rights->ficheinter->creer;

View File

@@ -387,9 +387,9 @@ class Fichinter extends CommonObject
if (! file_exists($dir.$file)) if (! file_exists($dir.$file))
{ {
$file='mod_'.$file; $file='mod_'.$file;
$classname='mod_'.$classname; $classname='mod_'.$classname;
} }
// Chargement de la classe de numerotation // Chargement de la classe de numerotation
require_once($dir.$file); require_once($dir.$file);
@@ -479,7 +479,7 @@ class Fichinter extends CommonObject
{ {
// Remove directory with files // Remove directory with files
$fichinterref = sanitizeFileName($this->ref); $fichinterref = dol_sanitizeFileName($this->ref);
if ($conf->ficheinter->dir_output) if ($conf->ficheinter->dir_output)
{ {
$dir = $conf->ficheinter->dir_output . "/" . $fichinterref ; $dir = $conf->ficheinter->dir_output . "/" . $fichinterref ;

View File

@@ -76,7 +76,7 @@ if ($commande->fetch($_GET['id'],$_GET['ref']) < 0)
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
$upload_dir = $conf->fournisseur->dir_commande . "/" . sanitizeFileName($commande->ref); $upload_dir = $conf->fournisseur->dir_commande . "/" . dol_sanitizeFileName($commande->ref);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@@ -98,7 +98,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Delete // Delete
if ($action=='delete') if ($action=='delete')
{ {
$upload_dir = $conf->fournisseur->dir_commande . "/" . sanitizeFileName($commande->ref); $upload_dir = $conf->fournisseur->dir_commande . "/" . dol_sanitizeFileName($commande->ref);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@@ -117,7 +117,7 @@ if ($id > 0 || ! empty($ref))
{ {
llxHeader(); llxHeader();
$upload_dir = $conf->fournisseur->dir_commande.'/'.sanitizeFileName($commande->ref); $upload_dir = $conf->fournisseur->dir_commande.'/'.dol_sanitizeFileName($commande->ref);
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->socid); $soc->fetch($commande->socid);

View File

@@ -995,7 +995,7 @@ if ($id > 0 || ! empty($ref))
/* /*
* Documents generes * Documents generes
*/ */
$comfournref = sanitizeFileName($commande->ref); $comfournref = dol_sanitizeFileName($commande->ref);
$file = $conf->fournisseur->dir_commande . '/' . $comfournref . '/' . $comfournref . '.pdf'; $file = $conf->fournisseur->dir_commande . '/' . $comfournref . '/' . $comfournref . '.pdf';
$relativepath = $comfournref.'/'.$comfournref.'.pdf'; $relativepath = $comfournref.'/'.$comfournref.'.pdf';
$filedir = $conf->fournisseur->dir_commande . '/' . $comfournref; $filedir = $conf->fournisseur->dir_commande . '/' . $comfournref;

View File

@@ -157,7 +157,7 @@ class FormFile
$forcenomultilang=0; $forcenomultilang=0;
} }
$filename = sanitizeFileName($filename); $filename = dol_sanitizeFileName($filename);
$headershown=0; $headershown=0;
$i=0; $i=0;
@@ -451,7 +451,7 @@ class FormFile
// Define relative path used to store the file // Define relative path used to store the file
if (! $relativepath) if (! $relativepath)
{ {
$relativepath=sanitizeFileName($object->ref).'/'; $relativepath=dol_sanitizeFileName($object->ref).'/';
if ($modulepart == 'facture_fournisseur') $relativepath=get_exdir($object->id,2).$relativepath; if ($modulepart == 'facture_fournisseur') $relativepath=get_exdir($object->id,2).$relativepath;
} }

View File

@@ -254,7 +254,7 @@ function commande_delete_preview($db, $commandeid, $commanderef='')
if ($conf->commande->dir_output) if ($conf->commande->dir_output)
{ {
$comref = sanitizeFileName($commanderef); $comref = dol_sanitizeFileName($commanderef);
$dir = $conf->commande->dir_output . "/" . $comref ; $dir = $conf->commande->dir_output . "/" . $comref ;
$file = $dir . "/" . $comref . ".pdf.png"; $file = $dir . "/" . $comref . ".pdf.png";
$multiple = $file . "."; $multiple = $file . ".";

View File

@@ -134,7 +134,7 @@ class pdf_edison extends ModelePDFCommandes
} }
else else
{ {
$comref = sanitizeFileName($com->ref); $comref = dol_sanitizeFileName($com->ref);
$dir = $conf->commande->dir_output . "/" . $comref; $dir = $conf->commande->dir_output . "/" . $comref;
$file = $dir . "/" . $comref . ".pdf"; $file = $dir . "/" . $comref . ".pdf";
} }

View File

@@ -140,7 +140,7 @@ class pdf_einstein extends ModelePDFCommandes
} }
else else
{ {
$comref = sanitizeFileName($com->ref); $comref = dol_sanitizeFileName($com->ref);
$dir = $conf->commande->dir_output . "/" . $comref; $dir = $conf->commande->dir_output . "/" . $comref;
$file = $dir . "/" . $comref . ".pdf"; $file = $dir . "/" . $comref . ".pdf";
} }

View File

@@ -88,7 +88,7 @@ class html_cerfafr extends ModeleDon
$outputlangs->load("companies"); $outputlangs->load("companies");
$outputlangs->load("bills"); $outputlangs->load("bills");
$outputlangs->load("products"); $outputlangs->load("products");
if ($conf->don->dir_output) if ($conf->don->dir_output)
{ {
// Definition de l'objet $don (pour compatibilite ascendante) // Definition de l'objet $don (pour compatibilite ascendante)
@@ -107,7 +107,7 @@ class html_cerfafr extends ModeleDon
} }
else else
{ {
$donref = sanitizeFileName($don->ref); $donref = dol_sanitizeFileName($don->ref);
$dir = $conf->don->dir_output . "/" . get_exdir($donref,2); $dir = $conf->don->dir_output . "/" . get_exdir($donref,2);
$file = $dir . "/" . $donref . ".html"; $file = $dir . "/" . $donref . ".html";
} }

View File

@@ -126,7 +126,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
} }
else else
{ {
$expref = sanitizeFileName($this->expe->ref); $expref = dol_sanitizeFileName($this->expe->ref);
$dir = $conf->expedition->dir_bon_expedition . "/" . $expref; $dir = $conf->expedition->dir_bon_expedition . "/" . $expref;
$file = $dir . "/" . $expref . ".pdf"; $file = $dir . "/" . $expref . ".pdf";
} }

View File

@@ -152,7 +152,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
} }
else else
{ {
$expref = sanitizeFileName($this->expe->ref); $expref = dol_sanitizeFileName($this->expe->ref);
$dir = $conf->expedition->dir_bon_expedition . "/" . $expref; $dir = $conf->expedition->dir_bon_expedition . "/" . $expref;
$file = $dir . "/" . $expref . ".pdf"; $file = $dir . "/" . $expref . ".pdf";
} }

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
* *
@@ -21,11 +21,11 @@
*/ */
/** /**
\file htdocs/includes/modules/facture/modules_facture.php * \file htdocs/includes/modules/facture/modules_facture.php
\ingroup facture * \ingroup facture
\brief Fichier contenant la classe m<EFBFBD>re de generation des factures en PDF * \brief Fichier contenant la classe mere de generation des factures en PDF
et la classe m<EFBFBD>re de num<EFBFBD>rotation des factures * et la classe mere de numerotation des factures
\version $Id$ * \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
@@ -241,7 +241,7 @@ function facture_meta_create($db, $facid, $message="")
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
$facref = sanitizeFileName($fac->ref); $facref = dol_sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref ; $dir = $conf->facture->dir_output . "/" . $facref ;
$file = $dir . "/" . $facref . ".meta"; $file = $dir . "/" . $facref . ".meta";
@@ -295,7 +295,7 @@ function facture_delete_preview($db, $facid)
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
$facref = sanitizeFileName($fac->ref); $facref = dol_sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref ; $dir = $conf->facture->dir_output . "/" . $facref ;
$file = $dir . "/" . $facref . ".pdf.png"; $file = $dir . "/" . $facref . ".pdf.png";

View File

@@ -145,7 +145,7 @@ class pdf_crabe extends ModelePDFFactures
} }
else else
{ {
$facref = sanitizeFileName($fac->ref); $facref = dol_sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref; $dir = $conf->facture->dir_output . "/" . $facref;
$file = $dir . "/" . $facref . ".pdf"; $file = $dir . "/" . $facref . ".pdf";
} }

View File

@@ -145,7 +145,7 @@ class pdf_oursin extends ModelePDFFactures
} }
else else
{ {
$facref = sanitizeFileName($fac->ref); $facref = dol_sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref; $dir = $conf->facture->dir_output . "/" . $facref;
$file = $dir . "/" . $facref . ".pdf"; $file = $dir . "/" . $facref . ".pdf";
} }

View File

@@ -240,7 +240,7 @@ function fichinter_delete_preview($db, $fichinterid, $fichinterref='')
if ($conf->ficheinter->dir_output) if ($conf->ficheinter->dir_output)
{ {
$fichinterref = sanitizeFileName($fichinterref); $fichinterref = dol_sanitizeFileName($fichinterref);
$dir = $conf->ficheinter->dir_output . "/" . $fichinterref ; $dir = $conf->ficheinter->dir_output . "/" . $fichinterref ;
$file = $dir . "/" . $fichinterref . ".pdf.png"; $file = $dir . "/" . $fichinterref . ".pdf.png";
$multiple = $file . "."; $multiple = $file . ".";

View File

@@ -108,7 +108,7 @@ class pdf_soleil extends ModelePDFFicheinter
} }
} }
$fichref = sanitizeFileName($fichinter->ref); $fichref = dol_sanitizeFileName($fichinter->ref);
$dir = $conf->ficheinter->dir_output; $dir = $conf->ficheinter->dir_output;
if (! eregi('specimen',$fichref)) $dir.= "/" . $fichref; if (! eregi('specimen',$fichref)) $dir.= "/" . $fichref;
$file = $dir . "/" . $fichref . ".pdf"; $file = $dir . "/" . $fichref . ".pdf";

View File

@@ -230,7 +230,7 @@ function delivery_order_delete_preview($db, $deliveryid)
if ($conf->livraison->dir_output) if ($conf->livraison->dir_output)
{ {
$deliveryref = sanitizeFileName($delivery->ref); $deliveryref = dol_sanitizeFileName($delivery->ref);
$dir = $conf->livraison->dir_output . "/" . $deliveryref ; $dir = $conf->livraison->dir_output . "/" . $deliveryref ;
$file = $dir . "/" . $deliveryref . ".pdf.png"; $file = $dir . "/" . $deliveryref . ".pdf.png";

View File

@@ -123,7 +123,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$nblignes = sizeof($delivery->lignes); $nblignes = sizeof($delivery->lignes);
$deliveryref = sanitizeFileName($delivery->ref); $deliveryref = dol_sanitizeFileName($delivery->ref);
$dir = $conf->expedition->dir_bon_livraison; $dir = $conf->expedition->dir_bon_livraison;
if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref; if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref;
$file = $dir . "/" . $deliveryref . ".pdf"; $file = $dir . "/" . $deliveryref . ".pdf";

View File

@@ -144,7 +144,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$nblignes = sizeof($delivery->lignes); $nblignes = sizeof($delivery->lignes);
$deliveryref = sanitizeFileName($delivery->ref); $deliveryref = dol_sanitizeFileName($delivery->ref);
$dir = $conf->expedition->dir_bon_livraison; $dir = $conf->expedition->dir_bon_livraison;
if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref; if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref;
$file = $dir . "/" . $deliveryref . ".pdf"; $file = $dir . "/" . $deliveryref . ".pdf";

View File

@@ -256,7 +256,7 @@ function propale_delete_preview($db, $propalid, $propalref='')
if ($conf->propale->dir_output) if ($conf->propale->dir_output)
{ {
$propalref = sanitizeFileName($propalref); $propalref = dol_sanitizeFileName($propalref);
$dir = $conf->propale->dir_output . "/" . $propalref ; $dir = $conf->propale->dir_output . "/" . $propalref ;
$file = $dir . "/" . $propalref . ".pdf.png"; $file = $dir . "/" . $propalref . ".pdf.png";
$multiple = $file . "."; $multiple = $file . ".";

View File

@@ -143,7 +143,7 @@ class pdf_propale_azur extends ModelePDFPropales
} }
else else
{ {
$propref = sanitizeFileName($propale->ref); $propref = dol_sanitizeFileName($propale->ref);
$dir = $conf->propale->dir_output . "/" . $propref; $dir = $conf->propale->dir_output . "/" . $propref;
$file = $dir . "/" . $propref . ".pdf"; $file = $dir . "/" . $propref . ".pdf";
} }

View File

@@ -127,7 +127,7 @@ class pdf_propale_jaune extends ModelePDFPropales
} }
else else
{ {
$propref = sanitizeFileName($propale->ref); $propref = dol_sanitizeFileName($propale->ref);
$dir = $conf->propale->dir_output . "/" . $propref; $dir = $conf->propale->dir_output . "/" . $propref;
$file = $dir . "/" . $propref . ".pdf"; $file = $dir . "/" . $propref . ".pdf";
} }

View File

@@ -227,7 +227,7 @@ function supplier_order_delete_preview($db, $propalid)
if ($conf->fournisseur->dir_commande) if ($conf->fournisseur->dir_commande)
{ {
$comfournref = sanitizeFileName($comfourn->ref); $comfournref = dol_sanitizeFileName($comfourn->ref);
$dir = $conf->commande->dir_output . "/" . $comfournref ; $dir = $conf->commande->dir_output . "/" . $comfournref ;
$file = $dir . "/" . $comfournref . ".pdf.png"; $file = $dir . "/" . $comfournref . ".pdf.png";

View File

@@ -143,7 +143,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
} }
else else
{ {
$comref = sanitizeFileName($com->ref); $comref = dol_sanitizeFileName($com->ref);
$dir = $conf->fournisseur->dir_commande . "/" . $comref; $dir = $conf->fournisseur->dir_commande . "/" . $comref;
$file = $dir . "/" . $comref . ".pdf"; $file = $dir . "/" . $comref . ".pdf";
} }

View File

@@ -32,7 +32,7 @@
class InterfaceNotification class InterfaceNotification
{ {
var $db; var $db;
/** /**
* \brief Constructeur. * \brief Constructeur.
* \param DB Handler d'acc<63>s base * \param DB Handler d'acc<63>s base
@@ -40,13 +40,13 @@ class InterfaceNotification
function InterfaceNotification($DB) function InterfaceNotification($DB)
{ {
$this->db = $DB ; $this->db = $DB ;
$this->name = eregi_replace('Interface','',get_class($this)); $this->name = eregi_replace('Interface','',get_class($this));
$this->family = "notification"; $this->family = "notification";
$this->description = "Triggers of this module send email notifications according to Notification module setup."; $this->description = "Triggers of this module send email notifications according to Notification module setup.";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
} }
/** /**
* \brief Renvoi nom du lot de triggers * \brief Renvoi nom du lot de triggers
* \return string Nom du lot de triggers * \return string Nom du lot de triggers
@@ -55,7 +55,7 @@ class InterfaceNotification
{ {
return $this->name; return $this->name;
} }
/** /**
* \brief Renvoi descriptif du lot de triggers * \brief Renvoi descriptif du lot de triggers
* \return string Descriptif du lot de triggers * \return string Descriptif du lot de triggers
@@ -79,7 +79,7 @@ class InterfaceNotification
elseif ($this->version) return $this->version; elseif ($this->version) return $this->version;
else return $langs->trans("Unknown"); else return $langs->trans("Unknown");
} }
/** /**
* \brief Fonction appel<65>e lors du d<>clenchement d'un <20>v<EFBFBD>nement Dolibarr. * \brief Fonction appel<65>e lors du d<>clenchement d'un <20>v<EFBFBD>nement Dolibarr.
* D'autres fonctions run_trigger peuvent etre pr<70>sentes dans includes/triggers * D'autres fonctions run_trigger peuvent etre pr<70>sentes dans includes/triggers
@@ -94,7 +94,7 @@ class InterfaceNotification
{ {
// Mettre ici le code <20> ex<65>cuter en r<>action de l'action // Mettre ici le code <20> ex<65>cuter en r<>action de l'action
// Les donn<6E>es de l'action sont stock<63>es dans $object // Les donn<6E>es de l'action sont stock<63>es dans $object
// Si module notification non actif, on ne fait rien // Si module notification non actif, on ne fait rien
if (! $conf->notification->enabled) return 0; if (! $conf->notification->enabled) return 0;
@@ -105,11 +105,11 @@ class InterfaceNotification
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$action_notify = 2; $action_notify = 2;
$ref = sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
$mesg = 'La facture '.$object->ref." a <20>t<EFBFBD> valid<69>e.\n"; $mesg = 'La facture '.$object->ref." a <20>t<EFBFBD> valid<69>e.\n";
$notify = new Notify($this->db); $notify = new Notify($this->db);
$notify->send($action_notify, $object->socid, $mesg, 'facture', $object->id, $filepdf); $notify->send($action_notify, $object->socid, $mesg, 'facture', $object->id, $filepdf);
} }
@@ -118,11 +118,11 @@ class InterfaceNotification
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$action_notify = 1; $action_notify = 1;
$ref = sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
$mesg = 'La fiche intervention '.$object->ref." a <20>t<EFBFBD> valid<69>e.\n"; $mesg = 'La fiche intervention '.$object->ref." a <20>t<EFBFBD> valid<69>e.\n";
$notify = new Notify($this->db); $notify = new Notify($this->db);
$notify->send($action_notify, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf); $notify->send($action_notify, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf);
} }
@@ -131,11 +131,11 @@ class InterfaceNotification
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$action_notify = 3; $action_notify = 3;
$ref = sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->fournisseur->dir_commande . '/' . $ref . '/' . $ref . '.pdf'; $filepdf = $conf->fournisseur->dir_commande . '/' . $ref . '/' . $ref . '.pdf';
$mesg = 'La commande fournisseur '.$object->ref." a <20>t<EFBFBD> valid<69>e.\n"; $mesg = 'La commande fournisseur '.$object->ref." a <20>t<EFBFBD> valid<69>e.\n";
$notify = new Notify($this->db); $notify = new Notify($this->db);
$notify->send($action_notify, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); $notify->send($action_notify, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
} }

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> /* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2008 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
@@ -19,10 +19,10 @@
*/ */
/** /**
\file htdocs/install/upgrade2.php * \file htdocs/install/upgrade2.php
\brief Effectue la migration de donnees diverses * \brief Effectue la migration de donnees diverses
\version $Id$ * \version $Id$
*/ */
include_once('./inc.php'); include_once('./inc.php');
if (file_exists($conffile)) include_once($conffile); if (file_exists($conffile)) include_once($conffile);
@@ -44,7 +44,7 @@ $error = 0;
// Ne fonctionne que si on est pas en safe_mode. // Ne fonctionne que si on est pas en safe_mode.
$err=error_reporting(); $err=error_reporting();
error_reporting(0); error_reporting(0);
@set_time_limit(60); @set_time_limit(120);
error_reporting($err); error_reporting($err);
$setuplang=isset($_POST['selectlang'])?$_POST['selectlang']:(isset($_GET['selectlang'])?$_GET['selectlang']:'auto'); $setuplang=isset($_POST['selectlang'])?$_POST['selectlang']:(isset($_GET['selectlang'])?$_GET['selectlang']:'auto');
@@ -749,7 +749,7 @@ function migrate_contracts_date2($db,$langs,$conf)
$sql.= " WHERE c.rowid=cd.fk_contrat AND cd.date_ouverture IS NOT NULL"; $sql.= " WHERE c.rowid=cd.fk_contrat AND cd.date_ouverture IS NOT NULL";
$sql.= " GROUP BY c.rowid, c.date_contrat"; $sql.= " GROUP BY c.rowid, c.date_contrat";
$resql = $db->query($sql); $resql = $db->query($sql);
dolibarr_install_syslog("upgrade2::migrate_contracts_date2 sql=".$sql); dolibarr_install_syslog("upgrade2::migrate_contracts_date2 sql=".$sql);
if ($resql) if ($resql)
{ {
@@ -891,8 +891,8 @@ function migrate_paiementfourn_facturefourn($db,$langs,$conf)
$select_sql = 'SELECT rowid, fk_facture_fourn, amount '; $select_sql = 'SELECT rowid, fk_facture_fourn, amount ';
$select_sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn '; $select_sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn ';
$select_sql .= ' WHERE fk_facture_fourn IS NOT NULL'; $select_sql .= ' WHERE fk_facture_fourn IS NOT NULL';
dolibarr_install_syslog("upgrade2::migrate_paiementfourn_facturefourn sql=".$sql); dolibarr_install_syslog("upgrade2::migrate_paiementfourn_facturefourn sql=".$select_sql);
$select_resql = $db->query($select_sql); $select_resql = $db->query($select_sql);
if ($select_resql) if ($select_resql)
{ {
@@ -1517,7 +1517,7 @@ function migrate_modeles($db,$langs,$conf)
//print '<b>'.$langs->trans('UpdateModelsTable')."</b><br>\n"; //print '<b>'.$langs->trans('UpdateModelsTable')."</b><br>\n";
dolibarr_install_syslog("upgrade2::migrate_modeles"); dolibarr_install_syslog("upgrade2::migrate_modeles");
if ($conf->facture->enabled) if ($conf->facture->enabled)
{ {
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php'); include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php');
@@ -1571,7 +1571,7 @@ function migrate_delete_old_files($db,$langs,$conf)
$result=true; $result=true;
dolibarr_install_syslog("upgrade2::migrate_delete_old_files"); dolibarr_install_syslog("upgrade2::migrate_delete_old_files");
// List of files to delete // List of files to delete
$filetodeletearray=array( $filetodeletearray=array(
DOL_DOCUMENT_ROOT.'/includes/triggers/interface_demo.class.php', DOL_DOCUMENT_ROOT.'/includes/triggers/interface_demo.class.php',
@@ -1602,7 +1602,7 @@ function migrate_delete_old_files($db,$langs,$conf)
function migrate_module_menus($db,$langs,$conf) function migrate_module_menus($db,$langs,$conf)
{ {
dolibarr_install_syslog("upgrade2::migrate_module_menus"); dolibarr_install_syslog("upgrade2::migrate_module_menus");
if (! empty($conf->global->MAIN_MODULE_AGENDA)) if (! empty($conf->global->MAIN_MODULE_AGENDA))
{ {
dolibarr_install_syslog("upgrade2::migrate_module_menus Reactivate module Agenda"); dolibarr_install_syslog("upgrade2::migrate_module_menus Reactivate module Agenda");
@@ -1648,7 +1648,7 @@ function migrate_module_menus($db,$langs,$conf)
function migrate_commande_expedition($db,$langs,$conf) function migrate_commande_expedition($db,$langs,$conf)
{ {
dolibarr_install_syslog("upgrade2::migrate_commande_expedition"); dolibarr_install_syslog("upgrade2::migrate_commande_expedition");
print '<tr><td colspan="4">'; print '<tr><td colspan="4">';
print '<br>'; print '<br>';
@@ -1722,7 +1722,7 @@ function migrate_commande_expedition($db,$langs,$conf)
function migrate_commande_livraison($db,$langs,$conf) function migrate_commande_livraison($db,$langs,$conf)
{ {
dolibarr_install_syslog("upgrade2::migrate_commande_livraison"); dolibarr_install_syslog("upgrade2::migrate_commande_livraison");
print '<tr><td colspan="4">'; print '<tr><td colspan="4">';
print '<br>'; print '<br>';
@@ -1810,7 +1810,7 @@ function migrate_commande_livraison($db,$langs,$conf)
function migrate_detail_livraison($db,$langs,$conf) function migrate_detail_livraison($db,$langs,$conf)
{ {
dolibarr_install_syslog("upgrade2::migrate_detail_livraison"); dolibarr_install_syslog("upgrade2::migrate_detail_livraison");
print '<tr><td colspan="4">'; print '<tr><td colspan="4">';
print '<br>'; print '<br>';
@@ -1929,7 +1929,7 @@ function migrate_detail_livraison($db,$langs,$conf)
function migrate_stocks($db,$langs,$conf) function migrate_stocks($db,$langs,$conf)
{ {
dolibarr_install_syslog("upgrade2::migrate_stocks"); dolibarr_install_syslog("upgrade2::migrate_stocks");
print '<tr><td colspan="4">'; print '<tr><td colspan="4">';
print '<br>'; print '<br>';

View File

@@ -42,7 +42,7 @@ if (! defined('ADODB_DATE_VERSION')) include_once(DOL_DOCUMENT_ROOT."/includes/a
* \param newstr String to replace bad chars by * \param newstr String to replace bad chars by
* \return string String cleaned (a-zA-Z_) * \return string String cleaned (a-zA-Z_)
*/ */
function sanitizeFileName($str,$newstr='_') function dol_sanitizeFileName($str,$newstr='_')
{ {
return dol_string_nospecial(dol_string_unaccent($str),$newstr); return dol_string_nospecial(dol_string_unaccent($str),$newstr);
} }
@@ -1343,7 +1343,7 @@ function info_admin($texte,$infoonimgalt=0)
function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',$feature2='',$dbt_socfield='fk_soc',$dbt_select='rowid') function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',$feature2='',$dbt_socfield='fk_soc',$dbt_select='rowid')
{ {
global $db, $conf; global $db, $conf;
if ($dbt_select != 'rowid') $objectid = "'".$objectid."'"; if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
//print "user_id=".$user->id.", feature=".$feature.", feature2=".$feature2.", object_id=".$objectid; //print "user_id=".$user->id.", feature=".$feature.", feature2=".$feature2.", object_id=".$objectid;
@@ -1441,7 +1441,7 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',
// If dbtable not defined, we use same name for table than module name // If dbtable not defined, we use same name for table than module name
if (!$dbtablename) $dbtablename = $feature; if (!$dbtablename) $dbtablename = $feature;
// Check permission for object with entity // Check permission for object with entity
if ($feature == 'user' || $feature == 'usergroup' || $feature == 'produit') if ($feature == 'user' || $feature == 'usergroup' || $feature == 'produit')
{ {

View File

@@ -581,7 +581,7 @@ else
* Documents generated * Documents generated
*/ */
$livraisonref = sanitizeFileName($livraison->ref); $livraisonref = dol_sanitizeFileName($livraison->ref);
$filedir = $conf->expedition->dir_bon_livraison . '/' . $livraisonref; $filedir = $conf->expedition->dir_bon_livraison . '/' . $livraisonref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id; $urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;

View File

@@ -416,7 +416,7 @@ class Livraison extends CommonObject
} }
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
$livraisonref = sanitizeFileName($this->ref); $livraisonref = dol_sanitizeFileName($this->ref);
if ($conf->expedition->dir_output) if ($conf->expedition->dir_output)
{ {
$dir = $conf->livraison->dir_output . "/" . $livraisonref ; $dir = $conf->livraison->dir_output . "/" . $livraisonref ;
@@ -555,7 +555,7 @@ class Livraison extends CommonObject
$this->db->commit(); $this->db->commit();
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
$livref = sanitizeFileName($this->ref); $livref = dol_sanitizeFileName($this->ref);
if ($conf->livraison->dir_output) if ($conf->livraison->dir_output)
{ {
$dir = $conf->livraison->dir_output . "/" . $livref ; $dir = $conf->livraison->dir_output . "/" . $livref ;

View File

@@ -131,7 +131,7 @@ class Product extends CommonObject
*/ */
function check() function check()
{ {
$this->ref = sanitizeFileName(stripslashes($this->ref)); $this->ref = dol_sanitizeFileName(stripslashes($this->ref));
$err = 0; $err = 0;
if (strlen(trim($this->ref)) == 0) if (strlen(trim($this->ref)) == 0)
@@ -940,7 +940,7 @@ class Product extends CommonObject
$this->stock_in_propal = 0; // TODO $this->stock_in_propal = 0; // TODO
$this->next_prev_filter = 'entity = '.$conf->entity; $this->next_prev_filter = 'entity = '.$conf->entity;
$this->label_url = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">'.$this->libelle.'</a>'; $this->label_url = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">'.$this->libelle.'</a>';
$this->db->free(); $this->db->free();
@@ -1209,7 +1209,7 @@ class Product extends CommonObject
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
//$sql.= " AND c.statut != 0"; //$sql.= " AND c.statut != 0";
if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid; if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if ( $result ) if ( $result )
{ {

View File

@@ -62,7 +62,7 @@ if ($_GET['id'] || $_GET["ref"])
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]); if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
$upload_dir = $conf->produit->dir_output.'/'.sanitizeFileName($product->ref); $upload_dir = $conf->produit->dir_output.'/'.dol_sanitizeFileName($product->ref);
} }
$modulepart='produit'; $modulepart='produit';

View File

@@ -721,7 +721,7 @@ class Propal extends CommonObject
function fetch($rowid,$ref='') function fetch($rowid,$ref='')
{ {
global $conf; global $conf;
$sql = "SELECT p.rowid,ref,remise,remise_percent,remise_absolue,fk_soc"; $sql = "SELECT p.rowid,ref,remise,remise_percent,remise_absolue,fk_soc";
$sql.= ", total, tva, total_ht"; $sql.= ", total, tva, total_ht";
$sql.= ", datec"; $sql.= ", datec";
@@ -1295,7 +1295,7 @@ class Propal extends CommonObject
{ {
if ($user) $sql.= " AND fk_user_author".$user; if ($user) $sql.= " AND fk_user_author".$user;
} }
$sql.= " ORDER BY datep DESC"; $sql.= " ORDER BY datep DESC";
$result=$this->db->query($sql); $result=$this->db->query($sql);
@@ -1501,7 +1501,7 @@ class Propal extends CommonObject
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
{ {
// We remove directory // We remove directory
$propalref = sanitizeFileName($this->ref); $propalref = dol_sanitizeFileName($this->ref);
if ($conf->propale->dir_output) if ($conf->propale->dir_output)
{ {
$dir = $conf->propale->dir_output . "/" . $propalref ; $dir = $conf->propale->dir_output . "/" . $propalref ;
@@ -1897,7 +1897,7 @@ class Propal extends CommonObject
$clause = "AND"; $clause = "AND";
} }
$sql.= " ".$clause." p.entity = ".$conf->entity; $sql.= " ".$clause." p.entity = ".$conf->entity;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@@ -242,7 +242,7 @@ class Societe extends CommonObject
$this->errors[] = 'ErrorBadThirdPartyName'; $this->errors[] = 'ErrorBadThirdPartyName';
$result = -2; $result = -2;
} }
if ($this->client && $this->codeclient_modifiable()) if ($this->client && $this->codeclient_modifiable())
{ {
// On ne verifie le code client que si la societe est un client / prospect et que le code est modifiable // On ne verifie le code client que si la societe est un client / prospect et que le code est modifiable
@@ -269,7 +269,7 @@ class Societe extends CommonObject
$result = -3; $result = -3;
} }
} }
if ($this->fournisseur && $this->codefournisseur_modifiable()) if ($this->fournisseur && $this->codefournisseur_modifiable())
{ {
// On ne verifie le code fournisseur que si la societe est un fournisseur et que le code est modifiable // On ne verifie le code fournisseur que si la societe est un fournisseur et que le code est modifiable
@@ -296,7 +296,7 @@ class Societe extends CommonObject
$result = -3; $result = -3;
} }
} }
return $result; return $result;
} }
@@ -312,7 +312,7 @@ class Societe extends CommonObject
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0) function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
global $langs,$conf; global $langs,$conf;
dol_syslog("Societe::Update id=".$id." call_trigger=".$call_triger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur); dol_syslog("Societe::Update id=".$id." call_trigger=".$call_triger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
@@ -341,7 +341,7 @@ class Societe extends CommonObject
$this->prefix_comm=trim($this->prefix_comm); $this->prefix_comm=trim($this->prefix_comm);
$this->tva_assuj=trim($this->tva_assuj); $this->tva_assuj=trim($this->tva_assuj);
$this->tva_intra=sanitizeFileName($this->tva_intra,''); $this->tva_intra=dol_sanitizeFileName($this->tva_intra,'');
$this->capital=trim($this->capital); $this->capital=trim($this->capital);
if (strlen($this->capital) == 0) $this->capital = 0; if (strlen($this->capital) == 0) $this->capital = 0;
@@ -875,7 +875,7 @@ class Societe extends CommonObject
function attribute_prefix() function attribute_prefix()
{ {
global $conf; global $conf;
$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."societe WHERE rowid = '".$this->id."'"; $sql = "SELECT nom FROM ".MAIN_DB_PREFIX."societe WHERE rowid = '".$this->id."'";
$resql=$this->db->query( $sql); $resql=$this->db->query( $sql);
if ($resql) if ($resql)
@@ -891,7 +891,7 @@ class Societe extends CommonObject
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."societe"; $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE prefix_comm = '".$prefix."'"; $sql.= " WHERE prefix_comm = '".$prefix."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@@ -938,12 +938,12 @@ class Societe extends CommonObject
if ($mot < count($tab)) if ($mot < count($tab))
{ {
$prefix = strtoupper(substr($tab[$mot],0,$taille)); $prefix = strtoupper(substr($tab[$mot],0,$taille));
// On verifie que ce prefix n'a pas deja ete pris ... // On verifie que ce prefix n'a pas deja ete pris ...
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."societe"; $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE prefix_comm = '".$prefix."'"; $sql.= " WHERE prefix_comm = '".$prefix."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$this->db->query( $sql); $resql=$this->db->query( $sql);
if ($resql) if ($resql)
{ {

View File

@@ -62,7 +62,7 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
$fac = new Facture($db,"",$_POST["facid"]); $fac = new Facture($db,"",$_POST["facid"]);
if ( $fac->fetch($_POST["facid"]) ) if ( $fac->fetch($_POST["facid"]) )
{ {
$facref = sanitizeFileName($fac->ref); $facref = dol_sanitizeFileName($fac->ref);
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf"; $file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
if (is_readable($file)) if (is_readable($file))
@@ -169,41 +169,41 @@ $html = new Form($db);
if ($_GET["facid"] > 0) if ($_GET["facid"] > 0)
{ {
if ($msg) print "$msg<br>"; if ($msg) print "$msg<br>";
$fac = New Facture($db); $fac = New Facture($db);
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0) if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
{ {
$soc = new Societe($db, $fac->socid); $soc = new Societe($db, $fac->socid);
$soc->fetch($fac->socid, $user); $soc->fetch($fac->socid, $user);
if (!$soc->perm_read) if (!$soc->perm_read)
{ {
print "Lecture non authoris<69>e"; print "Lecture non authoris<69>e";
} }
if ($soc->perm_read) if ($soc->perm_read)
{ {
$author = new User($db); $author = new User($db);
$author->id = $fac->user_author; $author->id = $fac->user_author;
$author->fetch(); $author->fetch();
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$soc->id; $head[$h][0] = DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$soc->id;
$head[$h][1] = $langs->trans("Fiche client"); $head[$h][1] = $langs->trans("Fiche client");
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/telephonie/client/factures.php?id='.$soc->id; $head[$h][0] = DOL_URL_ROOT.'/telephonie/client/factures.php?id='.$soc->id;
$head[$h][1] = $langs->trans("Factures"); $head[$h][1] = $langs->trans("Factures");
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/telephonie/client/facture.php?facid='.$fac->id; $head[$h][0] = DOL_URL_ROOT.'/telephonie/client/facture.php?facid='.$fac->id;
$head[$h][1] = $langs->trans("CardBill"); $head[$h][1] = $langs->trans("CardBill");
$hselected = $h; $hselected = $h;
$h++; $h++;
dol_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref"); dol_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");
/* /*
* Facture * Facture
*/ */
@@ -211,16 +211,16 @@ if ($_GET["facid"] > 0)
print '<tr><td>'.$langs->trans("Company").'</td>'; print '<tr><td>'.$langs->trans("Company").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print '<b><a href="fiche.php?id='.$soc->id.'">'.$soc->nom.'</a></b></td>'; print '<b><a href="fiche.php?id='.$soc->id.'">'.$soc->nom.'</a></b></td>';
print "<td>Conditions de r<>glement</td><td>" . $fac->cond_reglement ."</td></tr>"; print "<td>Conditions de r<>glement</td><td>" . $fac->cond_reglement ."</td></tr>";
print '<tr><td>'.$langs->trans("Date").'</td>'; print '<tr><td>'.$langs->trans("Date").'</td>';
print "<td colspan=\"3\">".dol_print_date($fac->date,"dayhourtext")."</td>\n"; print "<td colspan=\"3\">".dol_print_date($fac->date,"dayhourtext")."</td>\n";
print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . dol_print_date($fac->date_lim_reglement,"dayhourtext"); print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . dol_print_date($fac->date_lim_reglement,"dayhourtext");
print "</td></tr>"; print "</td></tr>";
print '<tr>'; print '<tr>';
// Projet // Projet
if ($conf->projet->enabled) if ($conf->projet->enabled)
{ {
@@ -244,9 +244,9 @@ if ($_GET["facid"] > 0)
} else { } else {
print '<td height=\"10\">&nbsp;</td><td colspan="3">&nbsp;</td>'; print '<td height=\"10\">&nbsp;</td><td colspan="3">&nbsp;</td>';
} }
print '<td rowspan="8" colspan="2" valign="top">'; print '<td rowspan="8" colspan="2" valign="top">';
/* /*
* Paiements * Paiements
*/ */
@@ -256,9 +256,9 @@ if ($_GET["facid"] > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf";
$sql.= " WHERE pf.fk_facture = ".$fac->id." AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid"; $sql.= " WHERE pf.fk_facture = ".$fac->id." AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid";
$sql.= " ORDER BY dp DESC"; $sql.= " ORDER BY dp DESC";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
@@ -266,7 +266,7 @@ if ($_GET["facid"] > 0)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Type").'</td>'; print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td><td>&nbsp;</td></tr>'; print '<td align="right">'.$langs->trans("Amount").'</td><td>&nbsp;</td></tr>';
$var=True; $var=True;
while ($i < $num) while ($i < $num)
{ {
@@ -280,14 +280,14 @@ if ($_GET["facid"] > 0)
$totalpaye += $objp->amount; $totalpaye += $objp->amount;
$i++; $i++;
} }
if ($fac->paye == 0) if ($fac->paye == 0)
{ {
print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("AlreadyPayed")." :</td><td align=\"right\"><b>".price($totalpaye)."</b></td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n"; print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("AlreadyPayed")." :</td><td align=\"right\"><b>".price($totalpaye)."</b></td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
print "<tr><td colspan=\"2\" align=\"right\">Factur<75> :</td><td align=\"right\" style=\"border: 1px solid;\">".price($fac->total_ttc)."</td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n"; print "<tr><td colspan=\"2\" align=\"right\">Factur<75> :</td><td align=\"right\" style=\"border: 1px solid;\">".price($fac->total_ttc)."</td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
$resteapayer = $fac->total_ttc - $totalpaye; $resteapayer = $fac->total_ttc - $totalpaye;
print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>"; print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
print "<td align=\"right\" style=\"border: 1px solid;\" bgcolor=\"#f0f0f0\"><b>".price($resteapayer)."</b></td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n"; print "<td align=\"right\" style=\"border: 1px solid;\" bgcolor=\"#f0f0f0\"><b>".price($resteapayer)."</b></td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
} }
@@ -298,9 +298,9 @@ if ($_GET["facid"] > 0)
} }
print "</td></tr>"; print "</td></tr>";
print "<tr><td height=\"10\">".$langs->trans("Author")."</td><td colspan=\"3\">$author->fullname</td></tr>"; print "<tr><td height=\"10\">".$langs->trans("Author")."</td><td colspan=\"3\">$author->fullname</td></tr>";
print '<tr><td height=\"10\">'.$langs->trans("GlobalDiscount").'</td>'; print '<tr><td height=\"10\">'.$langs->trans("GlobalDiscount").'</td>';
if ($fac->brouillon == 1 && $user->rights->facture->creer) if ($fac->brouillon == 1 && $user->rights->facture->creer)
{ {
@@ -315,18 +315,18 @@ if ($_GET["facid"] > 0)
print '<td colspan="3">'.$fac->remise_percent.'%</td>'; print '<td colspan="3">'.$fac->remise_percent.'%</td>';
} }
print '</tr>'; print '</tr>';
print '<tr><td height=\"10\">'.$langs->trans("AmountHT").'</td>'; print '<tr><td height=\"10\">'.$langs->trans("AmountHT").'</td>';
print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>'; print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>';
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<tr><td height=\"10\">'.$langs->trans("VAT").'</td><td align="right" colspan="2">'.price($fac->total_tva).'</td>'; print '<tr><td height=\"10\">'.$langs->trans("VAT").'</td><td align="right" colspan="2">'.price($fac->total_tva).'</td>';
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<tr><td height=\"10\">'.$langs->trans("AmountTTC").'</td><td align="right" colspan="2">'.price($fac->total_ttc).'</td>'; print '<tr><td height=\"10\">'.$langs->trans("AmountTTC").'</td><td align="right" colspan="2">'.price($fac->total_ttc).'</td>';
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<tr><td height=\"10\">'.$langs->trans("Status").'</td><td align="left" colspan="3">'.($fac->getLibStatut()).'</td></tr>'; print '<tr><td height=\"10\">'.$langs->trans("Status").'</td><td align="left" colspan="3">'.($fac->getLibStatut()).'</td></tr>';
if ($fac->note) if ($fac->note)
{ {
print '<tr><td colspan="4">'.$langs->trans("Note").' : '.nl2br($fac->note)."</td></tr>"; print '<tr><td colspan="4">'.$langs->trans("Note").' : '.nl2br($fac->note)."</td></tr>";
@@ -334,9 +334,9 @@ if ($_GET["facid"] > 0)
else { else {
print '<tr><td colspan="4">&nbsp;</td></tr>'; print '<tr><td colspan="4">&nbsp;</td></tr>';
} }
print "</table><br>"; print "</table><br>";
/* /*
* Lignes de factures * Lignes de factures
* *
@@ -350,13 +350,13 @@ if ($_GET["facid"] > 0)
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON l.fk_product=p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON l.fk_product=p.rowid";
$sql .= " WHERE l.fk_facture = ".$fac->id; $sql .= " WHERE l.fk_facture = ".$fac->id;
$sql .= " ORDER BY l.rang ASC, l.rowid"; $sql .= " ORDER BY l.rang ASC, l.rowid";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num_lignes = $db->num_rows($resql); $num_lignes = $db->num_rows($resql);
$i = 0; $total = 0; $i = 0; $total = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
if ($num_lignes) if ($num_lignes)
{ {
@@ -375,11 +375,11 @@ if ($_GET["facid"] > 0)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
// Update ligne de facture // Update ligne de facture
if ($_GET["action"] != 'editline' || $_GET["rowid"] != $objp->rowid) if ($_GET["action"] != 'editline' || $_GET["rowid"] != $objp->rowid)
{ {
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
if ($objp->fk_product > 0) if ($objp->fk_product > 0)
{ {
@@ -400,7 +400,7 @@ if ($_GET["facid"] > 0)
if (! $objp->date_start && $objp->date_end) { print " (Jusqu'au ".dol_print_date($objp->date_end).")"; } if (! $objp->date_start && $objp->date_end) { print " (Jusqu'au ".dol_print_date($objp->date_end).")"; }
print "</td>\n"; print "</td>\n";
} }
print '<td align="right">'.$objp->tva_taux.'%</td>'; print '<td align="right">'.$objp->tva_taux.'%</td>';
print '<td align="right">'.price($objp->subprice)."</td>\n"; print '<td align="right">'.price($objp->subprice)."</td>\n";
print '<td align="right">'.$objp->qty.'</td>'; print '<td align="right">'.$objp->qty.'</td>';
@@ -497,7 +497,7 @@ if ($_GET["facid"] > 0)
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse * REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
*/ */
$facref = sanitizeFileName($fac->ref); $facref = dol_sanitizeFileName($fac->ref);
$file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf"; $file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
$relativepath = "${facref}/${facref}.pdf"; $relativepath = "${facref}/${facref}.pdf";
@@ -670,7 +670,7 @@ if ($_GET["facid"] > 0)
{ {
$formmail->clear_attached_files(); $formmail->clear_attached_files();
} }
$formmail->show_form(); $formmail->show_form();
print '<br>'; print '<br>';
@@ -711,7 +711,7 @@ if ($_GET["facid"] > 0)
{ {
$formmail->clear_attached_files(); $formmail->clear_attached_files();
} }
$formmail->show_form(); $formmail->show_form();
print '<br>'; print '<br>';