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

View File

@ -1,10 +1,11 @@
<?php
/*
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
* 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
*/
/**
@ -157,7 +160,7 @@ class AccountancyExport
*/
public function exportNormal($objectLines) {
global $conf;
foreach ( $objectLines as $line ) {
// Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
@ -182,15 +185,16 @@ class AccountancyExport
public function exportCegid($objectLines) {
foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y');
$separator = ";";
print $date . $this->separator;
print $line->code_journal . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print ' ' . $this->separator;
print $line->sens . $this->separator;
print price($line->montant) . $this->separator;
print dol_trunc($line->label_compte, 32) . $this->separator;
print $line->doc_ref . $this->separator;
print $date . $separator;
print $line->code_journal . $separator;
print length_accountg($line->numero_compte) . $separator;
print length_accounta($line->code_tiers) . $separator;
print $line->sens . $separator;
print price($line->montant) . $separator;
print $line->label_compte . $separator;
print $line->doc_ref;
print $this->end_line;
}
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -103,13 +103,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
if (is_array($changeaccount) && count($changeaccount) > 0) {
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l";
$sql1 .= " SET l.fk_code_ventilation=" . $account_parent;
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
dol_syslog('accountancy/customer/lines.php::changeaccount sql= ' . $sql1);
$resql1 = $db->query($sql1);
if (! $resql1) {
@ -223,7 +223,7 @@ $result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
$param = "";
if ($search_invoice)
$param .= "&search_invoice=" . $search_invoice;
@ -242,17 +242,17 @@ if ($result) {
if ($search_tvaintra)
$param .= "&search_tvaintra=" . $search_tvaintra;
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords);
print '<td align="left"><b>' . $langs->trans("DescVentilDoneCustomer") . '</b></td>';
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
print '<table class="noborder" width="100%">';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account($account_parent, 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '"/></div>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
@ -265,7 +265,7 @@ if ($result) {
print_liste_field_titre($langs->trans("IntracommunityVATNumber"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
@ -279,22 +279,22 @@ if ($result) {
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print "</td></tr>\n";
$facture_static = new Facture($db);
$product_static = new Product($db);
$var = True;
while ( $objp = $db->fetch_object($result) ) {
$var = ! $var;
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
print '<tr'. $bc[$var].'>';
// Ref Invoice
$facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid;
$facture_static->id = $objp->rowid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
// Ref Product
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
@ -305,7 +305,7 @@ if ($result) {
else
print '&nbsp;';
print '</td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
@ -316,7 +316,7 @@ if ($result) {
print '<td align="right">' . $objp->country .'</td>';
print '<td align="center">' . $objp->tva_intra . '</td>';
print '<td align="center"><input type="checkbox" name="changeaccount[]" value="' . $objp->fdid . '"/></td>';
print "</tr>";
$i ++;
}

View File

@ -4,9 +4,9 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* 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 Olivier Geffroy <jeff@jeffinfo.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 Olivier Geffroy <jeff@jeffinfo.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -424,7 +424,7 @@ if ($action == 'export_csv') {
}
if ($reflabel == '(CustomerInvoicePayment)') {
$reflabel = $langs->trans('Customer');
}
}
if ($reflabel == '(SocialContributionPayment)') {
$reflabel = $langs->trans('SocialContribution');
}
@ -577,9 +577,13 @@ else {
'action' => ''
), '', $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 '
<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) {
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 {
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 '
<script type="text/javascript">

View File

@ -7,7 +7,7 @@
* 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 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
* it under the terms of the GNU General Public License as published by
@ -24,9 +24,9 @@
*/
/**
* \file htdocs/accountancy/journal/sellsjournal.php
* \ingroup Advanced accountancy
* \brief Page with sells journal
* \file htdocs/accountancy/journal/sellsjournal.php
* \ingroup Advanced accountancy
* \brief Page with sells journal
*/
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) {
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 {
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 '
<script type="text/javascript">

View File

@ -83,147 +83,17 @@ if ($action == 'update' && empty($_POST["cancel"]))
}
/*
* Add file in email form
*/
if (GETPOST('addfile') || GETPOST('addfilehtml'))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Actions to send emails
$id=0;
$actiontypecode='';
$trigger_name='';
$paramname='id';
$mode='emailfortest';
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Set tmp user directory
$vardir=$conf->user->dir_output."/".$user->id;
$upload_dir = $vardir.'/temp';
dol_add_file_process($upload_dir,0,0);
if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml';
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->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->trackid='test';
$formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
$formmail->withfromreadonly=0;
$formmail->withsubstit=0;
$formmail->withfrom=1;
@ -767,7 +637,7 @@ else
// Tableau des substitutions
$formmail->substit=$substitutionarrayfortest;
// Tableau des parametres complementaires du post
$formmail->param["action"]=($action == 'testhtml'?"sendhtml":"send");
$formmail->param["action"]="send";
$formmail->param["models"]="body";
$formmail->param["mailid"]=0;
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
@ -778,7 +648,7 @@ else
$formmail->clear_attached_files();
}
print $formmail->get_form(($action == 'testhtml'?'addfilehtml':'addfile'),($action == 'testhtml'?'removefilehtml':'removefile'));
print $formmail->get_form('addfile','removefile');
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_last_day($y,12,false))."'";
$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");

View File

@ -21,11 +21,13 @@
* \brief Code for actions on sending mails from object page
*/
// $mysoc must be defined
// $id must be defined
// $actiontypecode must be defined
// $paramname must be defined
// $mode must be defined
// $object and $uobject may be defined.
/*
* Add file in email form
@ -86,11 +88,11 @@ if (GETPOST('removAll'))
{
$pathtodelete = $value;
$filetodelete = $listofnames[$key];
$result = dol_delete_file($pathtodelete,1); // Delete uploded Files
$result = dol_delete_file($pathtodelete,1); // Delete uploded Files
$langs->load("other");
setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs');
$formmail->remove_attached_files($key); // Update Session
}
}
@ -107,51 +109,55 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$subject='';$actionmsg='';$actionmsg2='';
$result=$object->fetch($id);
$sendtosocid=0;
if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe')
if (is_object($object))
{
$result=$object->fetch_thirdparty();
$thirdparty=$object->thirdparty;
$sendtosocid=$thirdparty->id;
$result=$object->fetch($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')
{
$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 $thirdparty = $mysoc;
if ($result > 0)
{
@ -247,35 +253,35 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$mailboxconfig = new IMAP($db);
$mailboxconfig->fetch($mbid);
if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
$mailboxconfig->folder_id=$mailboxconfig->mailbox_imap_outbox;
$mailboxconfig->userfolder_fetch();
if ($mailboxconfig->mailbox_save_sent_mails == 1)
{
$folder=str_replace($ref, '', $mailboxconfig->folder_cache_key);
if (!$folder) $folder = "Sent"; // Default Sent folder
$mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password);
if (FALSE === $mailboxconfig->mbox)
if (FALSE === $mailboxconfig->mbox)
{
$info = FALSE;
$err = $langs->trans('Error3_Imap_Connection_Error');
setEventMessages($err,$mailboxconfig->element, null, 'errors');
}
else
}
else
{
$mailboxconfig->mailboxid=$_POST['frommail'];
$mailboxconfig->foldername=$folder;
$from = $mailfromid[0] . $mailfromid[2];
$imap=1;
}
}
}
}
}
// Send mail
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
@ -290,7 +296,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($result)
{
$error=0;
// FIXME This must be moved into a trigger for action $trigger_name
if (! empty($conf->dolimail->enabled))
{
@ -301,13 +307,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$dolimail=new DoliMail($db);
$dolimail->id = $mid;
$res=$dolimail->set_prop($user, 'answered',1);
}
}
if ($imap==1)
{
// write mail to IMAP Server
$movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile);
$movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile);
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
}
}
@ -325,7 +331,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$interface=new Interfaces($db);
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
$error++; $errors=$interface->errors;
}
// 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
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
setEventMessages($mesg, null, 'mesgs');
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);
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);
exit;
}
}

View File

@ -35,8 +35,8 @@ abstract class CommonDocGenerator
{
var $error='';
protected $db;
/**
* Constructor
*
@ -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);
}
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]];
}
@ -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);
}
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]];
}
@ -389,7 +389,7 @@ abstract class CommonDocGenerator
// Add vat by rates
foreach ($object->lines as $line)
{
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
@ -576,12 +576,12 @@ abstract class CommonDocGenerator
//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']));
}
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]];
}
else if($extrafields->attribute_type[$key] == 'date')
{
{
if (strlen($object->array_options['options_'.$key])>0)
{
$object->array_options['options_'.$key] = dol_print_date($object->array_options['options_'.$key],'day'); // using company output language

View File

@ -269,6 +269,7 @@ class FormMail extends Form
$listofnames=array();
$listofmimes=array();
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$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/%m/%Y %H:%M",
* "%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
* 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)
@ -5450,7 +5450,7 @@ function printCommonFooter($zone='private')
print 'window.console && console.log("';
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');
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);
print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';

View File

@ -49,7 +49,8 @@ $action=GETPOST('action','alpha');
$cancel=GETPOST('cancel');
$amount=GETPOST('amount');
$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);
$extrafields = new ExtraFields($db);
@ -169,9 +170,10 @@ if ($action == 'add')
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
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;
}
else
@ -365,7 +367,7 @@ if ($action == 'create')
$formproject=new FormProjets($db);
print "<tr><td>".$langs->trans("Project")."</td><td>";
$formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 0, 1, 1);
$formproject->select_projects(-1, $projectid,'fk_projet', 0, 0, 1, 1);
print "</td></tr>\n";
}

View File

@ -70,11 +70,11 @@ ListOfTasks=List of tasks
GoToListOfTimeConsumed=Go to list of time consumed
GoToListOfTasks=Go to list of tasks
ListProposalsAssociatedProject=List of the commercial proposals associated with the project
ListOrdersAssociatedProject=List of customer's orders associated with the project
ListInvoicesAssociatedProject=List of customer's invoices associated with the project
ListPredefinedInvoicesAssociatedProject=List of customer's template invoices associated with project
ListSupplierOrdersAssociatedProject=List of supplier's orders associated with the project
ListSupplierInvoicesAssociatedProject=List of supplier's invoices associated with the project
ListOrdersAssociatedProject=List of customer orders associated with the project
ListInvoicesAssociatedProject=List of customer invoices associated with the project
ListPredefinedInvoicesAssociatedProject=List of customer template invoices associated with project
ListSupplierOrdersAssociatedProject=List of supplier orders associated with the project
ListSupplierInvoicesAssociatedProject=List of supplier invoices associated with the project
ListContractAssociatedProject=List of contracts associated with the project
ListFichinterAssociatedProject=List of interventions 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 "\n".'<!-- Table for tablename = '.$tablename.' -->'."\n";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
// Remove link
print '<td style="width: 24px"></td>';
// 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
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");
print '</td>';
// Thirdparty or user
@ -767,16 +768,33 @@ foreach ($listofreferent as $key => $value)
print "</td>\n";
// Date
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') $date=$element->date_commande;
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='';
if ($tablename == 'expensereport_det') $date = $element->date; // No draft status on lines
elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status))
{
$date=$element->date;
if (empty($date)) $date=$element->datep;
if (empty($date)) $date=$element->date_contrat;
if (empty($date)) $date=$element->datev; //Fiche inter
if ($tablename=='don') $date = $element->datedon;
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
{
$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
print '<td align="left">';