This commit is contained in:
Laurent Destailleur 2017-10-06 14:05:13 +02:00
parent 777486d74c
commit f9d9642340
8 changed files with 43 additions and 43 deletions

View File

@ -74,7 +74,7 @@ if ($mode == 'customer')
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
$title=$langs->trans("BillsStatisticsSuppliers"); $title=$langs->trans("BillsStatisticsSuppliers");
$dir=$conf->fournisseur->dir_output.'/facture/temp'; $dir=$conf->fournisseur->facture->dir_temp;
} }
print load_fiche_titre($title, $mesg, 'title_accountancy.png'); print load_fiche_titre($title, $mesg, 'title_accountancy.png');

View File

@ -58,7 +58,7 @@ class Notify
'SHIPPING_VALIDATE' 'SHIPPING_VALIDATE'
); );
/** /**
* Constructor * Constructor
* *
@ -85,14 +85,14 @@ class Notify
$langs->load("mails"); $langs->load("mails");
$listofnotiftodo=$this->getNotificationsArray($action,$socid,$object,0); $listofnotiftodo=$this->getNotificationsArray($action,$socid,$object,0);
$nb=-1; $nb=-1;
if (is_array($listofnotiftodo)) $nb=count($listofnotiftodo); if (is_array($listofnotiftodo)) $nb=count($listofnotiftodo);
if ($nb < 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ErrorFailedToGetListOfNotificationsToSend"); if ($nb < 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ErrorFailedToGetListOfNotificationsToSend");
if ($nb == 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent"); if ($nb == 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent");
if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent"); if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent");
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb); if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
if (is_array($listofnotiftodo)) if (is_array($listofnotiftodo))
{ {
$i=0; $i=0;
@ -106,7 +106,7 @@ class Notify
} }
if ($i) $texte.=')'; if ($i) $texte.=')';
} }
return $texte; return $texte;
} }
@ -149,9 +149,9 @@ class Notify
} }
$sql.= " AND s.entity IN (".getEntity('societe').")"; $sql.= " AND s.entity IN (".getEntity('societe').")";
if ($socid > 0) $sql.= " AND s.rowid = ".$socid; if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG); dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -176,7 +176,7 @@ class Notify
} }
} }
} }
if (! $error) if (! $error)
{ {
if ($userid >= 0 && in_array('user', $scope)) if ($userid >= 0 && in_array('user', $scope))
@ -194,9 +194,9 @@ class Notify
} }
$sql.= " AND c.entity IN (".getEntity('user').")"; $sql.= " AND c.entity IN (".getEntity('user').")";
if ($userid > 0) $sql.= " AND c.rowid = ".$userid; if ($userid > 0) $sql.= " AND c.rowid = ".$userid;
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG); dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -237,10 +237,10 @@ class Notify
{ {
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue; if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
} }
$threshold = (float) $reg[1]; $threshold = (float) $reg[1];
if ($valueforthreshold < $threshold) continue; if ($valueforthreshold < $threshold) continue;
$tmpemail=explode(',',$val); $tmpemail=explode(',',$val);
foreach($tmpemail as $key2 => $val2) foreach($tmpemail as $key2 => $val2)
{ {
@ -295,7 +295,7 @@ class Notify
$hookmanager=new HookManager($this->db); $hookmanager=new HookManager($this->db);
} }
$hookmanager->initHooks(array('notification')); $hookmanager->initHooks(array('notification'));
dol_syslog(get_class($this)."::send notifcode=".$notifcode.", object=".$object->id); dol_syslog(get_class($this)."::send notifcode=".$notifcode.", object=".$object->id);
$langs->load("other"); $langs->load("other");
@ -342,7 +342,7 @@ class Notify
$sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action"; $sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
else $sql.= " AND a.code = '".$notifcode."'"; // New usage else $sql.= " AND a.code = '".$notifcode."'"; // New usage
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
@ -369,7 +369,7 @@ class Notify
} }
$subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification"); $subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification");
switch ($notifcode) { switch ($notifcode) {
case 'BILL_VALIDATE': case 'BILL_VALIDATE':
$link='/compta/facture/card.php?facid='.$object->id; $link='/compta/facture/card.php?facid='.$object->id;
@ -409,7 +409,7 @@ class Notify
break; break;
case 'ORDER_SUPPLIER_VALIDATE': case 'ORDER_SUPPLIER_VALIDATE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$object->ref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$object->ref,$user->getFullName($langs));
@ -417,7 +417,7 @@ class Notify
break; break;
case 'ORDER_SUPPLIER_APPROVE': case 'ORDER_SUPPLIER_APPROVE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs));
@ -425,7 +425,7 @@ class Notify
break; break;
case 'ORDER_SUPPLIER_REFUSE': case 'ORDER_SUPPLIER_REFUSE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$newref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$newref,$user->getFullName($langs));
@ -462,7 +462,7 @@ class Notify
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject']; if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message']; if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
} }
$mailfile = new CMailFile( $mailfile = new CMailFile(
$subject, $subject,
$sendto, $sendto,
@ -478,16 +478,16 @@ class Notify
); );
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
if ($obj->type_target == 'touserid') { if ($obj->type_target == 'touserid') {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')"; $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
} }
else { else {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')"; $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
} }
if (! $this->db->query($sql)) if (! $this->db->query($sql))
{ {
@ -585,7 +585,7 @@ class Notify
break; break;
case 'ORDER_SUPPLIER_VALIDATE': case 'ORDER_SUPPLIER_VALIDATE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$newref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$newref,$user->getFullName($langs));
@ -593,7 +593,7 @@ class Notify
break; break;
case 'ORDER_SUPPLIER_APPROVE': case 'ORDER_SUPPLIER_APPROVE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs));
@ -601,7 +601,7 @@ class Notify
break; break;
case 'ORDER_SUPPLIER_APPROVE2': case 'ORDER_SUPPLIER_APPROVE2':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs));
@ -664,7 +664,7 @@ class Notify
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject']; if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message']; if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
} }
$mailfile = new CMailFile( $mailfile = new CMailFile(
$subject, $subject,
$sendto, $sendto,

View File

@ -1279,8 +1279,8 @@ function dol_delete_preview($object)
// Define parent dir of elements // Define parent dir of elements
$element = $object->element; $element = $object->element;
if ($object->element == 'order_supplier') $dir = $conf->fournisseur->dir_output.'/commande'; if ($object->element == 'order_supplier') $dir = $conf->fournisseur->commande->dir_output;
elseif ($object->element == 'invoice_supplier') $dir = $conf->fournisseur->dir_output.'/facture'; elseif ($object->element == 'invoice_supplier') $dir = $conf->fournisseur->facture->dir_output;
elseif ($object->element == 'project') $dir = $conf->projet->dir_output; elseif ($object->element == 'project') $dir = $conf->projet->dir_output;
elseif ($object->element == 'shipping') $dir = $conf->expedition->dir_output.'/sending'; elseif ($object->element == 'shipping') $dir = $conf->expedition->dir_output.'/sending';
elseif ($object->element == 'delivery') $dir = $conf->expedition->dir_output.'/receipt'; elseif ($object->element == 'delivery') $dir = $conf->expedition->dir_output.'/receipt';
@ -2083,7 +2083,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
elseif ($modulepart == 'billstatssupplier' && !empty($conf->fournisseur->dir_output)) elseif ($modulepart == 'billstatssupplier' && !empty($conf->fournisseur->dir_output))
{ {
if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed=1; if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed=1;
$original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file; $original_file=$conf->fournisseur->facture->dir_temp.'/'.$original_file;
} }
// Wrapping pour les images des stats expeditions // Wrapping pour les images des stats expeditions
elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp))

View File

@ -157,7 +157,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$outputlangs->load("bills"); $outputlangs->load("bills");
$outputlangs->load("products"); $outputlangs->load("products");
if ($conf->fournisseur->dir_output.'/facture') if ($conf->fournisseur->facture->dir_output)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -540,7 +540,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; // Pas d'erreur return 1; // Pas d'erreur
} }
else else

View File

@ -168,7 +168,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$outputlangs->load("orders"); $outputlangs->load("orders");
$nblignes = count($object->lines); $nblignes = count($object->lines);
// Loop on each lines to detect if there is at least one image to show // Loop on each lines to detect if there is at least one image to show
$realpatharray=array(); $realpatharray=array();
if (! empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) if (! empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE))
@ -190,7 +190,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdir = get_exdir(0,2,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/'; $pdir = get_exdir(0,2,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/';
$dir = $conf->product->dir_output.'/'.$pdir; $dir = $conf->product->dir_output.'/'.$pdir;
} }
$realpath=''; $realpath='';
foreach ($objphoto->liste_photos($dir,1) as $key => $obj) foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
{ {
@ -205,7 +205,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
} }
if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
if ($conf->fournisseur->dir_output.'/commande') if ($conf->fournisseur->commande->dir_output)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -412,11 +412,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$showpricebeforepagebreak=1; $showpricebeforepagebreak=1;
$pdf->startTransaction(); $pdf->startTransaction();
if ($posYAfterImage > 0) if ($posYAfterImage > 0)
{ {
$descWidth = $this->posxpicture-$curX; $descWidth = $this->posxpicture-$curX;
} }
else else
{ {
$descWidth = $this->posxtva-$curX; $descWidth = $this->posxtva-$curX;
} }
@ -639,7 +639,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; // Pas d'erreur return 1; // Pas d'erreur
} }
else else

View File

@ -450,8 +450,8 @@ class CommandeFournisseur extends CommonOrder
// in order not to lose the attached files // in order not to lose the attached files
$oldref = dol_sanitizeFileName($this->ref); $oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num); $newref = dol_sanitizeFileName($num);
$dirsource = $conf->fournisseur->dir_output.'/commande/'.$oldref; $dirsource = $conf->fournisseur->commande->dir_output.'/'.$oldref;
$dirdest = $conf->fournisseur->dir_output.'/commande/'.$newref; $dirdest = $conf->fournisseur->commande->dir_output.'/'.$newref;
if (file_exists($dirsource)) if (file_exists($dirsource))
{ {
dol_syslog(get_class($this)."::valid rename dir ".$dirsource." into ".$dirdest); dol_syslog(get_class($this)."::valid rename dir ".$dirsource." into ".$dirdest);
@ -460,7 +460,7 @@ class CommandeFournisseur extends CommonOrder
{ {
dol_syslog("Rename ok"); dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref // Rename docs starting with $oldref with $newref
$listoffiles=dol_dir_list($conf->fournisseur->dir_output.'/commande/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); $listoffiles=dol_dir_list($conf->fournisseur->commande->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
foreach($listoffiles as $fileentry) foreach($listoffiles as $fileentry)
{ {
$dirsource=$fileentry['name']; $dirsource=$fileentry['name'];

View File

@ -71,7 +71,7 @@ if ($object->fetch($id,$ref) < 0)
exit; exit;
} }
$upload_dir = $conf->fournisseur->dir_output.'/commande/'.dol_sanitizeFileName($object->ref); $upload_dir = $conf->fournisseur->commande->dir_output.'/'.dol_sanitizeFileName($object->ref);
$object->fetch_thirdparty(); $object->fetch_thirdparty();

View File

@ -1021,7 +1021,7 @@ if ($resql)
// Other picto tool // Other picto tool
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">'; print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->fournisseur->dir_output.'/commande/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->commande->dir_output.'/' . dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';