Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2015-05-21 01:33:16 +02:00
commit e075fce5eb
75 changed files with 1169 additions and 553 deletions

View 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

View File

@ -0,0 +1,2 @@
Alias /dolibarr_dev /var/www/dolibarr

View File

@ -0,0 +1,2 @@
[webservers]
testserver ansible_ssh_host=127.0.0.1 ansible_ssh_port=22

View 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>

View File

@ -1,6 +1,6 @@
<?PHP
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
@ -128,7 +128,6 @@ else if ($action == 'delete')
/*
* View
*
*/
llxheader('', $langs->trans('AccountAccounting'));
@ -142,7 +141,9 @@ if ($action == 'create')
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
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%">';
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
@ -163,8 +164,10 @@ if ($action == 'create')
print '</td></tr>';
print '</table>';
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
@ -216,16 +219,16 @@ else if ($id)
print '</td></tr>';
print '</table>';
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">';
print '</div>';
print '</form>';
print '</div>';
}
else
{
@ -268,8 +271,8 @@ else if ($id)
print '</td></tr>';
print '</table>';
print '</div>';
dol_fiche_end();
/*
* Barre d'actions
@ -297,6 +300,6 @@ else if ($id)
dol_print_error($db);
}
}
$db->close();
llxFooter();
$db->close();
llxFooter();

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2014-2015 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
@ -176,6 +176,8 @@ if ($action == 'create')
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%">';
// Label
@ -199,8 +201,10 @@ if ($action == 'create')
print '</td></tr>';
print '</table>';
dol_fiche_end();
print '<br><div class="center">';
print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 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
@ -45,6 +46,7 @@ $langs->load("users");
$langs->load('other');
$action=GETPOST('action','alpha');
$cancel=GETPOST('cancel');
$backtopage=GETPOST('backtopage','alpha');
$confirm=GETPOST('confirm','alpha');
$rowid=GETPOST('rowid','int');
@ -113,7 +115,8 @@ $hookmanager->initHooks(array('membercard','globalcard'));
/*
* Actions
*/
*/
if ($cancel) $action='';
$parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -236,7 +239,7 @@ if (empty($reshook))
}
}
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
if ($action == 'update' && $cancel='' && $user->rights->adherent->creer)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -322,15 +325,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);
}
@ -725,7 +728,7 @@ else
{
/* ************************************************************************** */
/* */
/* Creation card */
/* Creation mode */
/* */
/* ************************************************************************** */
$object->canvas=$canvas;
@ -779,7 +782,10 @@ else
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%">';
print '<tbody>';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
@ -868,13 +874,13 @@ else
print '</td></tr>';
}
// Tel pro
// Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOST('phone','alpha')?GETPOST('phone','alpha'):$object->phone).'"></td></tr>';
// Tel perso
// Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOST('phone_perso','alpha')?GETPOST('phone_perso','alpha'):$object->phone_perso).'"></td></tr>';
// Tel mobile
// Mobile phone
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile','alpha')?GETPOST('phone_mobile','alpha'):$object->phone_mobile).'"></td></tr>';
// Skype
@ -888,7 +894,7 @@ else
$form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n";
// Profil public
// Public profil
print "<tr><td>".$langs->trans("Public")."</td><td>\n";
print $form->selectyesno("public",$object->public,1);
print "</td></tr>\n";
@ -915,21 +921,25 @@ else
print $form->select_dolusers($object->user_id,'userid',1);
print '</td></tr>';
*/
print '<tbody>';
print "</table>\n";
print '<br>';
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("AddMember").'"></div>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("AddMember").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
print '</div>';
print "</form>\n";
}
if ($action == 'edit')
{
/********************************************
*
* Fiche en mode edition
*
* Edition mode
*
********************************************/
@ -1027,6 +1037,7 @@ else
print '<tr><td><span class="fieldrequired">'.$langs->trans("Nature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print "</td>";
// Photo
print '<td align="center" class="hideonsmartphone" valign="middle" width="25%" rowspan="'.$rowspan.'">';
print $form->showphoto('memberphoto',$object)."\n";
@ -1107,13 +1118,13 @@ else
print '</td></tr>';
}
// Tel
// Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?$_POST["phone"]:$object->phone).'"></td></tr>';
// Tel perso
// Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$object->phone_perso).'"></td></tr>';
// Tel mobile
// Mobile phone
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$object->phone_mobile).'"></td></tr>';
// Skype
@ -1127,7 +1138,7 @@ else
$form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n";
// Profil public
// Public profil
print "<tr><td>".$langs->trans("Public")."</td><td>\n";
print $form->selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1);
print "</td></tr>\n";
@ -1171,7 +1182,7 @@ else
print '<br><div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
print '</div>';
print '</form>';
@ -1183,7 +1194,7 @@ else
{
/* ************************************************************************** */
/* */
/* Mode affichage */
/* View mode */
/* */
/* ************************************************************************** */
@ -1204,8 +1215,8 @@ else
/*
* Affichage onglets
*/
* Show tabs
*/
$head = member_prepare_head($object);
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
@ -1296,7 +1307,7 @@ else
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
}
// Confirm resiliate
// Confirm terminate
if ($action == 'resign')
{
$langs->load("mails");
@ -1536,9 +1547,8 @@ else
/*
* Barre d'actions
*
*/
* Hotbar
*/
print '<div class="tabsAction">';
if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty')
@ -1553,7 +1563,7 @@ else
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</font></div>';
}
// Valider
// Validate
if ($object->statut == -1)
{
if ($user->rights->adherent->creer)
@ -1566,7 +1576,7 @@ else
}
}
// Reactiver
// Reactivate
if ($object->statut == 0)
{
if ($user->rights->adherent->creer)
@ -1597,7 +1607,7 @@ else
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
}
// Resilier
// Terminate
if ($object->statut >= 1)
{
if ($user->rights->adherent->supprimer)

View File

@ -3,6 +3,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 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
@ -707,7 +708,7 @@ if ($rowid > 0)
/*
* Barre d'actions
* Hotbar
*/
// Lien nouvelle cotisation si non brouillon et non resilie
@ -908,9 +909,13 @@ if ($rowid > 0)
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">';
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->societe).'">';
print "<table class=\"border\" width=\"100%\">\n";
$today=dol_now();
dol_fiche_head('');
print "<table class=\"border\" width=\"100%\">\n";
print '<tbody>';
$today=dol_now();
$datefrom=0;
$dateto=0;
$paymentdate=-1;
@ -1102,8 +1107,10 @@ if ($rowid > 0)
print $form->textwithpicto($tmp,$helpcontent,1,'help');
}
print '</td></tr>';
print '</tbody>';
print '</table>';
print '<br>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">';

