diff --git a/dev/ansible/deployplaybook/deploydev.yml b/dev/ansible/deployplaybook/deploydev.yml new file mode 100644 index 00000000000..5802fb10a1e --- /dev/null +++ b/dev/ansible/deployplaybook/deploydev.yml @@ -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 + diff --git a/dev/ansible/deployplaybook/files/apachealias.conf b/dev/ansible/deployplaybook/files/apachealias.conf new file mode 100644 index 00000000000..d801094af5a --- /dev/null +++ b/dev/ansible/deployplaybook/files/apachealias.conf @@ -0,0 +1,2 @@ + +Alias /dolibarr_dev /var/www/dolibarr diff --git a/dev/ansible/deployplaybook/hosts b/dev/ansible/deployplaybook/hosts new file mode 100644 index 00000000000..99627faba2b --- /dev/null +++ b/dev/ansible/deployplaybook/hosts @@ -0,0 +1,2 @@ +[webservers] +testserver ansible_ssh_host=127.0.0.1 ansible_ssh_port=22 diff --git a/dev/ansible/deployplaybook/templates/info.html.j2 b/dev/ansible/deployplaybook/templates/info.html.j2 new file mode 100644 index 00000000000..66fac1c4deb --- /dev/null +++ b/dev/ansible/deployplaybook/templates/info.html.j2 @@ -0,0 +1,10 @@ + + + Page info ansible + + +

Apache, configured by Ansible

+

If you can see this, Ansible successfully installed apache.

+

{{ ansible_managed }}

