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

This commit is contained in:
Laurent Destailleur 2016-09-26 14:17:36 +02:00
commit 6232e59fd2
15 changed files with 194 additions and 288 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,8 +19,8 @@
*/ */
/** /**
* \file htdocs/accountancy/bookkeeping/list.php * \file htdocs/accountancy/bookkeeping/list.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief List operation of book keeping * \brief List operation of book keeping
*/ */
require '../../main.inc.php'; require '../../main.inc.php';

View File

@ -1,10 +1,11 @@
<?php <?php
/* /*
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr> * Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,7 +22,9 @@
*/ */
/** /**
* \file htdocs/accountancy/class/accountancyexport.class.php * \file htdocs/accountancy/class/accountancyexport.class.php
* \ingroup Advanced accountancy
* \brief Class accountancy export
*/ */
/** /**
@ -182,15 +185,16 @@ class AccountancyExport
public function exportCegid($objectLines) { public function exportCegid($objectLines) {
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
$separator = ";";
print $date . $this->separator; print $date . $separator;
print $line->code_journal . $this->separator; print $line->code_journal . $separator;
print length_accountg($line->numero_compte) . $this->separator; print length_accountg($line->numero_compte) . $separator;
print ' ' . $this->separator; print length_accounta($line->code_tiers) . $separator;
print $line->sens . $this->separator; print $line->sens . $separator;
print price($line->montant) . $this->separator; print price($line->montant) . $separator;
print dol_trunc($line->label_compte, 32) . $this->separator; print $line->label_compte . $separator;
print $line->doc_ref . $this->separator; print $line->doc_ref;
print $this->end_line; print $this->end_line;
} }
} }

View File

@ -292,7 +292,7 @@ if ($result) {
// Ref Invoice // Ref Invoice
$facture_static->ref = $objp->facnumber; $facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid; $facture_static->id = $objp->rowid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>'; print '<td>' . $facture_static->getNomUrl(1) . '</td>';
// Ref Product // Ref Product

View File

@ -4,9 +4,9 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -577,9 +577,13 @@ else {
'action' => '' 'action' => ''
), '', $varlink); ), '', $varlink);
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans('Export') . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
} else {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print ' print '
<script type="text/javascript"> <script type="text/javascript">

View File

@ -426,12 +426,12 @@ if ($action == 'export_csv') {
)); ));
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) { if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>'; print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
} else { } else {
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
} }
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print ' print '
<script type="text/javascript"> <script type="text/javascript">

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2014 Rapha<EFBFBD>l Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -24,9 +24,9 @@
*/ */
/** /**
* \file htdocs/accountancy/journal/sellsjournal.php * \file htdocs/accountancy/journal/sellsjournal.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief Page with sells journal * \brief Page with sells journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -444,12 +444,12 @@ if ($action == 'export_csv') {
)); ));
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) { if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>'; print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
} else { } else {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
} }
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print ' print '
<script type="text/javascript"> <script type="text/javascript">

View File

@ -83,147 +83,17 @@ if ($action == 'update' && empty($_POST["cancel"]))
} }
/* // Actions to send emails
* Add file in email form $id=0;
*/ $actiontypecode='';
if (GETPOST('addfile') || GETPOST('addfilehtml')) $trigger_name='';
{ $paramname='id';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $mode='emailfortest';
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Set tmp user directory if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';
$vardir=$conf->user->dir_output."/".$user->id; if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml';
$upload_dir = $vardir.'/temp';
dol_add_file_process($upload_dir,0,0);
if ($_POST['addfile']) $action='test';
if ($_POST['addfilehtml']) $action='testhtml';
}
/*
* Remove file in email form
*/
if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
{
// Set tmp user directory
$vardir=$conf->user->dir_output."/".$user->id;
$upload_dir = $vardir.'/temp';
$keytodelete=isset($_POST['removedfile'])?$_POST['removedfile']:$_POST['removedfilehtml'];
$keytodelete--;
$listofpaths=array();
$listofnames=array();
$listofmimes=array();
if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]);
if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]);
if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]);
if ($keytodelete >= 0)
{
$pathtodelete=$listofpaths[$keytodelete];
$filetodelete=$listofnames[$keytodelete];
$result = dol_delete_file($pathtodelete,1);
if ($result)
{
setEventMessages(array($langs->trans("FileWasRemoved"), $filetodelete), null, 'mesgs');
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->remove_attached_files($keytodelete);
}
}
if ($_POST['removedfile'] || $action='send') $action='test';
if ($_POST['removedfilehtml'] || $action='sendhtml') $action='testhtml';
}
/*
* Send mail
*/
if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GETPOST('addfilehtml') && ! GETPOST('removedfile') && ! GETPOST('cancel'))
{
$error=0;
$email_from='';
if (! empty($_POST["fromname"])) $email_from=$_POST["fromname"].' ';
if (! empty($_POST["frommail"])) $email_from.='<'.$_POST["frommail"].'>';
$errors_to = $_POST["errorstomail"];
$sendto = $_POST["sendto"];
$sendtocc = $_POST["sendtocc"];
$sendtoccc = $_POST["sendtoccc"];
$subject = $_POST['subject'];
$body = $_POST['message'];
$deliveryreceipt= $_POST["deliveryreceipt"];
$trackid = GETPOST('trackid');
//Check if we have to decode HTML
if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401))) {
$body=dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401);
}
// 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'];
if (empty($_POST["frommail"]))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom")), null, 'errors');
$action='test';
$error++;
}
if (empty($sendto))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTo")), null, 'errors');
$action='test';
$error++;
}
if (! $error)
{
// Is the message in HTML?
$msgishtml=0; // Message is not HTML
if ($action == 'sendhtml') $msgishtml=1; // Force message to HTML
// Pratique les substitutions sur le sujet et message
$subject=make_substitutions($subject,$substitutionarrayfortest);
$body=make_substitutions($body,$substitutionarrayfortest);
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile(
$subject,
$sendto,
$email_from,
$body,
$filepath,
$mimetype,
$filename,
$sendtocc,
$sendtoccc,
$deliveryreceipt,
$msgishtml,
$errors_to,
'',
$trackid
);
$result=$mailfile->sendfile();
if ($result)
{
setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, null, 'errors');
}
$action='';
}
}
@ -747,7 +617,7 @@ else
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->trackid='test'; $formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
$formmail->withfromreadonly=0; $formmail->withfromreadonly=0;
$formmail->withsubstit=0; $formmail->withsubstit=0;
$formmail->withfrom=1; $formmail->withfrom=1;
@ -767,7 +637,7 @@ else
// Tableau des substitutions // Tableau des substitutions
$formmail->substit=$substitutionarrayfortest; $formmail->substit=$substitutionarrayfortest;
// Tableau des parametres complementaires du post // Tableau des parametres complementaires du post
$formmail->param["action"]=($action == 'testhtml'?"sendhtml":"send"); $formmail->param["action"]="send";
$formmail->param["models"]="body"; $formmail->param["models"]="body";
$formmail->param["mailid"]=0; $formmail->param["mailid"]=0;
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"]; $formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
@ -778,7 +648,7 @@ else
$formmail->clear_attached_files(); $formmail->clear_attached_files();
} }
print $formmail->get_form(($action == 'testhtml'?'addfilehtml':'addfile'),($action == 'testhtml'?'removefilehtml':'removefile')); print $formmail->get_form('addfile','removefile');
print '<br>'; print '<br>';
} }