View File

@ -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
*/

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 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
@ -26,6 +27,7 @@
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -59,7 +61,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
if (GETPOST('button_removefilter'))
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_lastname="";
$search_login="";
@ -79,21 +81,21 @@ if ($action == 'add' && $user->rights->adherent->configurer)
{
if ($_POST["button"] != $langs->trans("Cancel"))
{
$adht = new AdherentType($db);
$object = new AdherentType($db);
$adht->libelle = trim($_POST["libelle"]);
$adht->cotisation = trim($_POST["cotisation"]);
$adht->note = trim($_POST["comment"]);
$adht->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]);
$object->libelle = trim($_POST["libelle"]);
$object->cotisation = trim($_POST["cotisation"]);
$object->note = trim($_POST["comment"]);
$object->mail_valid = trim($_POST["mail_valid"]);
$object->vote = trim($_POST["vote"]);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
if ($adht->libelle)
if ($object->libelle)
{
$id=$adht->create($user);
$id=$object->create($user);
if ($id > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
@ -101,7 +103,7 @@ if ($action == 'add' && $user->rights->adherent->configurer)
}
else
{
$mesg=$adht->error;
$mesg=$object->error;
$action = 'create';
}
}
@ -117,19 +119,19 @@ if ($action == 'update' && $user->rights->adherent->configurer)
{
if ($_POST["button"] != $langs->trans("Cancel"))
{
$adht = new AdherentType($db);
$adht->id = $_POST["rowid"];
$adht->libelle = trim($_POST["libelle"]);
$adht->cotisation = trim($_POST["cotisation"]);
$adht->note = trim($_POST["comment"]);
$adht->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]);
$object = new AdherentType($db);
$object->id = $_POST["rowid"];
$object->libelle = trim($_POST["libelle"]);
$object->cotisation = trim($_POST["cotisation"]);
$object->note = trim($_POST["comment"]);
$object->mail_valid = trim($_POST["mail_valid"]);
$object->vote = trim($_POST["vote"]);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
$adht->update($user);
$object->update($user);
header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$_POST["rowid"]);
exit;
@ -138,8 +140,8 @@ if ($action == 'update' && $user->rights->adherent->configurer)
if ($action == 'delete' && $user->rights->adherent->configurer)
{
$adht = new AdherentType($db);
$adht->delete($rowid);
$object = new AdherentType($db);
$object->delete($rowid);
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
@ -161,8 +163,7 @@ llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_
$form=new Form($db);
// Liste of members type
// List of members type
if (! $rowid && $action != 'create' && $action != 'edit')
{
@ -212,8 +213,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
/*
* Barre d'actions
*
* Hotbar
*/
print '<div class="tabsAction">';
@ -230,19 +230,23 @@ if (! $rowid && $action != 'create' && $action != 'edit')
/* ************************************************************************** */
/* */
/* Creation d'un type adherent */
/* Creation mode */
/* */
/* ************************************************************************** */
if ($action == 'create')
{
$adht = new AdherentType($db);
$object = new AdherentType($db);
print_fiche_titre($langs->trans("NewMemberType"));
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
dol_fiche_head('');
print '<table class="border" width="100%">';
print '<tbody>';
print '<input type="hidden" name="action" value="add">';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
@ -260,7 +264,7 @@ if ($action == 'create')
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('mail_valid',$adht->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
$doleditor->Create();
print '</td></tr>';
@ -269,11 +273,14 @@ if ($action == 'create')
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $adht->showOptionals($extrafields,'edit');
print $object->showOptionals($extrafields,'edit');
}
print '<tbody>';
print "</table>\n";
dol_fiche_end();
print '<br><div class="center">';
print '<div class="center">';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Add").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'">';
@ -284,27 +291,21 @@ if ($action == 'create')
/* ************************************************************************** */
/* */
/* Edition de la fiche */
/* View mode */
/* */
/* ************************************************************************** */
if ($rowid > 0)
{
if ($action != 'edit')
{
$adht = new AdherentType($db);
$adht->fetch($rowid);
$adht->fetch_optionals($rowid,$extralabels);
$object = new AdherentType($db);
$object->fetch($rowid);
$object->fetch_optionals($rowid,$extralabels);
$h=0;
$head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
$head = member_type_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>';
@ -312,25 +313,25 @@ if ($rowid > 0)
// Ref
print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
print '<td>';
print $form->showrefnav($adht, 'rowid', $linkback);
print $form->showrefnav($object, 'rowid', $linkback);
print '</td></tr>';
// Label
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>';
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$object->libelle.'</td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print yn($adht->cotisation);
print yn($object->cotisation);
print '</tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print yn($adht->vote);
print yn($object->vote);
print '</tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print nl2br($adht->note)."</td></tr>";
print nl2br($object->note)."</td></tr>";
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
print nl2br($adht->mail_valid)."</td></tr>";
print nl2br($object->mail_valid)."</td></tr>";
// Other attributes
$parameters=array();
@ -338,31 +339,30 @@ if ($rowid > 0)
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
// View extrafields
print $adht->showOptionals($extrafields);
print $object->showOptionals($extrafields);
}
print '</table>';
print '</div>';
/*
* Barre d'actions
*
* Hotbar
*/
print '<div class="tabsAction">';
// Edit
if ($user->rights->adherent->configurer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$adht->id.'">'.$langs->trans("Modify").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
}
// Add
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$adht->id.'">'.$langs->trans("AddMember").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'">'.$langs->trans("AddMember").'</a></div>';
// Delete
if ($user->rights->adherent->configurer)
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$adht->id.'">'.$langs->trans("DeleteType").'</a></div>';
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
}
print "</div>";
@ -381,7 +381,7 @@ if ($rowid > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_adherent_type = t.rowid ";
$sql.= " AND d.entity IN (".getEntity().")";
$sql.= " AND t.rowid = ".$adht->id;
$sql.= " AND t.rowid = ".$object->id;
if ($sall)
{
$sql.= " AND (d.firstname LIKE '%".$sall."%' OR d.lastname LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'";
@ -479,7 +479,7 @@ if ($rowid > 0)
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
@ -619,19 +619,20 @@ if ($rowid > 0)
}
/* ************************************************************************** */
/* */
/* Edition mode */
/* */
/* ************************************************************************** */
if ($action == 'edit')
{
$adht = new AdherentType($db);
$adht->id = $rowid;
$adht->fetch($rowid);
$adht->fetch_optionals($rowid,$extralabels);
$object = new AdherentType($db);
$object->id = $rowid;
$object->fetch($rowid);
$object->fetch_optionals($rowid,$extralabels);
$h=0;
$head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
$head = member_type_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
@ -641,24 +642,24 @@ if ($rowid > 0)
print '<input type="hidden" name="action" value="update">';
print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>';
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$object->libelle.'"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("cotisation",$adht->cotisation,1);
print $form->selectyesno("cotisation",$object->cotisation,1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote",$adht->vote,1);
print $form->selectyesno("vote",$object->vote,1);
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print '<textarea name="comment" wrap="soft" cols="90" rows="3">'.$adht->note.'</textarea></td></tr>';
print '<textarea name="comment" wrap="soft" cols="90" rows="3">'.$object->note.'</textarea></td></tr>';
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('mail_valid',$adht->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
$doleditor->Create();
print "</td></tr>";
@ -668,13 +669,13 @@ if ($rowid > 0)
print '</table>';
//Extra field
// Extra field
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($adht->array_options['options_'.$key])?$adht->array_options['options_'.$key]:''));
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";

View File

@ -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

View File

@ -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
{

View File

@ -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 = "&amp;search_code=$search_code&amp;search_ip=$search_ip&amp;search_user=$search_user&amp;search_desc=$search_desc&amp;search_ua=$search_ua";
$params.= "&amp;date_startmonth=".$_REQUEST["date_startmonth"];
$params.= "&amp;date_startday=".$_REQUEST["date_startday"];
$params.= "&amp;date_startyear=".$_REQUEST["date_startyear"];
$params.= "&amp;date_endmonth=".$_REQUEST["date_endmonth"];
$params.= "&amp;date_endday=".$_REQUEST["date_endday"];
$params.= "&amp;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">&nbsp;</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.'">';

View File

@ -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))

View File

@ -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>';

View File

@ -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>';

View File

@ -685,6 +685,10 @@ class ActionComm extends CommonObject
foreach($this->userassigned as $key => $val)
{
if (! is_array($val)) // For backward compatibility when val=id
{
$val=array('id'=>$val);
}
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['manadatory'])?'0':$val['manadatory']).", ".(empty($val['transparency'])?'0':$val['transparency']).", ".(empty($val['answer_status'])?'0':$val['answer_status']).")";

View File

@ -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();
}

View File

@ -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);

View File

@ -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='';
}
}