+ + \ No newline at end of file diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index fdc2f78be64..d555ed46092 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * * 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 '
' . "\n"; print ''; print ''; - + + dol_fiche_head(); + print ''; print ''; @@ -163,8 +164,10 @@ if ($action == 'create') print ''; print '
' . $langs->trans("AccountNumber") . '
'; - - print '
'; + + dol_fiche_end(); + + print '
'; print ''; print '     '; print ''; @@ -216,16 +219,16 @@ else if ($id) print ''; print ''; - - print '
'; + + dol_fiche_end(); + + print '
'; print ''; print '     '; print ''; print '
'; print ''; - - print '
'; } else { @@ -268,8 +271,8 @@ else if ($id) print ''; print ''; - - print '
'; + + dol_fiche_end(); /* * Barre d'actions @@ -297,6 +300,6 @@ else if ($id) dol_print_error($db); } } +$db->close(); -llxFooter(); -$db->close(); \ No newline at end of file +llxFooter(); \ No newline at end of file diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 040419c89c2..fc985efffe7 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2015 Alexandre Spangaro * * 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 ''; print ''; + dol_fiche_head(); + print ''; // Label @@ -199,8 +201,10 @@ if ($action == 'create') print ''; print '
'; + + dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 0fe6366ae58..100d1e23e74 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García * Copyright (C) 2012-2013 Philippe Grand + * Copyright (C) 2015 Alexandre Spangaro * * 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 ''; print ''; + dol_fiche_head(''); + print ''; + print ''; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) @@ -868,13 +874,13 @@ else print ''; } - // Tel pro + // Pro phone print ''; - // Tel perso + // Personal phone print ''; - // Tel mobile + // Mobile phone print ''; // Skype @@ -888,7 +894,7 @@ else $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); print "\n"; - // Profil public + // Public profil print "\n"; @@ -915,21 +921,25 @@ else print $form->select_dolusers($object->user_id,'userid',1); print ''; */ - + print ''; print "
'.$langs->trans("PhonePro").'
'.$langs->trans("PhonePerso").'
'.$langs->trans("PhoneMobile").'
".$langs->trans("Public")."\n"; print $form->selectyesno("public",$object->public,1); print "
\n"; - print '
'; - print '
'; + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; print "\n"; - } if ($action == 'edit') { /******************************************** - * - * Fiche en mode edition + * + * Edition mode * ********************************************/ @@ -1027,6 +1037,7 @@ else print ''.$langs->trans("Nature").''; print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); print ""; + // Photo print ''; print $form->showphoto('memberphoto',$object)."\n"; @@ -1107,13 +1118,13 @@ else print ''; } - // Tel + // Pro phone print ''.$langs->trans("PhonePro").'phone).'">'; - // Tel perso + // Personal phone print ''.$langs->trans("PhonePerso").'phone_perso).'">'; - // Tel mobile + // Mobile phone print ''.$langs->trans("PhoneMobile").'phone_mobile).'">'; // Skype @@ -1127,7 +1138,7 @@ else $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); print "\n"; - // Profil public + // Public profil print "".$langs->trans("Public")."\n"; print $form->selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1); print "\n"; @@ -1171,7 +1182,7 @@ else print '
'; print ''; print '     '; - print ''; + print ''; print '
'; print ''; @@ -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 '
'; if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty') @@ -1553,7 +1563,7 @@ else print '
'.$langs->trans("Modify").'
'; } - // 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 '
'.$langs->trans("SendCardByMail")."
"; } - // Resilier + // Terminate if ($object->statut >= 1) { if ($user->rights->adherent->supprimer) diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 3761b75f384..dabbf142730 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -3,6 +3,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2015 Alexandre Spangaro * * 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 ''; print ''; print ''; - print "\n"; - $today=dol_now(); + dol_fiche_head(''); + + print "
\n"; + print ''; + + $today=dol_now(); $datefrom=0; $dateto=0; $paymentdate=-1; @@ -1102,8 +1107,10 @@ if ($rowid > 0) print $form->textwithpicto($tmp,$helpcontent,1,'help'); } print ''; + print ''; print '
'; - print '
'; + + dol_fiche_end(); print '
'; print ''; diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 1d780eb21a5..71f1df22937 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -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 */ diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index cdeaa21ba9f..e830254fd97 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Alexandre Spangaro * * 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 '
'; @@ -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 '
'; print ''; - print ''; + dol_fiche_head(''); + + print '
'; + print ''; + print ''; print ''; @@ -260,7 +264,7 @@ if ($action == 'create') print ''; @@ -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 ''; print "
'.$langs->trans("Label").'
'.$langs->trans("WelcomeEMail").''; 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 '
\n"; + + dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -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 ''; $linkback = ''.$langs->trans("BackToList").''; @@ -312,25 +313,25 @@ if ($rowid > 0) // Ref print ''; print ''; // Label - print ''; + print ''; print ''; print ''; print '"; + print nl2br($object->note).""; print '"; + print nl2br($object->mail_valid).""; // 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 '
'.$langs->trans("Ref").''; - print $form->showrefnav($adht, 'rowid', $linkback); + print $form->showrefnav($object, 'rowid', $linkback); print '
'.$langs->trans("Label").''.$adht->libelle.'
'.$langs->trans("Label").''.$object->libelle.'
'.$langs->trans("SubscriptionRequired").''; - print yn($adht->cotisation); + print yn($object->cotisation); print '
'.$langs->trans("VoteAllowed").''; - print yn($adht->vote); + print yn($object->vote); print '
'.$langs->trans("Description").''; - print nl2br($adht->note)."
'.$langs->trans("WelcomeEMail").''; - print nl2br($adht->mail_valid)."
'; print '
'; /* - * Barre d'actions - * + * Hotbar */ print '
'; // Edit if ($user->rights->adherent->configurer) { - print ''; + print ''; } // Add - print ''; + print ''; // Delete if ($user->rights->adherent->configurer) { - print ''; + print ''; } print "
"; @@ -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 ''; 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 ''; print ''; - print ''; + print ''; - print ''; + print ''; print ''; print ''; print ''; + print ''; print '"; @@ -668,13 +669,13 @@ if ($rowid > 0) print '
'.$langs->trans("Ref").''.$adht->id.'
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("SubscriptionRequired").''; - print $form->selectyesno("cotisation",$adht->cotisation,1); + print $form->selectyesno("cotisation",$object->cotisation,1); print '
'.$langs->trans("VoteAllowed").''; - print $form->selectyesno("vote",$adht->vote,1); + print $form->selectyesno("vote",$object->vote,1); print '
'.$langs->trans("Description").''; - print '
'.$langs->trans("WelcomeEMail").''; 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 "
'; - //Extra field + // Extra field if (empty($reshook) && ! empty($extrafields->attribute_label)) { print '

'; 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 '\n"; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 671a9bf9eba..88184065574 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -439,6 +439,26 @@ print "\n";
" id="buttonGo" />