View File

@ -277,7 +277,8 @@ $sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'"; $sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'";
$sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'"; $sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'";
$sql.= " AND localtaxtype=".$localTaxType; $sql.= " AND localtaxtype=".$localTaxType;
$sql.= " GROUP BY dm ASC ORDER BY dm ASC"; $sql.= " GROUP BY dm";
$sql.= " ORDER BY dm ASC";
pt($db, $sql,$langs->trans("Year")." $y"); pt($db, $sql,$langs->trans("Year")." $y");

View File

@ -21,11 +21,13 @@
* \brief Code for actions on sending mails from object page * \brief Code for actions on sending mails from object page
*/ */
// $mysoc must be defined
// $id must be defined // $id must be defined
// $actiontypecode must be defined // $actiontypecode must be defined
// $paramname must be defined // $paramname must be defined
// $mode must be defined // $mode must be defined
// $object and $uobject may be defined.
/* /*
* Add file in email form * Add file in email form
@ -107,51 +109,55 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$subject='';$actionmsg='';$actionmsg2=''; $subject='';$actionmsg='';$actionmsg2='';
$result=$object->fetch($id); if (is_object($object))
$sendtosocid=0;
if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe')
{ {
$result=$object->fetch_thirdparty(); $result=$object->fetch($id);
$thirdparty=$object->thirdparty;
$sendtosocid=$thirdparty->id; $sendtosocid=0;
if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe')
{
$result=$object->fetch_thirdparty();
$thirdparty=$object->thirdparty;
$sendtosocid=$thirdparty->id;
}
else if ($object->element == 'societe')
{
$thirdparty=$object;
if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
elseif($conf->dolimail->enabled)
{
$dolimail = new Dolimail($db);
$possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1");
$possibleuser=$dolimail->get_from_user_by_mail($_POST['sendto'],"1"); // suche in llx_societe and socpeople
if (!$possibleaccounts && !$possibleuser)
{
setEventMessages($langs->trans('ErrorFailedToFindSocieteRecord',$_POST['sendto']), null, 'errors');
}
elseif (count($possibleaccounts)>1)
{
$sendtosocid=$possibleaccounts[1]['id'];
$result=$object->fetch($sendtosocid);
setEventMessages($langs->trans('ErrorFoundMoreThanOneRecordWithEmail',$_POST['sendto'],$object->name), null, 'mesgs');
}
else
{
if($possibleaccounts){
$sendtosocid=$possibleaccounts[1]['id'];
$result=$object->fetch($sendtosocid);
}elseif($possibleuser){
$sendtosocid=$possibleuser[0]['id'];
$result=$uobject->fetch($sendtosocid);
$object=$uobject;
}
}
}
}
else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported');
} }
else if ($object->element == 'societe') else $thirdparty = $mysoc;
{
$thirdparty=$object;
if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
elseif($conf->dolimail->enabled)
{
$dolimail = new Dolimail($db);
$possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1");
$possibleuser=$dolimail->get_from_user_by_mail($_POST['sendto'],"1"); // suche in llx_societe and socpeople
if (!$possibleaccounts && !$possibleuser)
{
setEventMessages($langs->trans('ErrorFailedToFindSocieteRecord',$_POST['sendto']), null, 'errors');
}
elseif (count($possibleaccounts)>1)
{
$sendtosocid=$possibleaccounts[1]['id'];
$result=$object->fetch($sendtosocid);
setEventMessages($langs->trans('ErrorFoundMoreThanOneRecordWithEmail',$_POST['sendto'],$object->name), null, 'mesgs');
}
else
{
if($possibleaccounts){
$sendtosocid=$possibleaccounts[1]['id'];
$result=$object->fetch($sendtosocid);
}elseif($possibleuser){
$sendtosocid=$possibleuser[0]['id'];
$result=$uobject->fetch($sendtosocid);
$object=$uobject;
}
}
}
}
else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported');
if ($result > 0) if ($result > 0)
{ {
@ -325,7 +331,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++; $errors=$interface->errors;
} }
// End call of triggers // End call of triggers
@ -339,8 +345,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// This avoid sending mail twice if going out and then back to page // This avoid sending mail twice if going out and then back to page
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
setEventMessages($mesg, null, 'mesgs'); setEventMessages($mesg, null, 'mesgs');
if($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val); if ($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id); else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id);
exit; exit;
} }
} }

View File

@ -209,7 +209,7 @@ abstract class CommonDocGenerator
{ {
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key],0,$outputlangs,0,0,-1,$conf->currency); $object->array_options['options_'.$key] = price($object->array_options['options_'.$key],0,$outputlangs,0,0,-1,$conf->currency);
} }
else if($extrafields->attribute_type[$key] == 'select') else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
{ {
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
} }
@ -280,7 +280,7 @@ abstract class CommonDocGenerator
{ {
$object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency); $object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
} }
elseif($extrafields->attribute_type[$key] == 'select') elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
{ {
$object->array_options['options_' . $key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_' . $key]]; $object->array_options['options_' . $key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_' . $key]];
} }
@ -576,7 +576,7 @@ abstract class CommonDocGenerator
//Add value to store price with currency //Add value to store price with currency
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency'])); $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
} }
else if($extrafields->attribute_type[$key] == 'select') else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
{ {
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
} }

View File

@ -269,6 +269,7 @@ class FormMail extends Form
$listofnames=array(); $listofnames=array();
$listofmimes=array(); $listofmimes=array();
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]); if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]);

View File

@ -1140,7 +1140,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false)
* "%d %b %Y", * "%d %b %Y",
* "%d/%m/%Y %H:%M", * "%d/%m/%Y %H:%M",
* "%d/%m/%Y %H:%M:%S", * "%d/%m/%Y %H:%M:%S",
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc" * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat"
* @param string $tzoutput true or 'gmt' => string is for Greenwich location * @param string $tzoutput true or 'gmt' => string is for Greenwich location
* false or 'tzserver' => output string is for local PHP server TZ usage * false or 'tzserver' => output string is for local PHP server TZ usage
* 'tzuser' => output string is for user TZ (current browser TZ with current dst) * 'tzuser' => output string is for user TZ (current browser TZ with current dst)
@ -5450,7 +5450,7 @@ function printCommonFooter($zone='private')
print 'window.console && console.log("'; print 'window.console && console.log("';
if (! empty($conf->global->MEMCACHED_SERVER)) print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - '; if (! empty($conf->global->MEMCACHED_SERVER)) print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - ';
print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off'); print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off');
if ($micro_start_time) if (! empty($micro_start_time)) // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in global variable.
{ {
$micro_end_time = microtime(true); $micro_end_time = microtime(true);
print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms'; print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';

View File

@ -49,6 +49,7 @@ $action=GETPOST('action','alpha');
$cancel=GETPOST('cancel'); $cancel=GETPOST('cancel');
$amount=GETPOST('amount'); $amount=GETPOST('amount');
$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$projectid=GETPOST('projectid')?GETPOST('projectid','int'):GETPOST("fk_projet",'int');
$object = new Don($db); $object = new Don($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
@ -169,9 +170,10 @@ if ($action == 'add')
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
if ($object->create($user) > 0) $res = $object->create($user);
if ($res > 0)
{ {
header("Location: index.php"); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
exit; exit;
} }
else else
@ -365,7 +367,7 @@ if ($action == 'create')
$formproject=new FormProjets($db); $formproject=new FormProjets($db);
print "<tr><td>".$langs->trans("Project")."</td><td>"; print "<tr><td>".$langs->trans("Project")."</td><td>";
$formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 0, 1, 1); $formproject->select_projects(-1, $projectid,'fk_projet', 0, 0, 1, 1);
print "</td></tr>\n"; print "</td></tr>\n";
} }

View File

@ -70,11 +70,11 @@ ListOfTasks=List of tasks
GoToListOfTimeConsumed=Go to list of time consumed GoToListOfTimeConsumed=Go to list of time consumed
GoToListOfTasks=Go to list of tasks GoToListOfTasks=Go to list of tasks
ListProposalsAssociatedProject=List of the commercial proposals associated with the project ListProposalsAssociatedProject=List of the commercial proposals associated with the project
ListOrdersAssociatedProject=List of customer's orders associated with the project ListOrdersAssociatedProject=List of customer orders associated with the project
ListInvoicesAssociatedProject=List of customer's invoices associated with the project ListInvoicesAssociatedProject=List of customer invoices associated with the project
ListPredefinedInvoicesAssociatedProject=List of customer's template invoices associated with project ListPredefinedInvoicesAssociatedProject=List of customer template invoices associated with project
ListSupplierOrdersAssociatedProject=List of supplier's orders associated with the project ListSupplierOrdersAssociatedProject=List of supplier orders associated with the project
ListSupplierInvoicesAssociatedProject=List of supplier's invoices associated with the project ListSupplierInvoicesAssociatedProject=List of supplier invoices associated with the project
ListContractAssociatedProject=List of contracts associated with the project ListContractAssociatedProject=List of contracts associated with the project
ListFichinterAssociatedProject=List of interventions associated with the project ListFichinterAssociatedProject=List of interventions associated with the project
ListExpenseReportsAssociatedProject=List of expense reports associated with the project ListExpenseReportsAssociatedProject=List of expense reports associated with the project

View File

@ -630,15 +630,16 @@ foreach ($listofreferent as $key => $value)
print load_fiche_titre($langs->trans($title), $addform, ''); print load_fiche_titre($langs->trans($title), $addform, '');
print "\n".'<!-- Table for tablename = '.$tablename.' -->'."\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Remove link // Remove link
print '<td style="width: 24px"></td>'; print '<td style="width: 24px"></td>';
// Ref // Ref
print '<td style="width: 200px">'.$langs->trans("Ref").'</td>'; print '<td'.(($tablename != 'actioncomm' && $tablename != 'projet_task') ? ' style="width: 200px"':'').'>'.$langs->trans("Ref").'</td>';
// Date // Date
print '<td width="100" align="center">'; print '<td'.(($tablename != 'actioncomm' && $tablename != 'projet_task') ? ' style="width: 200px"':'').' align="center">';
if (! in_array($tablename, array('projet_task'))) print $langs->trans("Date"); if (! in_array($tablename, array('projet_task'))) print $langs->trans("Date");
print '</td>'; print '</td>';
// Thirdparty or user // Thirdparty or user
@ -767,16 +768,33 @@ foreach ($listofreferent as $key => $value)
print "</td>\n"; print "</td>\n";
// Date // Date
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') $date=$element->date_commande; $date='';
elseif ($tablename == 'projet_task') $date=''; // We show no date. Showing date of beginning of task make user think it is date of time consumed if ($tablename == 'expensereport_det') $date = $element->date; // No draft status on lines
else elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status))
{ {
$date=$element->date; if ($tablename=='don') $date = $element->datedon;
if (empty($date)) $date=$element->datep; if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
if (empty($date)) $date=$element->date_contrat; {
if (empty($date)) $date=$element->datev; //Fiche inter $date=($element->date_commande?$element->date_commande:$element->date_valid);
}
elseif ($tablename == 'supplier_proposal') $date=$element->date_validation; // There is no other date for this
elseif ($tablename == 'fichinter') $date=$element->datev; // There is no other date for this
elseif ($tablename == 'projet_task') $date=''; // We show no date. Showing date of beginning of task make user think it is date of time consumed
else
{
$date=$element->date; // invoice, ...
if (empty($date)) $date=$element->date_contrat;
if (empty($date)) $date=$element->datev;
}
} }
print '<td align="center">'.dol_print_date($date,'day').'</td>'; print '<td align="center">';
if ($tablename == 'actioncomm')
{
print dol_print_date($element->datep,'dayhour');
if ($element->datef && $element->datef > $element->datep) print " - ".dol_print_date($element->datef,'dayhour');
}
else print dol_print_date($date,'day');
print '</td>';
// Third party or user // Third party or user
print '<td align="left">'; print '<td align="left">';