Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
8fa3b8dac3
24
dev/ansible/deployplaybook/deploydev.yml
Normal file
24
dev/ansible/deployplaybook/deploydev.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env ansible-playbook
|
||||||
|
|
||||||
|
# Run script with ansible-playbook deploydev.yml
|
||||||
|
# or ./deploydev.yml
|
||||||
|
|
||||||
|
- name: Configure webserver with apache
|
||||||
|
hosts: webservers
|
||||||
|
sudo: True
|
||||||
|
tasks:
|
||||||
|
- name: install apache
|
||||||
|
apt: name=apache update_cache=yes
|
||||||
|
- name: copy apache config file
|
||||||
|
copy: src=files/apachealias.conf dest=/etc/apache/conf.d/dolibarr_dev
|
||||||
|
#- name: enable configuration
|
||||||
|
# file: >
|
||||||
|
# dest=/etc/apache/sites-enabled/default
|
||||||
|
# src=/etc/apache/sites-available/default
|
||||||
|
# state=link
|
||||||
|
- name: copy info.html
|
||||||
|
template: src=templates/info.html.j2 dest=/var/www/dolibarr_dev/info.html
|
||||||
|
mode=0644
|
||||||
|
- name: restart apache
|
||||||
|
service: name=apache state=restarted
|
||||||
|
|
||||||
2
dev/ansible/deployplaybook/files/apachealias.conf
Normal file
2
dev/ansible/deployplaybook/files/apachealias.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
Alias /dolibarr_dev /var/www/dolibarr
|
||||||
2
dev/ansible/deployplaybook/hosts
Normal file
2
dev/ansible/deployplaybook/hosts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[webservers]
|
||||||
|
testserver ansible_ssh_host=127.0.0.1 ansible_ssh_port=22
|
||||||
10
dev/ansible/deployplaybook/templates/info.html.j2
Normal file
10
dev/ansible/deployplaybook/templates/info.html.j2
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Page info ansible</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Apache, configured by Ansible</h1>
|
||||||
|
<p>If you can see this, Ansible successfully installed apache.</p>
|
||||||
|
<p>{{ ansible_managed }}</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -322,15 +322,15 @@ if (empty($reshook))
|
|||||||
if ($result >= 0 && ! count($object->errors))
|
if ($result >= 0 && ! count($object->errors))
|
||||||
{
|
{
|
||||||
// Logo/Photo save
|
// Logo/Photo save
|
||||||
$dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1).'/photos';
|
$dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1,$object,'member').'/photos';
|
||||||
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
|
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
|
||||||
if ($file_OK)
|
if ($file_OK)
|
||||||
{
|
{
|
||||||
if (GETPOST('deletephoto'))
|
if (GETPOST('deletephoto'))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
$fileimg=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/'.$object->photo;
|
$fileimg=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'member').'/photos/'.$object->photo;
|
||||||
$dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/thumbs';
|
$dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'member').'/photos/thumbs';
|
||||||
dol_delete_file($fileimg);
|
dol_delete_file($fileimg);
|
||||||
dol_delete_dir_recursive($dirthumbs);
|
dol_delete_dir_recursive($dirthumbs);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,6 @@ if (! $sortorder) $sortorder="ASC";
|
|||||||
if (! $sortfield) $sortfield="name";
|
if (! $sortfield) $sortfield="name";
|
||||||
|
|
||||||
|
|
||||||
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir($id,2,0,1) . '/' . $id;
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$object=new Adherent($db);
|
$object=new Adherent($db);
|
||||||
$membert=new AdherentType($db);
|
$membert=new AdherentType($db);
|
||||||
@ -70,6 +69,9 @@ if ($result < 0)
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'member') . '/' . dol_sanitizeFileName($object->ref);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -439,6 +439,26 @@ print "\n";
|
|||||||
<div align="center"><input type="submit" class="button"
|
<div align="center"><input type="submit" class="button"
|
||||||
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
|
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (! empty($_SESSION["commandbackuplastdone"]))
|
||||||
|
{
|
||||||
|
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||||
|
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
//print $paramclear;
|
||||||
|
|
||||||
|
// Now run command and show result
|
||||||
|
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||||
|
print $_SESSION["commandbackupresult"];
|
||||||
|
|
||||||
|
$_SESSION["commandbackuplastdone"]='';
|
||||||
|
$_SESSION["commandbackuptorun"]='';
|
||||||
|
$_SESSION["commandbackupresult"]='';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@ -70,6 +70,10 @@ if ($action == 'delete')
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$_SESSION["commandbackuplastdone"]='';
|
||||||
|
$_SESSION["commandbackuptorun"]='';
|
||||||
|
$_SESSION["commandbackupresult"]='';
|
||||||
|
|
||||||
// Increase limit of time. Works only if we are not in safe mode
|
// Increase limit of time. Works only if we are not in safe mode
|
||||||
$ExecTimeLimit=600;
|
$ExecTimeLimit=600;
|
||||||
if (!empty($ExecTimeLimit))
|
if (!empty($ExecTimeLimit))
|
||||||
@ -354,21 +358,24 @@ if ($what == 'postgresql')
|
|||||||
if ($errormsg)
|
if ($errormsg)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("Error")." : ".$errormsg, 'errors');
|
setEventMessage($langs->trans("Error")." : ".$errormsg, 'errors');
|
||||||
/*
|
|
||||||
print '<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
|
$resultstring='';
|
||||||
print '<br>';
|
$resultstring.='<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
|
||||||
print '<br>';*/
|
|
||||||
|
$_SESSION["commandbackupresult"]=$resultstring;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($what)
|
if ($what)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"));
|
setEventMessage($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"));
|
||||||
/*print '<div class="ok">';
|
|
||||||
print $langs->trans("BackupFileSuccessfullyCreated").'.<br>';
|
$resultstring='<div class="ok">';
|
||||||
print $langs->trans("YouCanDownloadBackupFile");
|
$resultstring.=$langs->trans("BackupFileSuccessfullyCreated").'.<br>';
|
||||||
print '</div>';
|
$resultstring.=$langs->trans("YouCanDownloadBackupFile");
|
||||||
print '<br>';*/
|
$resultstring.='<div>';
|
||||||
|
|
||||||
|
$_SESSION["commandbackupresult"]=$resultstring;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -24,6 +25,7 @@
|
|||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
|
||||||
if (! $user->admin)
|
if (! $user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -59,6 +61,32 @@ $search_user = GETPOST("search_user");
|
|||||||
$search_desc = GETPOST("search_desc");
|
$search_desc = GETPOST("search_desc");
|
||||||
$search_ua = GETPOST("search_ua");
|
$search_ua = GETPOST("search_ua");
|
||||||
|
|
||||||
|
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||||
|
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||||
|
|
||||||
|
// checks:if date_start>date_end then date_end=date_start + 24 hours
|
||||||
|
if ($date_start > $date_end) $date_end=$date_start+86400;
|
||||||
|
|
||||||
|
$now = dol_now();
|
||||||
|
$nowarray = dol_getdate($now);
|
||||||
|
|
||||||
|
$params = "&search_code=$search_code&search_ip=$search_ip&search_user=$search_user&search_desc=$search_desc&search_ua=$search_ua";
|
||||||
|
$params.= "&date_startmonth=".$_REQUEST["date_startmonth"];
|
||||||
|
$params.= "&date_startday=".$_REQUEST["date_startday"];
|
||||||
|
$params.= "&date_startyear=".$_REQUEST["date_startyear"];
|
||||||
|
$params.= "&date_endmonth=".$_REQUEST["date_endmonth"];
|
||||||
|
$params.= "&date_endday=".$_REQUEST["date_endday"];
|
||||||
|
$params.= "&date_endyear=".$_REQUEST["date_endyear"];
|
||||||
|
|
||||||
|
if (empty($date_start)) // We define date_start and date_end
|
||||||
|
{
|
||||||
|
$date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false);
|
||||||
|
}
|
||||||
|
if (empty($date_end))
|
||||||
|
{
|
||||||
|
$date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -124,6 +152,7 @@ $sql.= " u.login";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."events as e";
|
$sql.= " FROM ".MAIN_DB_PREFIX."events as e";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
|
||||||
$sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")";
|
$sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")";
|
||||||
|
$sql.= " AND e.dateevent >= '".$db->idate($date_start)."' AND e.dateevent <= '".$db->idate($date_end)."'";
|
||||||
if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; }
|
if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; }
|
||||||
if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; }
|
if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; }
|
||||||
if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; }
|
if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; }
|
||||||
@ -145,7 +174,8 @@ if ($result)
|
|||||||
if ($search_desc) $param.='&search_desc='.$search_desc;
|
if ($search_desc) $param.='&search_desc='.$search_desc;
|
||||||
if ($search_ua) $param.='&search_ua='.$search_ua;
|
if ($search_ua) $param.='&search_ua='.$search_ua;
|
||||||
|
|
||||||
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup');
|
$langs->load('withdrawals');
|
||||||
|
print_barre_liste($langs->trans("ListOfSecurityEvents").' : '.$num.' '.strtolower($langs->trans("Lines")), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup');
|
||||||
|
|
||||||
if ($action == 'purge')
|
if ($action == 'purge')
|
||||||
{
|
{
|
||||||
@ -168,7 +198,7 @@ if ($result)
|
|||||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre" width="15%">'.$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).$form->select_date($date_end,'date_end',0,0,0,'',1,0,1).'</td>';
|
||||||
|
|
||||||
print '<td align="left" class="liste_titre">';
|
print '<td align="left" class="liste_titre">';
|
||||||
print '<input class="flat" type="text" size="10" name="search_code" value="'.$search_code.'">';
|
print '<input class="flat" type="text" size="10" name="search_code" value="'.$search_code.'">';
|
||||||
|
|||||||
@ -1302,7 +1302,7 @@ class Categorie extends CommonObject
|
|||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/";
|
$dir = $sdir .'/'. get_exdir($this->id,2,0,0,$this,'category') . $this->id ."/";
|
||||||
$dir .= "photos/";
|
$dir .= "photos/";
|
||||||
|
|
||||||
if (! file_exists($dir))
|
if (! file_exists($dir))
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
@ -28,6 +28,7 @@
|
|||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
@ -151,8 +152,7 @@ foreach($fulltree as $key => $val)
|
|||||||
'rowid'=>$val['rowid'],
|
'rowid'=>$val['rowid'],
|
||||||
'fk_menu'=>$val['fk_parent'],
|
'fk_menu'=>$val['fk_parent'],
|
||||||
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.$li.
|
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.$li.
|
||||||
'</td><td width="50%">'.
|
'</td><td width="50%">'.dolGetFirstLineOfText($val['description']).'</td>'.
|
||||||
' '.$val['description'].'</td>'.
|
|
||||||
'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
|
'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
|
||||||
'</tr></table>'
|
'</tr></table>'
|
||||||
);
|
);
|
||||||
@ -160,7 +160,7 @@ foreach($fulltree as $key => $val)
|
|||||||
|
|
||||||
|
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td>'.$langs->trans("Description").'</td><td align="right">';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td></td><td align="right">';
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
print '<div id="iddivjstreecontrol"><a href="#">'.img_picto('','object_category').' '.$langs->trans("UndoExpandAll").'</a> | <a href="#">'.img_picto('','object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div>';
|
print '<div id="iddivjstreecontrol"><a href="#">'.img_picto('','object_category').' '.$langs->trans("UndoExpandAll").'</a> | <a href="#">'.img_picto('','object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div>';
|
||||||
|
|||||||
@ -224,7 +224,7 @@ if ($object->id)
|
|||||||
$maxWidth = 160;
|
$maxWidth = 160;
|
||||||
$maxHeight = 120;
|
$maxHeight = 120;
|
||||||
|
|
||||||
$pdir = get_exdir($object->id,2) . $object->id ."/photos/";
|
$pdir = get_exdir($object->id,2,0,0,$object,'category') . $object->id ."/photos/";
|
||||||
$dir = $upload_dir.'/'.$pdir;
|
$dir = $upload_dir.'/'.$pdir;
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -847,13 +847,10 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
if ($result <= 0)
|
||||||
if ($result <= 0) {
|
{
|
||||||
dol_print_error($db, $result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit();
|
$action='';
|
||||||
} else {
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1760,7 +1757,8 @@ if ($action == 'create')
|
|||||||
// Build document if it not exists
|
// Build document if it not exists
|
||||||
if (! $file || ! is_readable($file)) {
|
if (! $file || ! is_readable($file)) {
|
||||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0) {
|
if ($result <= 0)
|
||||||
|
{
|
||||||
dol_print_error($db, $result);
|
dol_print_error($db, $result);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,7 +153,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'mailing');
|
||||||
|
|
||||||
if ($object->statut == 0)
|
if ($object->statut == 0)
|
||||||
{
|
{
|
||||||
@ -398,7 +398,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'mailing');
|
||||||
|
|
||||||
$object->sendto = $_POST["sendto"];
|
$object->sendto = $_POST["sendto"];
|
||||||
if (! $object->sendto)
|
if (! $object->sendto)
|
||||||
@ -495,7 +495,7 @@ if (empty($reshook))
|
|||||||
// Action update description of emailing
|
// Action update description of emailing
|
||||||
if ($action == 'settitre' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto')
|
if ($action == 'settitre' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto')
|
||||||
{
|
{
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'mailing');
|
||||||
|
|
||||||
if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha'));
|
if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha'));
|
||||||
else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha'));
|
else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha'));
|
||||||
@ -527,7 +527,7 @@ if (empty($reshook))
|
|||||||
*/
|
*/
|
||||||
if (! empty($_POST['addfile']))
|
if (! empty($_POST['addfile']))
|
||||||
{
|
{
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'mailing');
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ if (empty($reshook))
|
|||||||
// Action remove file
|
// Action remove file
|
||||||
if (! empty($_POST["removedfile"]))
|
if (! empty($_POST["removedfile"]))
|
||||||
{
|
{
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'mailing');
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
@ -719,7 +719,7 @@ else
|
|||||||
{
|
{
|
||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'mailing');
|
||||||
|
|
||||||
$head = emailing_prepare_head($object);
|
$head = emailing_prepare_head($object);
|
||||||
|
|
||||||
|
|||||||
@ -1065,13 +1065,10 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
if ($result <= 0)
|
||||||
if ($result <= 0) {
|
{
|
||||||
dol_print_error($db, $result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit();
|
$action='';
|
||||||
} else {
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1091,10 +1091,10 @@ if (empty($reshook))
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
if ($result <= 0)
|
||||||
if ($result <= 0) {
|
{
|
||||||
dol_print_error($db, $result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit();
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1743,8 +1743,8 @@ if (empty($reshook))
|
|||||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db, $result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit();
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -262,7 +262,7 @@ else if ($action == 'remove_file' && $user->rights->banque->cheque)
|
|||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
$file=$dir.get_exdir($object->number,2,1) . GETPOST('file');
|
$file=$dir.get_exdir($object->number,2,1,0,$object,'cheque') . GETPOST('file');
|
||||||
$ret=dol_delete_file($file,0,0,0,$object);
|
$ret=dol_delete_file($file,0,0,0,$object);
|
||||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
|
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
|
||||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
|
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
|
||||||
@ -704,7 +704,7 @@ if ($action != 'new')
|
|||||||
if ($object->statut == 1)
|
if ($object->statut == 1)
|
||||||
{
|
{
|
||||||
$filename=dol_sanitizeFileName($object->ref);
|
$filename=dol_sanitizeFileName($object->ref);
|
||||||
$filedir=$dir.get_exdir($object->number,2,1) . dol_sanitizeFileName($object->ref);
|
$filedir=$dir.get_exdir($object->number,2,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref);
|
||||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||||
|
|
||||||
$formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1);
|
$formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1);
|
||||||
|
|||||||
@ -807,13 +807,10 @@ else if ($action == 'builddoc' && $user->rights->contrat->creer) {
|
|||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
if ($result <= 0)
|
||||||
if ($result <= 0) {
|
{
|
||||||
dol_print_error($db, $result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit();
|
$action='';
|
||||||
} else {
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -132,7 +132,7 @@ class FileUpload
|
|||||||
|
|
||||||
$object_ref = dol_sanitizeFileName($object->ref);
|
$object_ref = dol_sanitizeFileName($object->ref);
|
||||||
if ($element == 'invoice_supplier') {
|
if ($element == 'invoice_supplier') {
|
||||||
$object_ref = get_exdir($object->id, 2) . $object_ref;
|
$object_ref = get_exdir($object->id,2,0,0,$object,'invoice_supplier') . $object_ref;
|
||||||
} else if ($element == 'project_task') {
|
} else if ($element == 'project_task') {
|
||||||
$object_ref = $object->project->ref . '/' . $object_ref;
|
$object_ref = $object->project->ref . '/' . $object_ref;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4806,19 +4806,19 @@ class Form
|
|||||||
else if ($modulepart=='userphoto')
|
else if ($modulepart=='userphoto')
|
||||||
{
|
{
|
||||||
$dir=$conf->user->dir_output;
|
$dir=$conf->user->dir_output;
|
||||||
if ($object->photo) $file=get_exdir($id, 2).$object->photo;
|
if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo;
|
||||||
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
||||||
$email=$object->email;
|
$email=$object->email;
|
||||||
}
|
}
|
||||||
else if ($modulepart=='memberphoto')
|
else if ($modulepart=='memberphoto')
|
||||||
{
|
{
|
||||||
$dir=$conf->adherent->dir_output;
|
$dir=$conf->adherent->dir_output;
|
||||||
if ($object->photo) $file=get_exdir($id, 2).'photos/'.$object->photo;
|
if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo;
|
||||||
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
||||||
$email=$object->email;
|
$email=$object->email;
|
||||||
}else {
|
}else {
|
||||||
$dir=$conf->$modulepart->dir_output;
|
$dir=$conf->$modulepart->dir_output;
|
||||||
if ($object->photo) $file=get_exdir($id, 2).'photos/'.$object->photo;
|
if ($object->photo) $file=get_exdir($id, 2, 0, 0, $adherent, 'member').'photos/'.$object->photo;
|
||||||
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
||||||
$email=$object->email;
|
$email=$object->email;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -265,7 +265,6 @@ class FormFile
|
|||||||
|
|
||||||
if (! is_object($form)) $form=new Form($this->db);
|
if (! is_object($form)) $form=new Form($this->db);
|
||||||
|
|
||||||
// filedir = $conf->...->dir_ouput."/".get_exdir(id)
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
@ -579,11 +578,9 @@ class FormFile
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
// Define relative path for download link (depends on module)
|
// Define relative path for download link (depends on module)
|
||||||
$relativepath=$file["name"]; // Cas general
|
$relativepath=$file["name"]; // Cas general
|
||||||
if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture...
|
if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture...
|
||||||
// Autre cas
|
if ($modulepart == 'export') $relativepath = $file["name"]; // Other case
|
||||||
if ($modulepart == 'donation') { $relativepath = get_exdir($modulesubdir,2).$file["name"]; }
|
|
||||||
if ($modulepart == 'export') { $relativepath = $file["name"]; }
|
|
||||||
|
|
||||||
$out.= "<tr ".$bc[$var].">";
|
$out.= "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
@ -701,14 +698,14 @@ class FormFile
|
|||||||
if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture...
|
if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture...
|
||||||
// Autre cas
|
// Autre cas
|
||||||
if ($modulepart == 'donation') {
|
if ($modulepart == 'donation') {
|
||||||
$relativepath = get_exdir($modulesubdir,2).$file["name"];
|
$relativepath = get_exdir($modulesubdir,2,0,0,null,'donation').$file["name"];
|
||||||
}
|
}
|
||||||
if ($modulepart == 'export') {
|
if ($modulepart == 'export') {
|
||||||
$relativepath = $file["name"];
|
$relativepath = $file["name"];
|
||||||
}
|
}
|
||||||
if ($modulepart == 'facture_fournisseur') {
|
if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_fournisseur') {
|
||||||
$relativepath = get_exdir($modulesubdir, 2). $modulesubdir. "/" . $file["name"];
|
$relativepath = get_exdir($modulesubdir, 2,0,0,null,'invoice_supplier'). $modulesubdir. "/" . $file["name"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show file name with link to download
|
// Show file name with link to download
|
||||||
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||||
@ -802,8 +799,8 @@ class FormFile
|
|||||||
if (empty($relativepath))
|
if (empty($relativepath))
|
||||||
{
|
{
|
||||||
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
|
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
|
||||||
if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2).$relativepath; // TODO Call using a defined value for $relativepath
|
if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2,0,0,$object,'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath
|
||||||
if ($object->element == 'member') $relativepath=get_exdir($object->id,2).$relativepath; // TODO Call using a defined value for $relativepath
|
if ($object->element == 'member') $relativepath=get_exdir($object->id,2,0,0,$object,'member').$relativepath; // TODO Call using a defined value for $relativepath
|
||||||
if ($object->element == 'project_task') $relativepath='Call_not_supported_._Call_function_using_a_defined_relative_path_.';
|
if ($object->element == 'project_task') $relativepath='Call_not_supported_._Call_function_using_a_defined_relative_path_.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1399,7 +1399,7 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta
|
|||||||
/**
|
/**
|
||||||
* Security check when accessing to a document (used by document.php, viewimage.php and webservices)
|
* Security check when accessing to a document (used by document.php, viewimage.php and webservices)
|
||||||
*
|
*
|
||||||
* @param string $modulepart Module of document (module, module_user_temp, module_user or module_temp)
|
* @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp')
|
||||||
* @param string $original_file Relative path with filename
|
* @param string $original_file Relative path with filename
|
||||||
* @param string $entity Restrict onto entity
|
* @param string $entity Restrict onto entity
|
||||||
* @param User $fuser User object (forced)
|
* @param User $fuser User object (forced)
|
||||||
@ -1817,7 +1817,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
|||||||
$accessallowed=1;
|
$accessallowed=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$original_file=$conf->banque->dir_output.'/bordereau/'.get_exdir(basename($original_file,".pdf"),2,1).$original_file;
|
$original_file=$conf->banque->dir_output.'/bordereau/'.$original_file; // original_file should contains relative path so include the get_exdir result
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrapping for export module
|
// Wrapping for export module
|
||||||
|
|||||||
@ -69,7 +69,7 @@ function facturefourn_prepare_head($object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$object->ref;
|
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$object->ref;
|
||||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
|
|||||||
@ -1127,19 +1127,6 @@ function dol_getdate($timestamp,$fast=false)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$arrayinfo=getdate($timestamp);
|
$arrayinfo=getdate($timestamp);
|
||||||
|
|
||||||
/*$startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1;
|
|
||||||
if($startday==1)
|
|
||||||
{
|
|
||||||
if ($arrayinfo["wday"]==0)
|
|
||||||
{
|
|
||||||
$arrayinfo["wday"]=6;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$arrayinfo["wday"]=$arrayinfo["wday"]-1;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arrayinfo;
|
return $arrayinfo;
|
||||||
@ -2886,14 +2873,14 @@ function print_fleche_navigation($page,$file,$options='',$nextpage=0,$betweenarr
|
|||||||
print '<div class="pagination"><ul>';
|
print '<div class="pagination"><ul>';
|
||||||
if ($page > 0)
|
if ($page > 0)
|
||||||
{
|
{
|
||||||
if (empty($conf->dol_use_jmobile)) print '<li><a class="paginationprevious" href="'.$file.'?page='.($page-1).$options.'"><</a></li>';
|
if (empty($conf->dol_use_jmobile)) print '<li class="pagination"><a class="paginationprevious" href="'.$file.'?page='.($page-1).$options.'"><</a></li>';
|
||||||
else print '<li><a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$file.'?page='.($page-1).$options.'">'.$langs->trans("Previous").'</a></li>';
|
else print '<li><a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$file.'?page='.($page-1).$options.'">'.$langs->trans("Previous").'</a></li>';
|
||||||
}
|
}
|
||||||
//if ($betweenarrows) print ($page > 0?' ':'').$betweenarrows.($nextpage>0?' ':'');
|
//if ($betweenarrows) print ($page > 0?' ':'').$betweenarrows.($nextpage>0?' ':'');
|
||||||
print $betweenarrows;
|
print $betweenarrows;
|
||||||
if ($nextpage > 0)
|
if ($nextpage > 0)
|
||||||
{
|
{
|
||||||
if (empty($conf->dol_use_jmobile)) print '<li><a class="paginationnext" href="'.$file.'?page='.($page+1).$options.'">></a></li>';
|
if (empty($conf->dol_use_jmobile)) print '<li class="pagination"><a class="paginationnext" href="'.$file.'?page='.($page+1).$options.'">></a></li>';
|
||||||
else print '<li><a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$file.'?page='.($page+1).$options.'">'.$langs->trans("Next").'</a></li>';
|
else print '<li><a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$file.'?page='.($page+1).$options.'">'.$langs->trans("Next").'</a></li>';
|
||||||
}
|
}
|
||||||
if ($afterarrows)
|
if ($afterarrows)
|
||||||
@ -3714,26 +3701,46 @@ function yn($yesno, $case=1, $color=0)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a path to have a directory according to an id
|
* Return a path to have a directory according to object.
|
||||||
* Examples: '001' with level 3->"0/0/1/", '015' with level 3->"0/1/5/"
|
* Examples: '001' with level 3->"0/0/1/", '015' with level 3->"0/1/5/"
|
||||||
* Examples: 'ABC-1' with level 3 ->"0/0/1/", '015' with level 1->"5/"
|
* Examples: 'ABC-1' with level 3 ->"0/0/1/", '015' with level 1->"5/"
|
||||||
*
|
*
|
||||||
* @param string $num Id to develop
|
* @param string $num Id of object
|
||||||
* @param int $level Level of development (1, 2 or 3 level)
|
* @param int $level Level of subdirs to return (1, 2 or 3 levels)
|
||||||
* @param int $alpha Use alpha ref
|
* @param int $alpha Use alpha ref
|
||||||
* @param int $withoutslash 0=With slash at end, 1=without slash at end
|
* @param int $withoutslash 0=With slash at end, 1=without slash at end (except if '/', we return '')
|
||||||
* @return string Dir to use
|
* @param Object $object Object
|
||||||
|
* @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...')
|
||||||
|
* @return string Dir to use ending. Example '' or '1/' or '1/2/'
|
||||||
*/
|
*/
|
||||||
function get_exdir($num,$level=3,$alpha=0,$withoutslash=0)
|
function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$path = '';
|
$path = '';
|
||||||
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);
|
|
||||||
else $num = preg_replace('/^.*\-/i','',$num);
|
// TODO if object is null, load it from id and modulepart.
|
||||||
$num = substr("000".$num, -$level);
|
|
||||||
if ($level == 1) $path = substr($num,0,1);
|
|
||||||
if ($level == 2) $path = substr($num,1,1).'/'.substr($num,0,1);
|
if (! empty($level) && in_array($modulepart, array('cheque','user','category','shipment', 'member','don','donation','supplier_invoice','invoice_supplier')))
|
||||||
if ($level == 3) $path = substr($num,2,1).'/'.substr($num,1,1).'/'.substr($num,0,1);
|
{
|
||||||
if (empty($withoutslash)) $path.='/';
|
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
|
||||||
|
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);
|
||||||
|
else $num = preg_replace('/^.*\-/i','',$num);
|
||||||
|
$num = substr("000".$num, -$level);
|
||||||
|
if ($level == 1) $path = substr($num,0,1);
|
||||||
|
if ($level == 2) $path = substr($num,1,1).'/'.substr($num,0,1);
|
||||||
|
if ($level == 3) $path = substr($num,2,1).'/'.substr($num,1,1).'/'.substr($num,0,1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
// We will introduce here a common way of forging path for document storage
|
||||||
|
// Here, $num=id, ref and modulepart are required.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($withoutslash) && ! empty($path)) $path.='/';
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4013,7 +4020,7 @@ function dol_nboflines($s,$maxchar=0)
|
|||||||
* @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
|
* @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
|
||||||
* @param string $charset Give the charset used to encode the $text variable in memory.
|
* @param string $charset Give the charset used to encode the $text variable in memory.
|
||||||
* @return int Number of lines
|
* @return int Number of lines
|
||||||
* @see dol_nboflines
|
* @see dol_nboflines, dolGetFirstLineOfText
|
||||||
*/
|
*/
|
||||||
function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
|
function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,6 +29,25 @@
|
|||||||
// Enable this line to trace path when function is called.
|
// Enable this line to trace path when function is called.
|
||||||
//print xdebug_print_function_stack('Functions2.lib was called');exit;
|
//print xdebug_print_function_stack('Functions2.lib was called');exit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return first line of text. Cut will depends if content is HTML or not.
|
||||||
|
*
|
||||||
|
* @param string $text Input text
|
||||||
|
* @return string Output text
|
||||||
|
* @see dol_nboflines_bis
|
||||||
|
*/
|
||||||
|
function dolGetFirstLineOfText($text)
|
||||||
|
{
|
||||||
|
if (dol_textishtml($text))
|
||||||
|
{
|
||||||
|
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$firstline=preg_replace('/[\n\r].*/','',$text);
|
||||||
|
}
|
||||||
|
return $firstline.((strlen($firstline) != strlen($text))?'...':'');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same function than javascript unescape() function but in PHP.
|
* Same function than javascript unescape() function but in PHP.
|
||||||
|
|||||||
@ -165,7 +165,7 @@ class pdf_aurore extends ModelePDFAskPriceSupplier
|
|||||||
$objphoto = new Product($this->db);
|
$objphoto = new Product($this->db);
|
||||||
$objphoto->fetch($object->lines[$i]->fk_product);
|
$objphoto->fetch($object->lines[$i]->fk_product);
|
||||||
|
|
||||||
$pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/";
|
$pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/";
|
||||||
$dir = $conf->product->dir_output.'/'.$pdir;
|
$dir = $conf->product->dir_output.'/'.$pdir;
|
||||||
|
|
||||||
$realpath='';
|
$realpath='';
|
||||||
|
|||||||
@ -98,7 +98,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
|
|||||||
$outputlangs->load("products");
|
$outputlangs->load("products");
|
||||||
$outputlangs->load("compta");
|
$outputlangs->load("compta");
|
||||||
|
|
||||||
$dir = $_dir . "/".get_exdir($number,2,1).$number;
|
$dir = $_dir . "/".get_exdir($number,2,1,0,null,'cheque').$number;
|
||||||
|
|
||||||
if (! is_dir($dir))
|
if (! is_dir($dir))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class html_cerfafr extends ModeleDon
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$donref = dol_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,0,1,$don,'donation') . "/" . dol_sanitizeFileName($don->ref);
|
||||||
$file = $dir . "/" . $donref . ".html";
|
$file = $dir . "/" . $donref . ".html";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -190,7 +190,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$objphoto = new Product($this->db);
|
$objphoto = new Product($this->db);
|
||||||
$objphoto->fetch($object->lines[$i]->fk_product);
|
$objphoto->fetch($object->lines[$i]->fk_product);
|
||||||
|
|
||||||
$pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/";
|
$pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,'product') . $object->lines[$i]->fk_product ."/photos/";
|
||||||
$dir = $conf->product->dir_output.'/'.$pdir;
|
$dir = $conf->product->dir_output.'/'.$pdir;
|
||||||
|
|
||||||
$realpath='';
|
$realpath='';
|
||||||
|
|||||||
@ -96,7 +96,7 @@ class pdf_standard extends CommonStickerGenerator
|
|||||||
$dir=$conf->adherent->dir_output;
|
$dir=$conf->adherent->dir_output;
|
||||||
if (! empty($photo))
|
if (! empty($photo))
|
||||||
{
|
{
|
||||||
$file=get_exdir($idmember,2).'photos/'.$photo;
|
$file=get_exdir($idmember,2,0,0,null,'member').'photos/'.$photo;
|
||||||
$photo=$dir.'/'.$file;
|
$photo=$dir.'/'.$file;
|
||||||
if (! is_readable($photo)) $photo='';
|
if (! is_readable($photo)) $photo='';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,13 +179,13 @@ class pdf_azur extends ModelePDFPropales
|
|||||||
|
|
||||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||||
{
|
{
|
||||||
$pdir[0] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
|
$pdir[0] = get_exdir($objphoto->id,2,0,0,$objphoto,'product') . $objphoto->id ."/photos/";
|
||||||
$pdir[1] = dol_sanitizeFileName($objphoto->ref).'/';
|
$pdir[1] = dol_sanitizeFileName($objphoto->ref).'/';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pdir[0] = dol_sanitizeFileName($objphoto->ref).'/';
|
$pdir[0] = dol_sanitizeFileName($objphoto->ref).'/'; // default
|
||||||
$pdir[1] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
|
$pdir[1] = get_exdir($objphoto->id,2,0,0,$objphoto,'product') . $objphoto->id ."/photos/"; // alternative
|
||||||
}
|
}
|
||||||
|
|
||||||
$arephoto = false;
|
$arephoto = false;
|
||||||
|
|||||||
@ -173,7 +173,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||||||
{
|
{
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
$objectref = dol_sanitizeFileName($object->ref);
|
||||||
$objectrefsupplier = dol_sanitizeFileName($object->ref_supplier);
|
$objectrefsupplier = dol_sanitizeFileName($object->ref_supplier);
|
||||||
$dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$objectref;
|
$dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$objectref;
|
||||||
$file = $dir . "/" . $objectref . ".pdf";
|
$file = $dir . "/" . $objectref . ".pdf";
|
||||||
if (! empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir . "/" . $objectref . ($objectrefsupplier?"_".$objectrefsupplier:"").".pdf";
|
if (! empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir . "/" . $objectref . ($objectrefsupplier?"_".$objectrefsupplier:"").".pdf";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -173,6 +173,10 @@ if ($action == 'add')
|
|||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer)
|
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer)
|
||||||
@ -232,7 +236,7 @@ if ($action == 'set_paid')
|
|||||||
if ($action == 'builddoc')
|
if ($action == 'builddoc')
|
||||||
{
|
{
|
||||||
$object = new Don($db);
|
$object = new Don($db);
|
||||||
$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
|
|
||||||
// Save last template used to generate document
|
// Save last template used to generate document
|
||||||
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
||||||
@ -380,6 +384,7 @@ if (! empty($id) && $action == 'edit')
|
|||||||
dol_print_error($db); exit;
|
dol_print_error($db); exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hselected='card';
|
||||||
$head = donation_prepare_head($object);
|
$head = donation_prepare_head($object);
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
||||||
|
|
||||||
@ -507,6 +512,8 @@ if (! empty($id) && $action != 'edit')
|
|||||||
dol_print_error($db); exit;
|
dol_print_error($db); exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hselected='card';
|
||||||
|
|
||||||
$head = donation_prepare_head($object);
|
$head = donation_prepare_head($object);
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
||||||
|
|
||||||
@ -720,7 +727,7 @@ if (! empty($id) && $action != 'edit')
|
|||||||
* Documents generes
|
* Documents generes
|
||||||
*/
|
*/
|
||||||
$filename=dol_sanitizeFileName($object->id);
|
$filename=dol_sanitizeFileName($object->id);
|
||||||
$filedir=$conf->don->dir_output . '/' . get_exdir($filename,2);
|
$filedir=$conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref);
|
||||||
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$object->id;
|
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$object->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);
|
||||||
// $delallowed=$user->rights->facture->supprimer;
|
// $delallowed=$user->rights->facture->supprimer;
|
||||||
@ -730,7 +737,7 @@ if (! empty($id) && $action != 'edit')
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
$formfile->show_documents('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed);
|
$formfile->show_documents('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
|
||||||
|
|
||||||
print '</td><td> </td>';
|
print '</td><td> </td>';
|
||||||
|
|
||||||
|
|||||||
@ -60,9 +60,10 @@ class Don extends CommonObject
|
|||||||
var $note_private;
|
var $note_private;
|
||||||
var $note_public;
|
var $note_public;
|
||||||
var $statut;
|
var $statut;
|
||||||
|
var $modelpdf;
|
||||||
var $projet;
|
var $projet;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -306,7 +307,7 @@ class Don extends CommonObject
|
|||||||
* @return int <0 if KO, id of created donation if OK
|
* @return int <0 if KO, id of created donation if OK
|
||||||
* TODO add numbering module for Ref
|
* TODO add numbering module for Ref
|
||||||
*/
|
*/
|
||||||
function create($user, $notrigger)
|
function create($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -601,7 +602,7 @@ class Don extends CommonObject
|
|||||||
$sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,";
|
$sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,";
|
||||||
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
||||||
$sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
|
$sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
|
||||||
$sql.= " d.phone_mobile, d.fk_projet,";
|
$sql.= " d.phone_mobile, d.fk_projet, d.model_pdf,";
|
||||||
$sql.= " p.title as project_label,";
|
$sql.= " p.title as project_label,";
|
||||||
$sql.= " c.code as country_code, c.label as country";
|
$sql.= " c.code as country_code, c.label as country";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||||
@ -655,6 +656,7 @@ class Don extends CommonObject
|
|||||||
$this->amount = $obj->amount;
|
$this->amount = $obj->amount;
|
||||||
$this->note_private = $obj->note_private;
|
$this->note_private = $obj->note_private;
|
||||||
$this->note_public = $obj->note_public;
|
$this->note_public = $obj->note_public;
|
||||||
|
$this->modelpdf = $obj->model_pdf;
|
||||||
$this->commentaire = $obj->note; // deprecated
|
$this->commentaire = $obj->note; // deprecated
|
||||||
|
|
||||||
// Retrieve all extrafield for thirdparty
|
// Retrieve all extrafield for thirdparty
|
||||||
|
|||||||
@ -409,8 +409,8 @@ if (empty($reshook))
|
|||||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit;
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -497,7 +497,7 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if ($this->statut == 0) $this->brouillon = 1;
|
if ($this->statut == 0) $this->brouillon = 1;
|
||||||
|
|
||||||
$file = $conf->expedition->dir_output . "/" .get_exdir($this->id, 2) . "/" . $this->id.".pdf";
|
$file = $conf->expedition->dir_output . "/" .get_exdir($this->id, 2, 0, 0, $this, 'shipment') . "/" . $this->id.".pdf";
|
||||||
$this->pdf_filename = $file;
|
$this->pdf_filename = $file;
|
||||||
|
|
||||||
// Tracking url
|
// Tracking url
|
||||||
|
|||||||
@ -1030,13 +1030,8 @@ if ($action == 'builddoc') // GET or POST
|
|||||||
$result=expensereport_pdf_create($db, $depl, '', $depl->modelpdf, $outputlangs);
|
$result=expensereport_pdf_create($db, $depl, '', $depl->modelpdf, $outputlangs);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit;
|
$action='';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$depl->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2066,7 +2066,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$sql.= ",total_localtax2='".price2num($total_localtax2)."'";
|
$sql.= ",total_localtax2='".price2num($total_localtax2)."'";
|
||||||
$sql.= ",total_ttc='".price2num($total_ttc)."'";
|
$sql.= ",total_ttc='".price2num($total_ttc)."'";
|
||||||
$sql.= ",product_type=".$type;
|
$sql.= ",product_type=".$type;
|
||||||
$sql.= ($fk_unit ? "'".$this->db->escape($fk_unit)."'":"null");
|
$sql.= ($fk_unit ? ",fk_unit='".$this->db->escape($fk_unit)."'":", fk_unit=null");
|
||||||
$sql.= " WHERE rowid = ".$rowid;
|
$sql.= " WHERE rowid = ".$rowid;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
|
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
|
||||||
|
|||||||
@ -736,7 +736,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$ref = dol_sanitizeFileName($this->ref);
|
$ref = dol_sanitizeFileName($this->ref);
|
||||||
$dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2).$ref;
|
$dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoive_supplier').$ref;
|
||||||
$file = $dir . "/" . $ref . ".pdf";
|
$file = $dir . "/" . $ref . ".pdf";
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
@ -975,8 +975,8 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$oldref = dol_sanitizeFileName($this->ref);
|
$oldref = dol_sanitizeFileName($this->ref);
|
||||||
$newref = dol_sanitizeFileName($num);
|
$newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
$dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$oldref;
|
$dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2,0,0, $this, 'invoive_supplier').$oldref;
|
||||||
$dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$newref;
|
$dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2,0,0, $this, 'invoive_supplier').$newref;
|
||||||
if (file_exists($dirsource))
|
if (file_exists($dirsource))
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||||
@ -985,7 +985,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
{
|
{
|
||||||
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->facture->dir_output.'/'.get_exdir($this->id,2).$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
$listoffiles=dol_dir_list($conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2,0,0, $this, 'invoive_supplier').$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
||||||
foreach($listoffiles as $fileentry)
|
foreach($listoffiles as $fileentry)
|
||||||
{
|
{
|
||||||
$dirsource=$fileentry['name'];
|
$dirsource=$fileentry['name'];
|
||||||
|
|||||||
@ -815,8 +815,8 @@ if (empty($reshook))
|
|||||||
$result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit;
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -926,143 +926,131 @@ if (empty($reshook))
|
|||||||
$result=$object->fetch_thirdparty();
|
$result=$object->fetch_thirdparty();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// $ref = dol_sanitizeFileName($object->ref);
|
if ($_POST['sendto'])
|
||||||
// $file = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref.'/'.$ref.'.pdf';
|
{
|
||||||
|
// Le destinataire a ete fourni via le champ libre
|
||||||
|
$sendto = $_POST['sendto'];
|
||||||
|
$sendtoid = 0;
|
||||||
|
}
|
||||||
|
elseif ($_POST['receiver'] != '-1')
|
||||||
|
{
|
||||||
|
// Recipient was provided from combo list
|
||||||
|
if ($_POST['receiver'] == 'thirdparty') // Id of third party
|
||||||
|
{
|
||||||
|
$sendto = $object->client->email;
|
||||||
|
$sendtoid = 0;
|
||||||
|
}
|
||||||
|
else // Id du contact
|
||||||
|
{
|
||||||
|
$sendto = $object->client->contact_get_property($_POST['receiver'],'email');
|
||||||
|
$sendtoid = $_POST['receiver'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if (is_readable($file))
|
if (dol_strlen($sendto))
|
||||||
// {
|
{
|
||||||
if ($_POST['sendto'])
|
$langs->load("commercial");
|
||||||
{
|
|
||||||
// Le destinataire a ete fourni via le champ libre
|
|
||||||
$sendto = $_POST['sendto'];
|
|
||||||
$sendtoid = 0;
|
|
||||||
}
|
|
||||||
elseif ($_POST['receiver'] != '-1')
|
|
||||||
{
|
|
||||||
// Recipient was provided from combo list
|
|
||||||
if ($_POST['receiver'] == 'thirdparty') // Id of third party
|
|
||||||
{
|
|
||||||
$sendto = $object->client->email;
|
|
||||||
$sendtoid = 0;
|
|
||||||
}
|
|
||||||
else // Id du contact
|
|
||||||
{
|
|
||||||
$sendto = $object->client->contact_get_property($_POST['receiver'],'email');
|
|
||||||
$sendtoid = $_POST['receiver'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dol_strlen($sendto))
|
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
||||||
{
|
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
|
||||||
$langs->load("commercial");
|
$message = $_POST['message'];
|
||||||
|
$sendtocc = $_POST['sendtocc'];
|
||||||
|
$deliveryreceipt = $_POST['deliveryreceipt'];
|
||||||
|
|
||||||
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
if ($action == 'send')
|
||||||
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
|
{
|
||||||
$message = $_POST['message'];
|
if (dol_strlen($_POST['subject'])) $subject=$_POST['subject'];
|
||||||
$sendtocc = $_POST['sendtocc'];
|
else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref;
|
||||||
$deliveryreceipt = $_POST['deliveryreceipt'];
|
$actiontypecode='AC_SUP_INV';
|
||||||
|
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
|
||||||
|
if ($message)
|
||||||
|
{
|
||||||
|
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
||||||
|
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||||
|
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||||
|
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||||
|
}
|
||||||
|
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'send')
|
// Create form object
|
||||||
{
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
if (dol_strlen($_POST['subject'])) $subject=$_POST['subject'];
|
$formmail = new FormMail($db);
|
||||||
else $subject = $langs->transnoentities('CustomerOrder').' '.$object->ref;
|
|
||||||
$actiontypecode='AC_SUP_INV';
|
|
||||||
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
|
|
||||||
if ($message)
|
|
||||||
{
|
|
||||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
|
||||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
|
||||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
|
||||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
|
||||||
}
|
|
||||||
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create form object
|
$attachedfiles=$formmail->get_attached_files();
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
$filepath = $attachedfiles['paths'];
|
||||||
$formmail = new FormMail($db);
|
$filename = $attachedfiles['names'];
|
||||||
|
$mimetype = $attachedfiles['mimes'];
|
||||||
|
|
||||||
$attachedfiles=$formmail->get_attached_files();
|
// Send mail
|
||||||
$filepath = $attachedfiles['paths'];
|
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$filename = $attachedfiles['names'];
|
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1);
|
||||||
$mimetype = $attachedfiles['mimes'];
|
if ($mailfile->error)
|
||||||
|
{
|
||||||
|
setEventMessage($mailfile->error,'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result=$mailfile->sendfile();
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
|
||||||
|
setEventMessage($mesg);
|
||||||
|
|
||||||
// Send mail
|
$error=0;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
|
||||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1);
|
|
||||||
if ($mailfile->error)
|
|
||||||
{
|
|
||||||
setEventMessage($mailfile->error,'errors');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$result=$mailfile->sendfile();
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
|
|
||||||
setEventMessage($mesg);
|
|
||||||
|
|
||||||
$error=0;
|
// Initialisation donnees
|
||||||
|
$object->sendtoid = $sendtoid;
|
||||||
|
$object->actiontypecode = $actiontypecode;
|
||||||
|
$object->actionmsg = $actionmsg;
|
||||||
|
$object->actionmsg2 = $actionmsg2;
|
||||||
|
$object->fk_element = $object->id;
|
||||||
|
$object->elementtype = $object->element;
|
||||||
|
|
||||||
// Initialisation donnees
|
// Appel des triggers
|
||||||
$object->sendtoid = $sendtoid;
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$object->actiontypecode = $actiontypecode;
|
$interface=new Interfaces($db);
|
||||||
$object->actionmsg = $actionmsg;
|
$result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||||
$object->actionmsg2 = $actionmsg2;
|
if ($result < 0) {
|
||||||
$object->fk_element = $object->id;
|
$error++; $object->errors=$interface->errors;
|
||||||
$object->elementtype = $object->element;
|
}
|
||||||
|
// Fin appel triggers
|
||||||
|
|
||||||
// Appel des triggers
|
if ($error)
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
{
|
||||||
$interface=new Interfaces($db);
|
dol_print_error($db);
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf);
|
}
|
||||||
if ($result < 0) {
|
else
|
||||||
$error++; $object->errors=$interface->errors;
|
{
|
||||||
}
|
// Redirect here
|
||||||
// Fin appel triggers
|
// This avoid sending mail twice if going out and then back to page
|
||||||
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("other");
|
||||||
|
if ($mailfile->error)
|
||||||
|
{
|
||||||
|
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
||||||
|
$mesg.='<br>'.$mailfile->error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
||||||
|
}
|
||||||
|
setEventMessage($mesg, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($error)
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
$langs->load("other");
|
||||||
}
|
setEventMessage($langs->trans('ErrorMailRecipientIsEmpty'), 'errors');
|
||||||
else
|
dol_syslog('Recipient email is empty');
|
||||||
{
|
}
|
||||||
// Redirect here
|
|
||||||
// This avoid sending mail twice if going out and then back to page
|
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("other");
|
|
||||||
if ($mailfile->error)
|
|
||||||
{
|
|
||||||
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
|
||||||
$mesg.='<br>'.$mailfile->error;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
|
||||||
}
|
|
||||||
setEventMessage($mesg, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("other");
|
|
||||||
setEventMessage($langs->trans('ErrorMailRecipientIsEmpty'), 'errors');
|
|
||||||
dol_syslog('Recipient email is empty');
|
|
||||||
}
|
|
||||||
/* }
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
|
||||||
dol_syslog('Failed to read file: '.$file);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1095,8 +1083,8 @@ if (empty($reshook))
|
|||||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit;
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make calculation according to calculationrule
|
// Make calculation according to calculationrule
|
||||||
@ -2405,8 +2393,8 @@ else
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$ref=dol_sanitizeFileName($object->ref);
|
$ref=dol_sanitizeFileName($object->ref);
|
||||||
$subdir = get_exdir($object->id,2).$ref;
|
$subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
||||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref;
|
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
||||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
|
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||||
$genallowed=$user->rights->fournisseur->facture->creer;
|
$genallowed=$user->rights->fournisseur->facture->creer;
|
||||||
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
||||||
@ -2512,7 +2500,7 @@ else
|
|||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/'));
|
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref, preg_quote($ref,'/'));
|
||||||
$file=$fileparams['fullname'];
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
@ -2539,7 +2527,7 @@ else
|
|||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/'));
|
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref, preg_quote($ref,'/'));
|
||||||
$file=$fileparams['fullname'];
|
$file=$fileparams['fullname'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ if ($object->fetch($id, $ref))
|
|||||||
{
|
{
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$ref=dol_sanitizeFileName($object->ref);
|
$ref=dol_sanitizeFileName($object->ref);
|
||||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref;
|
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -309,7 +309,7 @@ if ($resql)
|
|||||||
$facturestatic->ref_supplier=$obj->ref_supplier;
|
$facturestatic->ref_supplier=$obj->ref_supplier;
|
||||||
print $facturestatic->getNomUrl(1);
|
print $facturestatic->getNomUrl(1);
|
||||||
$filename=dol_sanitizeFileName($obj->ref);
|
$filename=dol_sanitizeFileName($obj->ref);
|
||||||
$filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2).dol_sanitizeFileName($object->ref?$obj->ref:$obj->facid);
|
$filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
|
||||||
print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir);
|
print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,7 @@ if ($id)
|
|||||||
$nbphoto=0;
|
$nbphoto=0;
|
||||||
$nbbyrow=5;
|
$nbbyrow=5;
|
||||||
|
|
||||||
$pdir = get_exdir($object->id,2) . $object->id ."/photos/";
|
$pdir = get_exdir($object->id,2,0,0,$object,'product') . $object->id ."/photos/";
|
||||||
$dir = $conf->product->multidir_output[$object->entity] . '/'. $pdir;
|
$dir = $conf->product->multidir_output[$object->entity] . '/'. $pdir;
|
||||||
|
|
||||||
print '<br><table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
print '<br><table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||||
|
|||||||
@ -19,6 +19,10 @@
|
|||||||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||||
|
|
||||||
|
|
||||||
|
UPDATE llx_facture_fourn set ref=rowid where ref IS NULL;
|
||||||
|
ALTER TABLE llx_facture_fourn MODIFY COLUMN ref varchar(255) NOT NULL;
|
||||||
|
|
||||||
|
|
||||||
-- IVORY COST (id country=21)
|
-- IVORY COST (id country=21)
|
||||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1);
|
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1);
|
||||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1);
|
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1);
|
||||||
@ -447,6 +451,7 @@ ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL after country;
|
|||||||
ALTER TABLE llx_don CHANGE COLUMN fk_paiement fk_payment integer;
|
ALTER TABLE llx_don CHANGE COLUMN fk_paiement fk_payment integer;
|
||||||
ALTER TABLE llx_don ADD COLUMN paid smallint default 0 NOT NULL after fk_payment;
|
ALTER TABLE llx_don ADD COLUMN paid smallint default 0 NOT NULL after fk_payment;
|
||||||
ALTER TABLE llx_don CHANGE COLUMN fk_don_projet fk_projet integer NULL;
|
ALTER TABLE llx_don CHANGE COLUMN fk_don_projet fk_projet integer NULL;
|
||||||
|
ALTER TABLE llx_don CHANGE COLUMN fk_project fk_projet integer NULL;
|
||||||
|
|
||||||
create table llx_don_extrafields
|
create table llx_don_extrafields
|
||||||
(
|
(
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
create table llx_facture_fourn
|
create table llx_facture_fourn
|
||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
ref varchar(255),
|
ref varchar(255) NOT NULL,
|
||||||
ref_supplier varchar(255) NOT NULL,
|
ref_supplier varchar(255) NOT NULL,
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
|
|
||||||
|
|||||||
@ -170,6 +170,7 @@ ErrorGlobalVariableUpdater4=SOAP client failed with error '%s'
|
|||||||
ErrorGlobalVariableUpdater5=No global variable selected
|
ErrorGlobalVariableUpdater5=No global variable selected
|
||||||
ErrorFieldMustBeANumeric=Field <b>%s</b> must be a numeric value
|
ErrorFieldMustBeANumeric=Field <b>%s</b> must be a numeric value
|
||||||
ErrorFieldMustBeAnInteger=Field <b>%s</b> must be an integer
|
ErrorFieldMustBeAnInteger=Field <b>%s</b> must be an integer
|
||||||
|
ErrorMandatoryParametersNotProvided=Mandatory parameter(s) not provided
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined
|
WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined
|
||||||
|
|||||||
@ -199,15 +199,12 @@ if ($action == 'builddoc') // En get ou en post
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
$ret=$object->fetch($id); // Reload to get new records
|
||||||
{
|
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
||||||
$ret=$object->fetch($id); // Reload to get new records
|
|
||||||
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
|
||||||
}
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit;
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -151,13 +151,16 @@ if (! empty($_SERVER["PHP_SELF"]))
|
|||||||
analyseVarsForSqlAndScriptsInjection($morevaltochecklikepost,2);
|
analyseVarsForSqlAndScriptsInjection($morevaltochecklikepost,2);
|
||||||
}
|
}
|
||||||
// Sanity check on GET parameters
|
// Sanity check on GET parameters
|
||||||
if (! empty($_SERVER["QUERY_STRING"]))
|
if (! defined('NOSCANGETFORINJECTION') && ! empty($_SERVER["QUERY_STRING"]))
|
||||||
{
|
{
|
||||||
$morevaltochecklikeget=array($_SERVER["QUERY_STRING"]);
|
$morevaltochecklikeget=array($_SERVER["QUERY_STRING"]);
|
||||||
analyseVarsForSqlAndScriptsInjection($morevaltochecklikeget,1);
|
analyseVarsForSqlAndScriptsInjection($morevaltochecklikeget,1);
|
||||||
}
|
}
|
||||||
// Sanity check on POST
|
// Sanity check on POST
|
||||||
analyseVarsForSqlAndScriptsInjection($_POST,0);
|
if (! defined('NOSCANPOSTFORINJECTION'))
|
||||||
|
{
|
||||||
|
analyseVarsForSqlAndScriptsInjection($_POST,0);
|
||||||
|
}
|
||||||
|
|
||||||
// This is to make Dolibarr working with Plesk
|
// This is to make Dolibarr working with Plesk
|
||||||
if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
|
if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
|
||||||
|
|||||||
@ -59,12 +59,6 @@ class Product extends CommonObject
|
|||||||
var $id ;
|
var $id ;
|
||||||
//! Ref
|
//! Ref
|
||||||
var $ref;
|
var $ref;
|
||||||
/**
|
|
||||||
* Product label
|
|
||||||
* @var string
|
|
||||||
* @deprecated use $label
|
|
||||||
*/
|
|
||||||
var $libelle;
|
|
||||||
/**
|
/**
|
||||||
* Product label
|
* Product label
|
||||||
* @var string
|
* @var string
|
||||||
@ -3389,7 +3383,7 @@ class Product extends CommonObject
|
|||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
$dir = $sdir;
|
$dir = $sdir;
|
||||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2) . $this->id ."/photos";
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos";
|
||||||
else $dir .= '/'.dol_sanitizeFileName($this->ref);
|
else $dir .= '/'.dol_sanitizeFileName($this->ref);
|
||||||
|
|
||||||
dol_mkdir($dir);
|
dol_mkdir($dir);
|
||||||
@ -3427,7 +3421,7 @@ class Product extends CommonObject
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$dir = $sdir;
|
$dir = $sdir;
|
||||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2) . $this->id ."/photos/";
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||||
else $dir .= '/'.dol_sanitizeFileName($this->ref).'/';
|
else $dir .= '/'.dol_sanitizeFileName($this->ref).'/';
|
||||||
|
|
||||||
$nbphoto=0;
|
$nbphoto=0;
|
||||||
@ -3474,8 +3468,8 @@ class Product extends CommonObject
|
|||||||
$pdir = '/';
|
$pdir = '/';
|
||||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||||
{
|
{
|
||||||
$dir .= get_exdir($this->id,2) . $this->id ."/photos/";
|
$dir .= get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||||
$pdir .= get_exdir($this->id,2) . $this->id ."/photos/";
|
$pdir .= get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -274,8 +274,8 @@ if (empty($reshook))
|
|||||||
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit;
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,19 +713,6 @@ else
|
|||||||
|
|
||||||
if ($action != "edit" )
|
if ($action != "edit" )
|
||||||
{
|
{
|
||||||
// Validate
|
|
||||||
if ($object->statut == 0 && $user->rights->projet->creer)
|
|
||||||
{
|
|
||||||
if ($userWrite > 0)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="card.php?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Validate').'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modify
|
// Modify
|
||||||
if ($object->statut != 2 && $user->rights->projet->creer)
|
if ($object->statut != 2 && $user->rights->projet->creer)
|
||||||
{
|
{
|
||||||
@ -739,8 +726,21 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
if ($object->statut == 0 && $user->rights->projet->creer)
|
||||||
|
{
|
||||||
|
if ($userWrite > 0)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="card.php?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Validate').'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close
|
// Close
|
||||||
if ($object->statut == 1 && $user->rights->projet->creer)
|
if (($object->statut == 0 || $object->statut == 1) && $user->rights->projet->creer)
|
||||||
{
|
{
|
||||||
if ($userWrite > 0)
|
if ($userWrite > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -434,8 +434,8 @@ foreach ($listofreferent as $key => $value)
|
|||||||
}
|
}
|
||||||
else if($element_doc === 'invoice_supplier') {
|
else if($element_doc === 'invoice_supplier') {
|
||||||
$element_doc='facture_fournisseur';
|
$element_doc='facture_fournisseur';
|
||||||
$filename = get_exdir($element->id,2).dol_sanitizeFileName($element->ref);
|
$filename = get_exdir($element->id,2,0,0,$this,'product').dol_sanitizeFileName($element->ref);
|
||||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($element->id,2).dol_sanitizeFileName($element->ref);
|
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($element->id,2,0,0,null,'invoice_supplier').dol_sanitizeFileName($element->ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
|
print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
|
||||||
|
|||||||
@ -162,8 +162,8 @@ if ($action == 'builddoc' && $user->rights->projet->creer)
|
|||||||
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit;
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$result = $object->fetch($id, $ref);
|
$result = $object->fetch($id, $ref);
|
||||||
|
|
||||||
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ;
|
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ;
|
||||||
$courrier_dir = $conf->societe->multidir_output[$object->entity] . "/courrier/" . get_exdir($object->id);
|
$courrier_dir = $conf->societe->multidir_output[$object->entity] . "/courrier/" . get_exdir($object->id,0,0,0,$object,'thirdparty');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -438,15 +438,15 @@ if ($action == 'update' && ! $_POST["cancel"])
|
|||||||
{
|
{
|
||||||
if (GETPOST('deletephoto') && $object->photo)
|
if (GETPOST('deletephoto') && $object->photo)
|
||||||
{
|
{
|
||||||
$fileimg=$conf->user->dir_output.'/'.get_exdir($object->id,2,0,1).'/logos/'.$object->photo;
|
$fileimg=$conf->user->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'user').'/logos/'.$object->photo;
|
||||||
$dirthumbs=$conf->user->dir_output.'/'.get_exdir($object->id,2,0,1).'/logos/thumbs';
|
$dirthumbs=$conf->user->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'user').'/logos/thumbs';
|
||||||
dol_delete_file($fileimg);
|
dol_delete_file($fileimg);
|
||||||
dol_delete_dir_recursive($dirthumbs);
|
dol_delete_dir_recursive($dirthumbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name']))
|
if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name']))
|
||||||
{
|
{
|
||||||
$dir= $conf->user->dir_output . '/' . get_exdir($object->id,2,0,1);
|
$dir= $conf->user->dir_output . '/' . get_exdir($object->id,2,0,1,$object,'user');
|
||||||
|
|
||||||
dol_mkdir($dir);
|
dol_mkdir($dir);
|
||||||
|
|
||||||
|
|||||||
@ -217,7 +217,7 @@ function getCategory($authentication,$id)
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output);
|
$dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output);
|
||||||
$pdir = get_exdir($categorie->id,2) . $categorie->id ."/photos/";
|
$pdir = get_exdir($categorie->id,2,0,0,$categorie,'category') . $categorie->id ."/photos/";
|
||||||
$dir = $dir . '/'. $pdir;
|
$dir = $dir . '/'. $pdir;
|
||||||
|
|
||||||
$cat = array(
|
$cat = array(
|
||||||
@ -238,7 +238,7 @@ function getCategory($authentication,$id)
|
|||||||
foreach($cats as $fille)
|
foreach($cats as $fille)
|
||||||
{
|
{
|
||||||
$dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output);
|
$dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output);
|
||||||
$pdir = get_exdir($fille->id,2) . $fille->id ."/photos/";
|
$pdir = get_exdir($fille->id,2,0,0,$categorie,'category') . $fille->id ."/photos/";
|
||||||
$dir = $dir . '/'. $pdir;
|
$dir = $dir . '/'. $pdir;
|
||||||
$cat['filles'][] = array(
|
$cat['filles'][] = array(
|
||||||
'id'=>$fille->id,
|
'id'=>$fille->id,
|
||||||
|
|||||||
@ -374,7 +374,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
|
|||||||
$product->load_stock();
|
$product->load_stock();
|
||||||
|
|
||||||
$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);
|
$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);
|
||||||
$pdir = get_exdir($product->id,2) . $product->id ."/photos/";
|
$pdir = get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos/";
|
||||||
$dir = $dir . '/'. $pdir;
|
$dir = $dir . '/'. $pdir;
|
||||||
|
|
||||||
if (! empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"];
|
if (! empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"];
|
||||||
@ -1055,7 +1055,7 @@ function getProductsForCategory($authentication,$id,$lang='')
|
|||||||
if($obj->status > 0 )
|
if($obj->status > 0 )
|
||||||
{
|
{
|
||||||
$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);
|
$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);
|
||||||
$pdir = get_exdir($obj->id,2) . $obj->id ."/photos/";
|
$pdir = get_exdir($obj->id,2,0,0,$product,'product') . $obj->id ."/photos/";
|
||||||
$dir = $dir . '/'. $pdir;
|
$dir = $dir . '/'. $pdir;
|
||||||
|
|
||||||
$products[] = array(
|
$products[] = array(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user