+ +'.$langs->trans("RunCommandSummary").':
'."\n"; + print '
'."\n"; + print '
'; + + //print $paramclear; + + // Now run command and show result + print ''.$langs->trans("BackupResult").': '; + print $_SESSION["commandbackupresult"]; + + $_SESSION["commandbackuplastdone"]=''; + $_SESSION["commandbackuptorun"]=''; + $_SESSION["commandbackupresult"]=''; +} +?> +
trans("Error")." : ".$errormsg, 'errors'); - /* - print '
'.$langs->trans("Error")." : ".$errormsg.'
'; - print '
'; - print '
';*/ + + $resultstring=''; + $resultstring.='
'.$langs->trans("Error")." : ".$errormsg.'
'; + + $_SESSION["commandbackupresult"]=$resultstring; } else { if ($what) { setEventMessage($langs->trans("BackupFileSuccessfullyCreated").'.
'.$langs->trans("YouCanDownloadBackupFile")); - /*print '
'; - print $langs->trans("BackupFileSuccessfullyCreated").'.
'; - print $langs->trans("YouCanDownloadBackupFile"); - print '
'; - print '
';*/ + + $resultstring='
'; + $resultstring.=$langs->trans("BackupFileSuccessfullyCreated").'.
'; + $resultstring.=$langs->trans("YouCanDownloadBackupFile"); + $resultstring.='
'; + + $_SESSION["commandbackupresult"]=$resultstring; } else { diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 373b46c6062..72280ec7220 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -1,6 +1,7 @@ - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Bahfir Abbes * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (! $user->admin) accessforbidden(); @@ -59,6 +61,32 @@ $search_user = GETPOST("search_user"); $search_desc = GETPOST("search_desc"); $search_ua = GETPOST("search_ua"); +$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); + +// checks:if date_start>date_end then date_end=date_start + 24 hours +if ($date_start > $date_end) $date_end=$date_start+86400; + +$now = dol_now(); +$nowarray = dol_getdate($now); + +$params = "&search_code=$search_code&search_ip=$search_ip&search_user=$search_user&search_desc=$search_desc&search_ua=$search_ua"; +$params.= "&date_startmonth=".$_REQUEST["date_startmonth"]; +$params.= "&date_startday=".$_REQUEST["date_startday"]; +$params.= "&date_startyear=".$_REQUEST["date_startyear"]; +$params.= "&date_endmonth=".$_REQUEST["date_endmonth"]; +$params.= "&date_endday=".$_REQUEST["date_endday"]; +$params.= "&date_endyear=".$_REQUEST["date_endyear"]; + +if (empty($date_start)) // We define date_start and date_end +{ + $date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false); +} +if (empty($date_end)) +{ + $date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']); +} + /* * Actions @@ -124,6 +152,7 @@ $sql.= " u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."events as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; $sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")"; +$sql.= " AND e.dateevent >= '".$db->idate($date_start)."' AND e.dateevent <= '".$db->idate($date_end)."'"; if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; } if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; } if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; } @@ -145,7 +174,8 @@ if ($result) if ($search_desc) $param.='&search_desc='.$search_desc; if ($search_ua) $param.='&search_ua='.$search_ua; - print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup'); + $langs->load('withdrawals'); + print_barre_liste($langs->trans("ListOfSecurityEvents").' : '.$num.' '.strtolower($langs->trans("Lines")), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup'); if ($action == 'purge') { @@ -168,7 +198,7 @@ if ($result) print ''; print '
'; - print ''; + print ''; print ''; - + print "".''; print "'; print ''; print ''; - + $rowspan=6; if (! empty($conf->projet->enabled)) $rowspan++; print ''; print '\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 "\n"; print '\n"; print ""; @@ -628,7 +637,7 @@ if (! empty($id) && $action != 'edit') else { print $object->country_olddata; - } + } print ''; // 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 '
' . $langs->trans('DoPayment') . '
'; - } + } else { print ''; @@ -700,7 +709,7 @@ if (! empty($id) && $action != 'edit') { print '"; } - + // 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 '
'; - $formfile->show_documents('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed); + $formfile->show_documents('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); print ''; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 33706ddd841..e3910b6fe51 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -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 * diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index db8b236feaa..2475f420dd0 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -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 "\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 diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 41def896ac0..e0b5b791ada 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -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 diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a9ccf2471db..2d9bcbceead 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -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=''; } } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 0974ce0f31c..58002c19dba 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -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 ''; } - // Amount with no taxe + // Amount with no tax print ''; print ''; @@ -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); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b1b9e74266e..ccd17a2f97b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -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); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 0c5998d953c..994ddb28310 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -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']; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 6511bb569e0..35165b33298 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -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 ''; dol_fiche_head(''); - + print '
'.$label.''; print $extrafields->showInputField($key,$value); print "
 '.$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).''; print ''; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 20fce315153..96949371bae 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -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)) diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 76a19c91d7d..590cb4edb49 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2012 Regis Houssin * @@ -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'=>''. + ''. ''. '
'.$li. - ''. - ' '.$val['description'].''.dolGetFirstLineOfText($val['description']).''.img_view().'
' ); @@ -160,7 +160,7 @@ foreach($fulltree as $key => $val) print ''; -print '"; @@ -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.= '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_.'; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 0af5e917cc5..daae392cd39 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -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 diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 3d605d10902..d350fbce175 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -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'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f067dcaf417..3d756fb8e32 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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 '
'.$langs->trans("Categories").''.$langs->trans("Description").''; +print '
'.$langs->trans("Categories").''; if (! empty($conf->use_javascript_ajax)) { print ''; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 59be328c55e..eb496db1af9 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -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 '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d9f2d7b6541..fb4c6f45d84 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -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']).")"; diff --git a/htdocs/comm/askpricesupplier/card.php b/htdocs/comm/askpricesupplier/card.php index 14d00d43780..c49881ba542 100644 --- a/htdocs/comm/askpricesupplier/card.php +++ b/htdocs/comm/askpricesupplier/card.php @@ -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(); } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 7c08235e788..e8635ec4861 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -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); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 09c6087860c..5be006c0053 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -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=''; } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6ff12430000..4b7d0104ec9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -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 ''; dol_fiche_head(''); - + print ''; // Reference @@ -1548,7 +1548,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'; dol_fiche_end(); - + // Button "Create Draft" print '
'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 6621db1d241..88d6bb587e4 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -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 ''; dol_fiche_head(''); - + print ''; // Ref @@ -2475,7 +2475,7 @@ if ($action == 'create') print "
\n"; dol_fiche_end(); - + // Button "Create Draft" print '
'; print ''; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index dba17a4798c..49af748c115 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -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); diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index b612a9b6459..978396e0cf5 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2015 Alexandre Spangaro * * 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 ''; print ""; @@ -228,7 +231,7 @@ if ($action == 'create') print '
'; - print "
"; + dol_fiche_end(); print '
'; print ''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index cc9a394d983..dd48b27684f 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -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=''; } } diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 520ab7634be..cdb7f66ac5f 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -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; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 406ad24db4b..39634e6af31 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 22a1e4359ee..926ee8a337a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Bahfir Abbes - + * 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.= "
'; + print ''; $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 ''; - + print "".''; // Public note print ''; print ''; print ''; @@ -337,9 +342,9 @@ if ($action == 'create') if (! empty($conf->projet->enabled)) { - + $formproject=new FormProjets($db); - + print "\n"; @@ -352,12 +357,13 @@ if ($action == 'create') { print $object->showOptionals($extrafields,'edit',$parameters); } - + + print ''; print "
'.$langs->trans("EMail").'
' . $langs->trans('NotePublic') . ''; - + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); print '
".$langs->trans("Project").""; $formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 0, 1, 1); print "
\n"; - + dol_fiche_end(); - - print '
   
'; + + print '
     
'; print "\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 '
'.$langs->trans("EMail").'
".$langs->trans("PaymentMode")."\n"; @@ -458,7 +465,7 @@ if (! empty($id) && $action == 'edit') if (! empty($conf->projet->enabled)) { $formproject=new FormProjets($db); - + $langs->load('projects'); print '
'.$langs->trans('Project').''; $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 '
'.$langs->trans("Lastname").''.$object->lastname.'
'.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Address").''.dol_nl2br($object->address).''; @@ -584,7 +593,7 @@ if (! empty($id) && $action != 'edit') print "
"; print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$object->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
 
  
'; // Ref @@ -1603,7 +1603,7 @@ if ($action=='create') print "
\n"; dol_fiche_end(); - + print '
'; print "\n"; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 73832e9f3b7..bf310d92f8d 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -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.='
'.$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.='
'.$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='
'.$langs->trans('ErrorCantReadFile',$file).'
'; - 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 '
'; print ''; print ''; @@ -1575,7 +1563,7 @@ if ($action == 'create') print "\n"; dol_fiche_end(); - + print '
'; print "
\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']; } diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index e6fed653421..7b36ec62c37 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -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; } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 887fa7c6fab..010e9b95ae6 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -8,7 +8,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 juanjo Menent * Copyright (C) 2015 Abbes Bahfir - + * 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 "\n"; diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php index ba5c396c420..49f2fc2b65b 100644 --- a/htdocs/fourn/product/photos.php +++ b/htdocs/fourn/product/photos.php @@ -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 '
'; diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 73e7694c040..1d5ba017aab 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -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 ( diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql index 703b86841f9..1e7fa12d565 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql @@ -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 diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 4266107d8a3..9a878366bc7 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -170,6 +170,7 @@ ErrorGlobalVariableUpdater4=SOAP client failed with error '%s' ErrorGlobalVariableUpdater5=No global variable selected ErrorFieldMustBeANumeric=Field %s must be a numeric value ErrorFieldMustBeAnInteger=Field %s must be an integer +ErrorMandatoryParametersNotProvided=Mandatory parameter(s) not provided # Warnings WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index f4f46e263c2..fb087e71800 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -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 '
'; print '
'; 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); } diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 670f2180bf0..ad32f7b6ced 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2015 Alexandre Spangaro * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify @@ -191,6 +191,8 @@ if ($action == 'create') print ''; print ''; + dol_fiche_head(); + print ''; // Label @@ -287,8 +289,10 @@ if ($action == 'create') print '
'; - print '
    '; - print '
'; + dol_fiche_end(); + + print '
     '; + print '
'; print ''; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index ebad59202cc..841cea51cd0 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -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'); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b2df143e185..d2c3deeb2e4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -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 { diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index dc4b1f69bdb..60384a29da0 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * 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 ''.$langs->trans("Validate").''; - } - else - { - print ''.$langs->trans('Validate').''; - } - } - // 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 ''.$langs->trans("Validate").''; + } + else + { + print ''.$langs->trans('Validate').''; + } + } + // Close - if ($object->statut == 1 && $user->rights->projet->creer) + if (($object->statut == 0 || $object->statut == 1) && $user->rights->projet->creer) { if ($userWrite > 0) { diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index a56de8ec84b..c5f561b2c1c 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -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); diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 8dd7bac68d8..5d8085efcdd 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -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=''; } } diff --git a/htdocs/resource/add.php b/htdocs/resource/add.php index 679644ac9e0..b13e60bd0bc 100644 --- a/htdocs/resource/add.php +++ b/htdocs/resource/add.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2013 Jean-François Ferry + * Copyright (C) 2015 Alexandre Spangaro * * 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 '
'; print ''; + dol_fiche_head(''); + print ''; // Ref / label @@ -161,7 +159,7 @@ if (! $action) print ''; print ''; print ''; @@ -169,9 +167,11 @@ if (! $action) print '
'; - 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 '
'; - echo '
', + dol_fiche_end(''); + + echo '
', '', - ' ', + '     ', '', '
'; diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 255ab6a05a6..3a57ce7a3d4 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -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(); diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index f3c217d0a54..b152e6097c6 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -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'); } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index d2cac9d2be8..fdc3a4cc4e8 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -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'); diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index c7f3d27dcfb..39c98e713fa 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -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: ; + 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; diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 7278521e092..4b536a4e1e3 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -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: ; + 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; diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 31071f0b10c..88b9a5c1222 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -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: ; + 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; diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index d09cb844b88..640fea40575 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -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: ; + 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; diff --git a/htdocs/theme/md_exp/style.css.php b/htdocs/theme/md_exp/style.css.php index d954eeb881d..543ae8a4a54 100644 --- a/htdocs/theme/md_exp/style.css.php +++ b/htdocs/theme/md_exp/style.css.php @@ -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: ; + 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 { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index e4080ca634f..b7c7f7f6d9c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -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); diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 345679f7c9a..2bf914ebd38 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -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, diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index b7af224ff52..86891e87595 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -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(