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))
|
||||
{
|
||||
// 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']);
|
||||
if ($file_OK)
|
||||
{
|
||||
if (GETPOST('deletephoto'))
|
||||
{
|
||||
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;
|
||||
$dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/thumbs';
|
||||
$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,$object,'member').'/photos/thumbs';
|
||||
dol_delete_file($fileimg);
|
||||
dol_delete_dir_recursive($dirthumbs);
|
||||
}
|
||||
|
||||
@ -60,7 +60,6 @@ if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir($id,2,0,1) . '/' . $id;
|
||||
$form = new Form($db);
|
||||
$object=new Adherent($db);
|
||||
$membert=new AdherentType($db);
|
||||
@ -70,6 +69,9 @@ if ($result < 0)
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'member') . '/' . dol_sanitizeFileName($object->ref);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
@ -439,6 +439,26 @@ print "\n";
|
||||
<div align="center"><input type="submit" class="button"
|
||||
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><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>
|
||||
|
||||
<?php
|
||||
|
||||
@ -70,6 +70,10 @@ if ($action == 'delete')
|
||||
* View
|
||||
*/
|
||||
|
||||
$_SESSION["commandbackuplastdone"]='';
|
||||
$_SESSION["commandbackuptorun"]='';
|
||||
$_SESSION["commandbackupresult"]='';
|
||||
|
||||
// Increase limit of time. Works only if we are not in safe mode
|
||||
$ExecTimeLimit=600;
|
||||
if (!empty($ExecTimeLimit))
|
||||
@ -354,21 +358,24 @@ if ($what == 'postgresql')
|
||||
if ($errormsg)
|
||||
{
|
||||
setEventMessage($langs->trans("Error")." : ".$errormsg, 'errors');
|
||||
/*
|
||||
print '<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
|
||||
print '<br>';
|
||||
print '<br>';*/
|
||||
|
||||
$resultstring='';
|
||||
$resultstring.='<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
|
||||
|
||||
$_SESSION["commandbackupresult"]=$resultstring;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($what)
|
||||
{
|
||||
setEventMessage($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"));
|
||||
/*print '<div class="ok">';
|
||||
print $langs->trans("BackupFileSuccessfullyCreated").'.<br>';
|
||||
print $langs->trans("YouCanDownloadBackupFile");
|
||||
print '</div>';
|
||||
print '<br>';*/
|
||||
|
||||
$resultstring='<div class="ok">';
|
||||
$resultstring.=$langs->trans("BackupFileSuccessfullyCreated").'.<br>';
|
||||
$resultstring.=$langs->trans("YouCanDownloadBackupFile");
|
||||
$resultstring.='<div>';
|
||||
|
||||
$_SESSION["commandbackupresult"]=$resultstring;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -24,6 +25,7 @@
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
@ -59,6 +61,32 @@ $search_user = GETPOST("search_user");
|
||||
$search_desc = GETPOST("search_desc");
|
||||
$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
|
||||
@ -124,6 +152,7 @@ $sql.= " u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."events as e";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
|
||||
$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_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; }
|
||||
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_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')
|
||||
{
|
||||
@ -168,7 +198,7 @@ if ($result)
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
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 '<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';
|
||||
|
||||
$dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/";
|
||||
$dir = $sdir .'/'. get_exdir($this->id,2,0,0,$this,'category') . $this->id ."/";
|
||||
$dir .= "photos/";
|
||||
|
||||
if (! file_exists($dir))
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* 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) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
@ -28,6 +28,7 @@
|
||||
require '../main.inc.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/functions2.lib.php';
|
||||
|
||||
$langs->load("categories");
|
||||
|
||||
@ -151,8 +152,7 @@ foreach($fulltree as $key => $val)
|
||||
'rowid'=>$val['rowid'],
|
||||
'fk_menu'=>$val['fk_parent'],
|
||||
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.$li.
|
||||
'</td><td width="50%">'.
|
||||
' '.$val['description'].'</td>'.
|
||||
'</td><td width="50%">'.dolGetFirstLineOfText($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>'.
|
||||
'</tr></table>'
|
||||
);
|
||||
@ -160,7 +160,7 @@ foreach($fulltree as $key => $val)
|
||||
|
||||
|
||||
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))
|
||||
{
|
||||
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;
|
||||
$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;
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -847,13 +847,10 @@ if (empty($reshook))
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $result);
|
||||
exit();
|
||||
} else {
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
||||
exit();
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1760,7 +1757,8 @@ if ($action == 'create')
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file)) {
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db, $result);
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ if (empty($reshook))
|
||||
}
|
||||
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)
|
||||
{
|
||||
@ -398,7 +398,7 @@ if (empty($reshook))
|
||||
{
|
||||
$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"];
|
||||
if (! $object->sendto)
|
||||
@ -495,7 +495,7 @@ if (empty($reshook))
|
||||
// Action update description of emailing
|
||||
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'));
|
||||
else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha'));
|
||||
@ -527,7 +527,7 @@ if (empty($reshook))
|
||||
*/
|
||||
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';
|
||||
|
||||
@ -540,7 +540,7 @@ if (empty($reshook))
|
||||
// Action remove file
|
||||
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';
|
||||
|
||||
@ -719,7 +719,7 @@ else
|
||||
{
|
||||
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);
|
||||
|
||||
|
||||
@ -1065,13 +1065,10 @@ if (empty($reshook))
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $result);
|
||||
exit();
|
||||
} else {
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
||||
exit();
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1091,10 +1091,10 @@ if (empty($reshook))
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $result);
|
||||
exit();
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1316,7 +1316,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
@ -1548,7 +1548,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Button "Create Draft"
|
||||
print '<div class="center"><input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '"></div>';
|
||||
|
||||
|
||||
@ -1743,8 +1743,8 @@ if (empty($reshook))
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db, $result);
|
||||
exit();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1970,7 +1970,7 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
@ -2475,7 +2475,7 @@ if ($action == 'create')
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Button "Create Draft"
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
|
||||
|
||||
@ -262,7 +262,7 @@ else if ($action == 'remove_file' && $user->rights->banque->cheque)
|
||||
|
||||
$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);
|
||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
|
||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
|
||||
@ -322,7 +322,7 @@ else
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("DeleteCheckReceipt"), $langs->trans("ConfirmDeleteCheckReceipt"), 'confirm_delete','','',1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -331,7 +331,7 @@ else
|
||||
if ($action == 'valide')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("ValidateCheckReceipt"), $langs->trans("ConfirmValidateCheckReceipt"), 'confirm_valide','','',1);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -704,7 +704,7 @@ if ($action != 'new')
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
$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;
|
||||
|
||||
$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
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $result);
|
||||
exit();
|
||||
} else {
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
||||
exit();
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ class FileUpload
|
||||
|
||||
$object_ref = dol_sanitizeFileName($object->ref);
|
||||
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') {
|
||||
$object_ref = $object->project->ref . '/' . $object_ref;
|
||||
}
|
||||
|
||||
@ -4806,19 +4806,19 @@ class Form
|
||||
else if ($modulepart=='userphoto')
|
||||
{
|
||||
$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
|
||||
$email=$object->email;
|
||||
}
|
||||
else if ($modulepart=='memberphoto')
|
||||
{
|
||||
$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
|
||||
$email=$object->email;
|
||||
}else {
|
||||
$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
|
||||
$email=$object->email;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
|
||||
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -265,7 +265,6 @@ class FormFile
|
||||
|
||||
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';
|
||||
|
||||
// For backward compatibility
|
||||
@ -579,11 +578,9 @@ class FormFile
|
||||
$var=!$var;
|
||||
|
||||
// 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...
|
||||
// Autre cas
|
||||
if ($modulepart == 'donation') { $relativepath = get_exdir($modulesubdir,2).$file["name"]; }
|
||||
if ($modulepart == 'export') { $relativepath = $file["name"]; }
|
||||
if ($modulepart == 'export') $relativepath = $file["name"]; // Other case
|
||||
|
||||
$out.= "<tr ".$bc[$var].">";
|
||||
|
||||
@ -701,14 +698,14 @@ class FormFile
|
||||
if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture...
|
||||
// Autre cas
|
||||
if ($modulepart == 'donation') {
|
||||
$relativepath = get_exdir($modulesubdir,2).$file["name"];
|
||||
$relativepath = get_exdir($modulesubdir,2,0,0,null,'donation').$file["name"];
|
||||
}
|
||||
if ($modulepart == 'export') {
|
||||
$relativepath = $file["name"];
|
||||
}
|
||||
if ($modulepart == 'facture_fournisseur') {
|
||||
$relativepath = get_exdir($modulesubdir, 2). $modulesubdir. "/" . $file["name"];
|
||||
}
|
||||
if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_fournisseur') {
|
||||
$relativepath = get_exdir($modulesubdir, 2,0,0,null,'invoice_supplier'). $modulesubdir. "/" . $file["name"];
|
||||
}
|
||||
|
||||
// Show file name with link to download
|
||||
$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))
|
||||
{
|
||||
$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 == 'member') $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,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_.';
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
*
|
||||
* @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 $entity Restrict onto entity
|
||||
* @param User $fuser User object (forced)
|
||||
@ -1817,7 +1817,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$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
|
||||
|
||||
@ -69,7 +69,7 @@ function facturefourn_prepare_head($object)
|
||||
}
|
||||
|
||||
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)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
|
||||
@ -1127,19 +1127,6 @@ function dol_getdate($timestamp,$fast=false)
|
||||
else
|
||||
{
|
||||
$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;
|
||||
@ -2886,14 +2873,14 @@ function print_fleche_navigation($page,$file,$options='',$nextpage=0,$betweenarr
|
||||
print '<div class="pagination"><ul>';
|
||||
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>';
|
||||
}
|
||||
//if ($betweenarrows) print ($page > 0?' ':'').$betweenarrows.($nextpage>0?' ':'');
|
||||
print $betweenarrows;
|
||||
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>';
|
||||
}
|
||||
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: 'ABC-1' with level 3 ->"0/0/1/", '015' with level 1->"5/"
|
||||
*
|
||||
* @param string $num Id to develop
|
||||
* @param int $level Level of development (1, 2 or 3 level)
|
||||
* @param string $num Id of object
|
||||
* @param int $level Level of subdirs to return (1, 2 or 3 levels)
|
||||
* @param int $alpha Use alpha ref
|
||||
* @param int $withoutslash 0=With slash at end, 1=without slash at end
|
||||
* @return string Dir to use
|
||||
* @param int $withoutslash 0=With slash at end, 1=without slash at end (except if '/', we return '')
|
||||
* @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 = '';
|
||||
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);
|
||||
if (empty($withoutslash)) $path.='/';
|
||||
|
||||
// TODO if object is null, load it from id and modulepart.
|
||||
|
||||
|
||||
if (! empty($level) && in_array($modulepart, array('cheque','user','category','shipment', 'member','don','donation','supplier_invoice','invoice_supplier')))
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -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 string $charset Give the charset used to encode the $text variable in memory.
|
||||
* @return int Number of lines
|
||||
* @see dol_nboflines
|
||||
* @see dol_nboflines, dolGetFirstLineOfText
|
||||
*/
|
||||
function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
|
||||
{
|
||||
|
||||
@ -29,6 +29,25 @@
|
||||
// Enable this line to trace path when function is called.
|
||||
//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.
|
||||
|
||||
@ -165,7 +165,7 @@ class pdf_aurore extends ModelePDFAskPriceSupplier
|
||||
$objphoto = new Product($this->db);
|
||||
$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;
|
||||
|
||||
$realpath='';
|
||||
@ -708,7 +708,7 @@ class pdf_aurore extends ModelePDFAskPriceSupplier
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
|
||||
|
||||
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
|
||||
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
|
||||
|
||||
@ -1266,7 +1266,7 @@ class pdf_aurore extends ModelePDFAskPriceSupplier
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("AskPriceSupplierDate")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R');
|
||||
*/
|
||||
|
||||
|
||||
if ($object->client->code_client)
|
||||
{
|
||||
$posy+=4;
|
||||
|
||||
@ -98,7 +98,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
|
||||
$outputlangs->load("products");
|
||||
$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))
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -105,7 +105,7 @@ class html_cerfafr extends ModeleDon
|
||||
else
|
||||
{
|
||||
$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";
|
||||
}
|
||||
|
||||
@ -168,18 +168,18 @@ class html_cerfafr extends ModeleDon
|
||||
$form = str_replace('__Message__',$outputlangs->trans("Message"),$form);
|
||||
$form = str_replace('__IConfirmDonationReception__',$outputlangs->trans("IConfirmDonationReception"),$form);
|
||||
$form = str_replace('__DonationMessage__',$conf->global->DONATION_MESSAGE,$form);
|
||||
|
||||
|
||||
$frencharticle='';
|
||||
if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencharticle='<font size="+1">Article 200, 238 bis et 885-0 V bis A du code général des impôts (CGI)</font>';
|
||||
$form = str_replace('__FrenchArticle__',$frencharticle,$form);
|
||||
|
||||
|
||||
$frencheligibility='';
|
||||
if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencheligibility='Le bénéficiaire certifie sur l\'honneur que les dons et versements qu\'il reçoit ouvrent droit à la réduction d\'impôt prévue à l\'article :';
|
||||
$form = str_replace('__FrenchEligibility__',$frencheligibility,$form);
|
||||
|
||||
|
||||
$art200='';
|
||||
if (preg_match('/fr/i',$outputlangs->defaultlang)) {
|
||||
if ($conf->global->DONATION_ART200 >= 1)
|
||||
if ($conf->global->DONATION_ART200 >= 1)
|
||||
{
|
||||
$art200='<input type="checkbox" checked>200 du CGI';
|
||||
}
|
||||
@ -192,7 +192,7 @@ class html_cerfafr extends ModeleDon
|
||||
|
||||
$art238='';
|
||||
if (preg_match('/fr/i',$outputlangs->defaultlang)) {
|
||||
if ($conf->global->DONATION_ART238 >= 1)
|
||||
if ($conf->global->DONATION_ART238 >= 1)
|
||||
{
|
||||
$art238='<input type="checkbox" checked>238 bis du CGI';
|
||||
}
|
||||
@ -202,10 +202,10 @@ class html_cerfafr extends ModeleDon
|
||||
}
|
||||
}
|
||||
$form = str_replace('__ARTICLE238__',$art238,$form);
|
||||
|
||||
|
||||
$art885='';
|
||||
if (preg_match('/fr/i',$outputlangs->defaultlang)) {
|
||||
if ($conf->global->DONATION_ART885 >= 1)
|
||||
if ($conf->global->DONATION_ART885 >= 1)
|
||||
{
|
||||
$art885='<input type="checkbox" checked>885-0 V bis du CGI';
|
||||
}
|
||||
@ -215,7 +215,7 @@ class html_cerfafr extends ModeleDon
|
||||
}
|
||||
}
|
||||
$form = str_replace('__ARTICLE885__',$art885,$form);
|
||||
|
||||
|
||||
// Save file on disk
|
||||
dol_syslog("html_cerfafr::write_file $file");
|
||||
$handle=fopen($file,"w");
|
||||
|
||||
@ -190,7 +190,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$objphoto = new Product($this->db);
|
||||
$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;
|
||||
|
||||
$realpath='';
|
||||
|
||||
@ -45,7 +45,7 @@ class pdf_standard extends CommonStickerGenerator
|
||||
function addSticker(&$pdf,$outputlangs,$param) {
|
||||
// use this method in future refactoring
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
|
||||
* - %LOGO% is replace with company logo
|
||||
@ -96,7 +96,7 @@ class pdf_standard extends CommonStickerGenerator
|
||||
$dir=$conf->adherent->dir_output;
|
||||
if (! empty($photo))
|
||||
{
|
||||
$file=get_exdir($idmember,2).'photos/'.$photo;
|
||||
$file=get_exdir($idmember,2,0,0,null,'member').'photos/'.$photo;
|
||||
$photo=$dir.'/'.$file;
|
||||
if (! is_readable($photo)) $photo='';
|
||||
}
|
||||
|
||||
@ -179,13 +179,13 @@ class pdf_azur extends ModelePDFPropales
|
||||
|
||||
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).'/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdir[0] = dol_sanitizeFileName($objphoto->ref).'/';
|
||||
$pdir[1] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
|
||||
$pdir[0] = dol_sanitizeFileName($objphoto->ref).'/'; // default
|
||||
$pdir[1] = get_exdir($objphoto->id,2,0,0,$objphoto,'product') . $objphoto->id ."/photos/"; // alternative
|
||||
}
|
||||
|
||||
$arephoto = false;
|
||||
@ -331,7 +331,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
|
||||
$tab_height = 130;
|
||||
$tab_height_newpage = 150;
|
||||
|
||||
|
||||
// Incoterm
|
||||
$height_incoterms = 0;
|
||||
if ($conf->incoterm->enabled)
|
||||
@ -345,11 +345,11 @@ class pdf_azur extends ModelePDFPropales
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_incoterms=$nexY-$tab_top;
|
||||
|
||||
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->SetDrawColor(192,192,192);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
|
||||
|
||||
|
||||
$tab_top = $nexY+6;
|
||||
$height_incoterms += 4;
|
||||
}
|
||||
@ -644,7 +644,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Customer signature area
|
||||
$posy=$this->_signature_area($pdf, $object, $posy, $outputlangs);
|
||||
|
||||
@ -653,33 +653,33 @@ class pdf_azur extends ModelePDFPropales
|
||||
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
|
||||
|
||||
//If propal merge product PDF is active
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/propalmergepdfproduct.class.php';
|
||||
|
||||
|
||||
$already_merged = array ();
|
||||
foreach ( $object->lines as $line ) {
|
||||
if (! empty($line->fk_product) && ! (in_array($line->fk_product, $already_merged))) {
|
||||
// Find the desire PDF
|
||||
$filetomerge = new Propalmergepdfproduct($this->db);
|
||||
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$filetomerge->fetch_by_product($line->fk_product, $outputlangs->defaultlang);
|
||||
} else {
|
||||
$filetomerge->fetch_by_product($line->fk_product);
|
||||
}
|
||||
|
||||
|
||||
$already_merged[] = $line->fk_product;
|
||||
|
||||
|
||||
$product = new Product($this->db);
|
||||
$product->fetch($line->fk_product);
|
||||
|
||||
|
||||
if ($product->entity!=$conf->entity) {
|
||||
$entity_product_file=$product->entity;
|
||||
} else {
|
||||
$entity_product_file=$conf->entity;
|
||||
}
|
||||
|
||||
|
||||
// If PDF is selected and file is not empty
|
||||
if (count($filetomerge->lines) > 0) {
|
||||
foreach ( $filetomerge->lines as $linefile ) {
|
||||
@ -688,9 +688,9 @@ class pdf_azur extends ModelePDFPropales
|
||||
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref);
|
||||
elseif (! empty($conf->service->enabled))
|
||||
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref);
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . ':: upload_dir=' . $filetomerge_dir, LOG_DEBUG);
|
||||
|
||||
|
||||
$infile = $filetomerge_dir . '/' . $linefile->file_name;
|
||||
if (is_file($infile)) {
|
||||
$pagecount = $pdf->setSourceFile($infile);
|
||||
@ -707,11 +707,11 @@ class pdf_azur extends ModelePDFPropales
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//exit;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file,'F');
|
||||
@ -1567,10 +1567,10 @@ class pdf_azur extends ModelePDFPropales
|
||||
$pdf->SetFillColor(255,255,255);
|
||||
$pdf->SetXY($posx, $tab_top + 0);
|
||||
$pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1);
|
||||
|
||||
|
||||
$pdf->SetXY($posx, $tab_top + $tab_hl);
|
||||
$pdf->MultiCell($largcol, $tab_hl*6, '', 1, 'R');
|
||||
|
||||
|
||||
return ($tab_hl*7);
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
{
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$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";
|
||||
if (! empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir . "/" . $objectref . ($objectrefsupplier?"_".$objectrefsupplier:"").".pdf";
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ if ($action == 'update')
|
||||
$object->fk_projet = GETPOST("fk_projet");
|
||||
$object->note_private= GETPOST("note_private");
|
||||
$object->note_public = GETPOST("note_public");
|
||||
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
if ($ret < 0) $error++;
|
||||
@ -163,7 +163,7 @@ if ($action == 'add')
|
||||
$object->note_public = GETPOST("note_public");
|
||||
$object->public = GETPOST("public");
|
||||
$object->fk_projet = GETPOST("fk_projet");
|
||||
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
if ($ret < 0) $error++;
|
||||
@ -173,6 +173,10 @@ if ($action == 'add')
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer)
|
||||
@ -232,7 +236,7 @@ if ($action == 'set_paid')
|
||||
if ($action == 'builddoc')
|
||||
{
|
||||
$object = new Don($db);
|
||||
$object->fetch($id);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
// Save last template used to generate document
|
||||
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
||||
@ -274,9 +278,9 @@ if ($action == 'create')
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$nbrows=11;
|
||||
@ -312,14 +316,14 @@ if ($action == 'create')
|
||||
print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.GETPOST("email").'" size="40"></td></tr>';
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
@ -337,9 +341,9 @@ if ($action == 'create')
|
||||
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
|
||||
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
|
||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||
$formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 0, 1, 1);
|
||||
print "</td></tr>\n";
|
||||
@ -352,11 +356,11 @@ if ($action == 'create')
|
||||
{
|
||||
print $object->showOptionals($extrafields,'edit',$parameters);
|
||||
}
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
|
||||
|
||||
print "</form>\n";
|
||||
@ -380,6 +384,7 @@ if (! empty($id) && $action == 'edit')
|
||||
dol_print_error($db); exit;
|
||||
}
|
||||
|
||||
$hselected='card';
|
||||
$head = donation_prepare_head($object);
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
||||
|
||||
@ -441,7 +446,7 @@ if (! empty($id) && $action == 'edit')
|
||||
print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40" value="'.$object->email.'"></td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
@ -458,7 +463,7 @@ if (! empty($id) && $action == 'edit')
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
||||
$formproject->select_projects(-1, $object->fk_projet,'fk_projet', 0, 1, 0, 1);
|
||||
@ -497,7 +502,7 @@ if (! empty($id) && $action != 'edit')
|
||||
$text=$langs->trans("ConfirmDeleteADonation");
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteADonation"),$text,"confirm_delete",'','',1);
|
||||
}
|
||||
|
||||
|
||||
$result=$object->fetch($id);
|
||||
if ($result < 0) {
|
||||
dol_print_error($db,$object->error); exit;
|
||||
@ -506,7 +511,9 @@ if (! empty($id) && $action != 'edit')
|
||||
if ($result < 0) {
|
||||
dol_print_error($db); exit;
|
||||
}
|
||||
|
||||
|
||||
$hselected='card';
|
||||
|
||||
$head = donation_prepare_head($object);
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
||||
|
||||
@ -542,7 +549,7 @@ if (! empty($id) && $action != 'edit')
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>'.dol_nl2br($object->address).'</td>';
|
||||
|
||||
|
||||
$rowspan=6;
|
||||
if (! empty($conf->projet->enabled)) $rowspan++;
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
@ -584,7 +591,7 @@ if (! empty($id) && $action != 'edit')
|
||||
print "<tr ".$bc[$var]."><td>";
|
||||
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->paiement_type;
|
||||
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->paiement_type;
|
||||
print "<td>".$labeltype.' '.$object->num_paiement."</td>\n";
|
||||
print '<td align="right">'.price($objp->amount)."</td><td> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
||||
print "</tr>";
|
||||
@ -628,7 +635,7 @@ if (! empty($id) && $action != 'edit')
|
||||
else
|
||||
{
|
||||
print $object->country_olddata;
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// EMail
|
||||
@ -683,12 +690,12 @@ if (! empty($id) && $action != 'edit')
|
||||
}
|
||||
|
||||
// Create payment
|
||||
if ($object->statut == 1 && $object->paid == 0 && $user->rights->don->creer)
|
||||
if ($object->statut == 1 && $object->paid == 0 && $user->rights->don->creer)
|
||||
{
|
||||
if ($remaintopay == 0)
|
||||
if ($remaintopay == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/payment/payment.php?rowid=' . $object->id . '&action=create">' . $langs->trans('DoPayment') . '</a></div>';
|
||||
@ -700,7 +707,7 @@ if (! empty($id) && $action != 'edit')
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
|
||||
}
|
||||
|
||||
|
||||
// Delete
|
||||
if ($user->rights->don->supprimer)
|
||||
{
|
||||
@ -720,7 +727,7 @@ if (! empty($id) && $action != 'edit')
|
||||
* Documents generes
|
||||
*/
|
||||
$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;
|
||||
// $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer);
|
||||
// $delallowed=$user->rights->facture->supprimer;
|
||||
@ -730,7 +737,7 @@ if (! empty($id) && $action != 'edit')
|
||||
$var=true;
|
||||
|
||||
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>';
|
||||
|
||||
|
||||
@ -60,9 +60,10 @@ class Don extends CommonObject
|
||||
var $note_private;
|
||||
var $note_public;
|
||||
var $statut;
|
||||
|
||||
var $modelpdf;
|
||||
var $projet;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -306,14 +307,14 @@ class Don extends CommonObject
|
||||
* @return int <0 if KO, id of created donation if OK
|
||||
* TODO add numbering module for Ref
|
||||
*/
|
||||
function create($user, $notrigger)
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
|
||||
$error = 0;
|
||||
$ret = 0;
|
||||
$now=dol_now();
|
||||
|
||||
|
||||
// Clean parameters
|
||||
$this->address=($this->address>0?$this->address:$this->address);
|
||||
$this->zip=($this->zip>0?$this->zip:$this->zip);
|
||||
@ -391,7 +392,7 @@ class Don extends CommonObject
|
||||
$this->errno = $this->db->lasterrno();
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
// Update extrafield
|
||||
if (!$error) {
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
@ -403,7 +404,7 @@ class Don extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$error && !empty($conf->global->MAIN_DISABLEDRAFTSTATUS))
|
||||
{
|
||||
$res = $this->setValid($user);
|
||||
@ -434,7 +435,7 @@ class Don extends CommonObject
|
||||
global $langs, $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
// Clean parameters
|
||||
$this->address=($this->address>0?$this->address:$this->address);
|
||||
$this->zip=($this->zip>0?$this->zip:$this->zip);
|
||||
@ -523,11 +524,11 @@ class Don extends CommonObject
|
||||
{
|
||||
global $conf, $langs;
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Delete donation
|
||||
if (! $error)
|
||||
{
|
||||
@ -601,7 +602,7 @@ class Don extends CommonObject
|
||||
$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.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.= " c.code as country_code, c.label as country";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
@ -651,12 +652,13 @@ class Don extends CommonObject
|
||||
$this->public = $obj->public;
|
||||
$this->modepaymentid = $obj->fk_payment;
|
||||
$this->modepayment = $obj->libelle;
|
||||
$this->paid = $obj->paid;
|
||||
$this->paid = $obj->paid;
|
||||
$this->amount = $obj->amount;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->commentaire = $obj->note; // deprecated
|
||||
|
||||
|
||||
// Retrieve all extrafield for thirdparty
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
@ -821,7 +823,7 @@ class Don extends CommonObject
|
||||
if ($withpicto != 2) $result.=$link.$this->id.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
|
||||
@ -409,8 +409,8 @@ if (empty($reshook))
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ if ($action == 'create')
|
||||
$liste = ModelePdfExpedition::liste_modeles($db);
|
||||
print $form->selectarray('model', $liste, $conf->global->EXPEDITION_ADDON_PDF);
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -497,7 +497,7 @@ class Expedition extends CommonObject
|
||||
|
||||
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;
|
||||
|
||||
// Tracking url
|
||||
|
||||
@ -1030,13 +1030,8 @@ if ($action == 'builddoc') // GET or POST
|
||||
$result=expensereport_pdf_create($db, $depl, '', $depl->modelpdf, $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$depl->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
|
||||
exit;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2066,7 +2066,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql.= ",total_localtax2='".price2num($total_localtax2)."'";
|
||||
$sql.= ",total_ttc='".price2num($total_ttc)."'";
|
||||
$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;
|
||||
|
||||
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';
|
||||
|
||||
$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";
|
||||
if (file_exists($file))
|
||||
{
|
||||
@ -975,8 +975,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
|
||||
$dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$oldref;
|
||||
$dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$newref;
|
||||
$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,0,0, $this, 'invoive_supplier').$newref;
|
||||
if (file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||
@ -985,7 +985,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
{
|
||||
dol_syslog("Rename ok");
|
||||
// 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)
|
||||
{
|
||||
$dirsource=$fileentry['name'];
|
||||
|
||||
@ -815,8 +815,8 @@ if (empty($reshook))
|
||||
$result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1479,7 +1479,7 @@ if ($action=='create')
|
||||
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
@ -1603,7 +1603,7 @@ if ($action=='create')
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></div>';
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
@ -926,143 +926,131 @@ if (empty($reshook))
|
||||
$result=$object->fetch_thirdparty();
|
||||
if ($result > 0)
|
||||
{
|
||||
// $ref = dol_sanitizeFileName($object->ref);
|
||||
// $file = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref.'/'.$ref.'.pdf';
|
||||
if ($_POST['sendto'])
|
||||
{
|
||||
// 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 ($_POST['sendto'])
|
||||
{
|
||||
// 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))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
||||
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
|
||||
$message = $_POST['message'];
|
||||
$sendtocc = $_POST['sendtocc'];
|
||||
$deliveryreceipt = $_POST['deliveryreceipt'];
|
||||
|
||||
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
||||
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
|
||||
$message = $_POST['message'];
|
||||
$sendtocc = $_POST['sendtocc'];
|
||||
$deliveryreceipt = $_POST['deliveryreceipt'];
|
||||
if ($action == 'send')
|
||||
{
|
||||
if (dol_strlen($_POST['subject'])) $subject=$_POST['subject'];
|
||||
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);
|
||||
}
|
||||
|
||||
if ($action == 'send')
|
||||
{
|
||||
if (dol_strlen($_POST['subject'])) $subject=$_POST['subject'];
|
||||
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
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$attachedfiles=$formmail->get_attached_files();
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
$attachedfiles=$formmail->get_attached_files();
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
// Send mail
|
||||
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);
|
||||
|
||||
// Send mail
|
||||
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;
|
||||
|
||||
$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
|
||||
$object->sendtoid = $sendtoid;
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg;
|
||||
$object->actionmsg2 = $actionmsg2;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $object->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('BILL_SUPPLIER_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $object->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
if ($error)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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
|
||||
{
|
||||
$langs->load("other");
|
||||
setEventMessage($langs->trans('ErrorMailRecipientIsEmpty'), 'errors');
|
||||
dol_syslog('Recipient email is empty');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1095,8 +1083,8 @@ if (empty($reshook))
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
// Make calculation according to calculationrule
|
||||
@ -1319,7 +1307,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@ -1575,7 +1563,7 @@ if ($action == 'create')
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></div>';
|
||||
|
||||
print "</form>\n";
|
||||
@ -2405,8 +2393,8 @@ else
|
||||
*/
|
||||
|
||||
$ref=dol_sanitizeFileName($object->ref);
|
||||
$subdir = get_exdir($object->id,2).$ref;
|
||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.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,0,0,$object,'invoice_supplier').$ref;
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$genallowed=$user->rights->fournisseur->facture->creer;
|
||||
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
||||
@ -2512,7 +2500,7 @@ else
|
||||
{
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
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'];
|
||||
|
||||
// Define output language
|
||||
@ -2539,7 +2527,7 @@ else
|
||||
dol_print_error($db,$result);
|
||||
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'];
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ if ($object->fetch($id, $ref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Abbes Bahfir <bafbes@gmail.com>
|
||||
|
||||
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -309,7 +309,7 @@ if ($resql)
|
||||
$facturestatic->ref_supplier=$obj->ref_supplier;
|
||||
print $facturestatic->getNomUrl(1);
|
||||
$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 "</td>\n";
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ if ($id)
|
||||
$nbphoto=0;
|
||||
$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;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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)
|
||||
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);
|
||||
@ -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 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_project fk_projet integer NULL;
|
||||
|
||||
create table llx_don_extrafields
|
||||
(
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
create table llx_facture_fourn
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
ref varchar(255),
|
||||
ref varchar(255) NOT NULL,
|
||||
ref_supplier varchar(255) NOT NULL,
|
||||
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
|
||||
ErrorFieldMustBeANumeric=Field <b>%s</b> must be a numeric value
|
||||
ErrorFieldMustBeAnInteger=Field <b>%s</b> must be an integer
|
||||
ErrorMandatoryParametersNotProvided=Mandatory parameter(s) not provided
|
||||
|
||||
# Warnings
|
||||
WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined
|
||||
|
||||
@ -82,7 +82,7 @@ if ($action == 'add')
|
||||
$object->note = $_POST["note"];
|
||||
$object->commande_id = $_POST["commande_id"];
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
|
||||
|
||||
if (!$conf->expedition_bon->enabled && ! empty($conf->stock->enabled))
|
||||
{
|
||||
$expedition->entrepot_id = $_POST["entrepot_id"];
|
||||
@ -199,15 +199,12 @@ if ($action == 'builddoc') // En get ou en post
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$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)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -589,7 +586,7 @@ else
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
@ -603,7 +600,7 @@ else
|
||||
{
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
}
|
||||
|
||||
@ -151,13 +151,16 @@ if (! empty($_SERVER["PHP_SELF"]))
|
||||
analyseVarsForSqlAndScriptsInjection($morevaltochecklikepost,2);
|
||||
}
|
||||
// Sanity check on GET parameters
|
||||
if (! empty($_SERVER["QUERY_STRING"]))
|
||||
if (! defined('NOSCANGETFORINJECTION') && ! empty($_SERVER["QUERY_STRING"]))
|
||||
{
|
||||
$morevaltochecklikeget=array($_SERVER["QUERY_STRING"]);
|
||||
analyseVarsForSqlAndScriptsInjection($morevaltochecklikeget,1);
|
||||
}
|
||||
// Sanity check on POST
|
||||
analyseVarsForSqlAndScriptsInjection($_POST,0);
|
||||
if (! defined('NOSCANPOSTFORINJECTION'))
|
||||
{
|
||||
analyseVarsForSqlAndScriptsInjection($_POST,0);
|
||||
}
|
||||
|
||||
// This is to make Dolibarr working with Plesk
|
||||
if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
|
||||
|
||||
@ -59,12 +59,6 @@ class Product extends CommonObject
|
||||
var $id ;
|
||||
//! Ref
|
||||
var $ref;
|
||||
/**
|
||||
* Product label
|
||||
* @var string
|
||||
* @deprecated use $label
|
||||
*/
|
||||
var $libelle;
|
||||
/**
|
||||
* Product label
|
||||
* @var string
|
||||
@ -3389,7 +3383,7 @@ class Product extends CommonObject
|
||||
$result = 0;
|
||||
|
||||
$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);
|
||||
|
||||
dol_mkdir($dir);
|
||||
@ -3427,7 +3421,7 @@ class Product extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$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).'/';
|
||||
|
||||
$nbphoto=0;
|
||||
@ -3474,8 +3468,8 @@ class Product extends CommonObject
|
||||
$pdir = '/';
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
$dir .= get_exdir($this->id,2) . $this->id ."/photos/";
|
||||
$pdir .= 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,0,0,$this,'product') . $this->id ."/photos/";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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>
|
||||
*
|
||||
* 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);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -713,19 +713,6 @@ else
|
||||
|
||||
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
|
||||
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
|
||||
if ($object->statut == 1 && $user->rights->projet->creer)
|
||||
if (($object->statut == 0 || $object->statut == 1) && $user->rights->projet->creer)
|
||||
{
|
||||
if ($userWrite > 0)
|
||||
{
|
||||
|
||||
@ -434,8 +434,8 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
else if($element_doc === 'invoice_supplier') {
|
||||
$element_doc='facture_fournisseur';
|
||||
$filename = get_exdir($element->id,2).dol_sanitizeFileName($element->ref);
|
||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.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,0,0,null,'invoice_supplier').dol_sanitizeFileName($element->ref);
|
||||
}
|
||||
|
||||
print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
|
||||
|
||||
@ -162,8 +162,8 @@ if ($action == 'builddoc' && $user->rights->projet->creer)
|
||||
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
$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)
|
||||
{
|
||||
$fileimg=$conf->user->dir_output.'/'.get_exdir($object->id,2,0,1).'/logos/'.$object->photo;
|
||||
$dirthumbs=$conf->user->dir_output.'/'.get_exdir($object->id,2,0,1).'/logos/thumbs';
|
||||
$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,$object,'user').'/logos/thumbs';
|
||||
dol_delete_file($fileimg);
|
||||
dol_delete_dir_recursive($dirthumbs);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ $server->wsdl->addComplexType(
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* An image
|
||||
*/
|
||||
@ -217,7 +217,7 @@ function getCategory($authentication,$id)
|
||||
if ($result > 0)
|
||||
{
|
||||
$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;
|
||||
|
||||
$cat = array(
|
||||
@ -238,7 +238,7 @@ function getCategory($authentication,$id)
|
||||
foreach($cats as $fille)
|
||||
{
|
||||
$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;
|
||||
$cat['filles'][] = array(
|
||||
'id'=>$fille->id,
|
||||
|
||||
@ -374,7 +374,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
|
||||
$product->load_stock();
|
||||
|
||||
$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;
|
||||
|
||||
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 )
|
||||
{
|
||||
$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;
|
||||
|
||||
$products[] = array(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user