View File

@ -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>';

View File

@ -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') . '">';

View File

@ -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);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 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
@ -187,6 +188,8 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewVATPayment"));
dol_fiche_head();
print '<table class="border" width="100%">';
print "<tr>";
@ -228,7 +231,7 @@ if ($action == 'create')
print '</table>';
print "<br>";
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';

View File

@ -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='';
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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
@ -266,7 +266,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
@ -580,11 +579,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].">";
@ -702,14 +699,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.'&amp;file='.urlencode($relativepath).'"';
@ -803,8 +800,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_.';
}

View File

@ -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

View File

@ -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');

View File

@ -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')
{

View File

@ -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.

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 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
@ -107,6 +108,34 @@ function member_prepare_head(Adherent $object)
return $head;
}
/**
* Return array head with list of tabs to view object informations
*
* @param Adherent $object Member
* @return array head
*/
function member_type_prepare_head(AdherentType $object)
{
global $langs, $conf, $user;
$h=0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/adherents/type.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'membertype');
complete_head_from_modules($conf,$langs,$object,$head,$h,'membertype','remove');
return $head;
}
/**
* Return array head with list of tabs to view object informations

View File

@ -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;

View File

@ -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))
{

View File

@ -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");

View File

@ -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='';

View File

@ -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='';
}

View File

@ -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);
}
}

View File

@ -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";
}

View File

@ -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,10 +278,11 @@ 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%">';
print '<tbody>';
$nbrows=11;
if (! empty($conf->projet->enabled)) $nbrows++;
@ -312,14 +317,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 +342,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,12 +357,13 @@ if ($action == 'create')
{
print $object->showOptionals($extrafields,'edit',$parameters);
}
print '</tbody>';
print "</table>\n";
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print "</form>\n";
}
@ -380,6 +386,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 +448,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 +465,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 +504,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 +513,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 +551,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 +593,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>&nbsp;".$langs->trans("Currency".$conf->currency)."</td>\n";
print "</tr>";
@ -628,7 +637,7 @@ if (! empty($id) && $action != 'edit')
else
{
print $object->country_olddata;
}
}
print '</td></tr>';
// EMail
@ -683,12 +692,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 . '&amp;action=create">' . $langs->trans('DoPayment') . '</a></div>';
@ -700,7 +709,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 +729,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 +739,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>&nbsp;</td>';

View File

@ -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
*

View File

@ -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

View File

@ -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

View File

@ -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='';
}
}

View File

@ -88,10 +88,10 @@ if ($page == -1) {
$page = 0 ;
}
$limit = $conf->liste_limit;
$offset = $limit * $page;
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
$sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
$sql.= " d.date_debut, d.date_fin,";
@ -219,7 +219,7 @@ if ($resql)
print '<td class="liste_titre">&nbsp;</td>';
}
// Amount with no taxe
// Amount with no tax
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_amount_ht" value="'.$search_amount_ht.'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
@ -245,9 +245,9 @@ if ($resql)
$total_total_ttc = 0;
$total_total_tva = 0;
if($num>0)
if($num > 0)
{
while ($i < $num)
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);

View File

@ -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);

View File

@ -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'];

View File

@ -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";

View File

@ -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'];
}

View File

@ -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;
}

View File

@ -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";

View File

@ -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">';

View File

@ -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
(

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -191,6 +191,8 @@ if ($action == 'create')
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%">';
// Label
@ -287,8 +289,10 @@ if ($action == 'create')
print '</table>';
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; ';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
dol_fiche_end();
print '<div align="center"><input class="button" type="submit" value="'.$langs->trans("Save").'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print '</form>';
}

View File

@ -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');

View File

@ -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
{

View File

@ -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)
{

View File

@ -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);

View File

@ -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='';
}
}

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
/* Copyright (C) 2013 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 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
@ -22,15 +23,10 @@
* Initialy built by build_class_from_table on 2013-07-24 16:03
*/
require '../main.inc.php';
// Change this following line to use the correct relative path (../, ../../, etc)
$res=0;
$res=@include("../main.inc.php"); // For root directory
if (! $res) $res=@include("../../main.inc.php"); // For "custom" directory
if (! $res) die("Include of main fails");
require_once 'class/resource.class.php';
require_once 'class/html.formresource.class.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/resource.class.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
// Load traductions files required by page
$langs->load("resource");
@ -132,6 +128,8 @@ if (! $action)
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="add_resource">';
print '<input type="hidden" name="action" value="confirm_add_resource" />';
dol_fiche_head('');
print '<table class="border" width="100%">';
// Ref / label
@ -161,7 +159,7 @@ if (! $action)
print '</label>';
print '</td>';
print '<td>';
require_once (DOL_DOCUMENT_ROOT . "/core/class/doleditor.class.php");
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($field, $$field, 160, '', '', false);
$doleditor->Create();
print '</td>';
@ -169,9 +167,11 @@ if (! $action)
print '</table>';
echo '<br><div align="center">',
dol_fiche_end('');
echo '<div align="center">',
'<input type="submit" class="button" name="add" value="'.$langs->trans('Save').'" />',
'&nbsp;',
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
'<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'" />',
'</div>';

View File

@ -74,9 +74,10 @@ class CompanyBankAccount extends Account
/**
* Create bank information record
*
* @return int <0 if KO, >= 0 if OK
* @param Object $user User
* @return int <0 if KO, >= 0 if OK
*/
function create()
function create($user='')
{
$now=dol_now();

View File

@ -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');
}

View File

@ -759,11 +759,11 @@ else
}
$modCodeFournisseur = new $module;
//if ($_GET["type"]=='cp') { $object->client=3; }
if (GETPOST("type")!='f') { $object->client=3; }
// Define if customer/prospect or supplier status is set or not
if (GETPOST("type")!='f' && empty($conf->global->THIRDPARTY_NOTCUSTOMERPROSPECT_BY_DEFAULT)) { $object->client=3; }
if (GETPOST("type")=='c') { $object->client=1; }
if (GETPOST("type")=='p') { $object->client=2; }
if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || GETPOST("type")=='')) { $object->fournisseur=1; }
if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || (GETPOST("type")=='' && empty($conf->global->THIRDPARTY_NOTSUPPLIER_BY_DEFAULT)))) { $object->fournisseur=1; }
$object->name = GETPOST('nom', 'alpha');
$object->firstname = GETPOST('firstname', 'alpha');

View File

@ -1295,6 +1295,95 @@ table.liste td {padding:1px 2px 1px 0px;}
.tagtr, .table-border-row { display: table-row; }
.tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; }
/* Pagination */
div.pagination {
float: right;
}
div.pagination a {
font-weight: normal;
}
div.pagination ul
{
list-style: none;
display: inline-block;
padding-left: 0px;
padding-right: 0px;
margin: 0;
}
div.pagination li {
display: inline-block;
padding-left: 0px;
padding-right: 0px;
padding-top: 6px;
padding-bottom: 6px;
}
.pagination {
display: inline-block;
padding-left: 0;
border-radius: 4px;
}
div.pagination li a,
div.pagination li span {
/*position: relative;*/
/*float: left;*/
padding: 6px 12px;
margin-left: -1px;
line-height: 1.42857143;
color: #000;
text-decoration: none;
background-color: #fff;
border: 1px solid #ddd;
}
div.pagination li:first-child a,
div.pagination li:first-child span {
margin-left: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
div.pagination li:last-child a,
div.pagination li:last-child span {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
div.pagination li a:hover,
div.pagination li span:hover,
div.pagination li a:focus,
div.pagination li span:focus {
color: #000;
background-color: #eee;
border-color: #ddd;
}
div.pagination li .active a,
div.pagination li .active span,
div.pagination li .active a:hover,
div.pagination li .active span:hover,
div.pagination li .active a:focus,
div.pagination li .active span:focus {
z-index: 2;
color: #fff;
cursor: default;
background-color: <?php $colorbackhmenu1 ?>;
border-color: #337ab7;
}
div.pagination .disabled span,
div.pagination .disabled span:hover,
div.pagination .disabled span:focus,
div.pagination .disabled a,
div.pagination .disabled a:hover,
div.pagination .disabled a:focus {
color: #777;
cursor: not-allowed;
background-color: #fff;
border-color: #ddd;
}
div.pagination li .active {
text-decoration: underline;
}
div.pagination li.paginationafterarrows {
margin-left: 10px;
}
tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel
{
height: 22px;

View File

@ -1396,6 +1396,95 @@ table.liste td {
.tagtr, .table-border-row { display: table-row; }
.tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; }
/* Pagination */
div.pagination {
float: right;
}
div.pagination a {
font-weight: normal;
}
div.pagination ul
{
list-style: none;
display: inline-block;
padding-left: 0px;
padding-right: 0px;
margin: 0;
}
div.pagination li {
display: inline-block;
padding-left: 0px;
padding-right: 0px;
padding-top: 6px;
padding-bottom: 6px;
}
.pagination {
display: inline-block;
padding-left: 0;
border-radius: 4px;
}
div.pagination li a,
div.pagination li span {
/*position: relative;*/
/*float: left;*/
padding: 6px 12px;
margin-left: -1px;
line-height: 1.42857143;
color: #000;
text-decoration: none;
background-color: #fff;
border: 1px solid #ddd;
}
div.pagination li:first-child a,
div.pagination li:first-child span {
margin-left: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
div.pagination li:last-child a,
div.pagination li:last-child span {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
div.pagination li a:hover,
div.pagination li span:hover,
div.pagination li a:focus,
div.pagination li span:focus {
color: #000;
background-color: #eee;
border-color: #ddd;
}
div.pagination li .active a,
div.pagination li .active span,
div.pagination li .active a:hover,
div.pagination li .active span:hover,
div.pagination li .active a:focus,
div.pagination li .active span:focus {
z-index: 2;
color: #fff;
cursor: default;
background-color: <?php $colorbackhmenu1 ?>;
border-color: #337ab7;
}
div.pagination .disabled span,
div.pagination .disabled span:hover,
div.pagination .disabled span:focus,
div.pagination .disabled a,
div.pagination .disabled a:hover,
div.pagination .disabled a:focus {
color: #777;
cursor: not-allowed;
background-color: #fff;
border-color: #ddd;
}
div.pagination li .active {
text-decoration: underline;
}
div.pagination li.paginationafterarrows {
margin-left: 10px;
}
tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel
{
height: 24px;

View File

@ -1516,6 +1516,95 @@ table.noborder {
.tagtr, .table-border-row { display: table-row; }
.tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; }
/* Pagination */
div.pagination {
float: right;
}
div.pagination a {
font-weight: normal;
}
div.pagination ul
{
list-style: none;
display: inline-block;
padding-left: 0px;
padding-right: 0px;
margin: 0;
}
div.pagination li {
display: inline-block;
padding-left: 0px;
padding-right: 0px;
padding-top: 6px;
padding-bottom: 6px;
}
.pagination {
display: inline-block;
padding-left: 0;
border-radius: 4px;
}
div.pagination li a,
div.pagination li span {
/*position: relative;*/
/*float: left;*/
padding: 6px 12px;
margin-left: -1px;
line-height: 1.42857143;
color: #000;
text-decoration: none;
background-color: #fff;
border: 1px solid #ddd;
}
div.pagination li:first-child a,
div.pagination li:first-child span {
margin-left: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
div.pagination li:last-child a,
div.pagination li:last-child span {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
div.pagination li a:hover,
div.pagination li span:hover,
div.pagination li a:focus,
div.pagination li span:focus {
color: #000;
background-color: #eee;
border-color: #ddd;
}
div.pagination li .active a,
div.pagination li .active span,
div.pagination li .active a:hover,
div.pagination li .active span:hover,
div.pagination li .active a:focus,
div.pagination li .active span:focus {
z-index: 2;
color: #fff;
cursor: default;
background-color: <?php $colorbackhmenu1 ?>;
border-color: #337ab7;
}
div.pagination .disabled span,
div.pagination .disabled span:hover,
div.pagination .disabled span:focus,
div.pagination .disabled a,
div.pagination .disabled a:hover,
div.pagination .disabled a:focus {
color: #777;
cursor: not-allowed;
background-color: #fff;
border-color: #ddd;
}
div.pagination li .active {
text-decoration: underline;
}
div.pagination li.paginationafterarrows {
margin-left: 10px;
}
tr.liste_titre, form.liste_titre {
height: 25px;
background-repeat: no-repeat;

View File

@ -1540,6 +1540,95 @@ table.liste td {
.tagtr, .table-border-row { display: table-row; }
.tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; }
/* Pagination */
div.pagination {
float: right;
}
div.pagination a {
font-weight: normal;
}
div.pagination ul
{
list-style: none;
display: inline-block;
padding-left: 0px;
padding-right: 0px;
margin: 0;
}
div.pagination li {
display: inline-block;
padding-left: 0px;
padding-right: 0px;
padding-top: 6px;
padding-bottom: 6px;
}
.pagination {
display: inline-block;
padding-left: 0;
border-radius: 4px;
}
div.pagination li a,
div.pagination li span {
/*position: relative;*/
/*float: left;*/
padding: 6px 12px;
margin-left: -1px;
line-height: 1.42857143;
color: #000;
text-decoration: none;
background-color: #fff;
border: 1px solid #ddd;
}
div.pagination li:first-child a,
div.pagination li:first-child span {
margin-left: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
div.pagination li:last-child a,
div.pagination li:last-child span {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
div.pagination li a:hover,
div.pagination li span:hover,
div.pagination li a:focus,
div.pagination li span:focus {
color: #000;
background-color: #eee;
border-color: #ddd;
}
div.pagination li .active a,
div.pagination li .active span,
div.pagination li .active a:hover,
div.pagination li .active span:hover,
div.pagination li .active a:focus,
div.pagination li .active span:focus {
z-index: 2;
color: #fff;
cursor: default;
background-color: <?php $colorbackhmenu1 ?>;
border-color: #337ab7;
}
div.pagination .disabled span,
div.pagination .disabled span:hover,
div.pagination .disabled span:focus,
div.pagination .disabled a,
div.pagination .disabled a:hover,
div.pagination .disabled a:focus {
color: #777;
cursor: not-allowed;
background-color: #fff;
border-color: #ddd;
}
div.pagination li .active {
text-decoration: underline;
}
div.pagination li.paginationafterarrows {
margin-left: 10px;
}
tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel
{
height: 20px !important;

View File

@ -1867,6 +1867,94 @@ table.liste td {
.tagtr, .table-border-row { display: table-row; }
.tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; }
/* Pagination */
div.pagination {
float: right;
}
div.pagination a {
font-weight: normal;
}
div.pagination ul
{
list-style: none;
display: inline-block;
padding-left: 0px;
padding-right: 0px;
margin: 0;
}
div.pagination li {
display: inline-block;
padding-left: 0px;
padding-right: 0px;
padding-top: 6px;
padding-bottom: 6px;
}
.pagination {
display: inline-block;
padding-left: 0;
border-radius: 4px;
}
div.pagination li a,
div.pagination li span {
/*position: relative;*/
/*float: left;*/
padding: 6px 12px;
margin-left: -1px;
line-height: 1.42857143;
color: #000;
text-decoration: none;
background-color: #fff;
border: 1px solid #ddd;
}
div.pagination li:first-child a,
div.pagination li:first-child span {
margin-left: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
div.pagination li:last-child a,
div.pagination li:last-child span {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
div.pagination li a:hover,
div.pagination li span:hover,
div.pagination li a:focus,
div.pagination li span:focus {
color: #000;
background-color: #eee;
border-color: #ddd;
}
div.pagination li .active a,
div.pagination li .active span,
div.pagination li .active a:hover,
div.pagination li .active span:hover,
div.pagination li .active a:focus,
div.pagination li .active span:focus {
z-index: 2;
color: #fff;
cursor: default;
background-color: <?php $colorbackhmenu1 ?>;
border-color: #337ab7;
}
div.pagination .disabled span,
div.pagination .disabled span:hover,
div.pagination .disabled span:focus,
div.pagination .disabled a,
div.pagination .disabled a:hover,
div.pagination .disabled a:focus {
color: #777;
cursor: not-allowed;
background-color: #fff;
border-color: #ddd;
}
div.pagination li .active {
text-decoration: underline;
}
div.pagination li.paginationafterarrows {
margin-left: 10px;
}
/* Prepare to remove class pair - impair
.noborder > tbody > tr:nth-child(even) td {

View File

@ -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);

View File

@ -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,

View File

@ -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(