Merge branch 'develop' into new_branch_20_09_2018

This commit is contained in:
Philippe Grand 2018-09-21 10:12:48 +02:00 committed by GitHub
commit 239be3b58c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 818 additions and 115 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ dolibarr_install.log
upgrade.log
doxygen_warnings.log
/.project
/.vscode
.DS_Store
.idea
*.iml

View File

@ -25,6 +25,40 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 8.0.2 compared to 8.0.1 *****
FIX: #8452
FIX: #9043
FIX: #9316 Error when listing invoices
FIX: #9317
FIX: #9353 Bug: html error - div inside span on graphs
FIX: #9355
FIX: #9393 inconsistency behaviour. option FACTURE_ENABLE_NEGATIVE_LINES
FIX: #9394
FIX: #9396
FIX: #9403
FIX: #9412
FIX: #9497
FIX: Add paypal error message in alert email when online payment fails.
FIX: better compatibility with multicompany
FIX: capital must be empty and not 0 if undefined
FIX: character making error on bill list
FIX: Entering negative price on order.
FIX: Expedition not showing extrafields on creation.
FIX: Homepage links were using wrong topmenus
FIX: inconsistency behaviour on option FACTURE_ENABLE_NEGATIVE_LINES
FIX: invert mime type and name.
FIX: invoice popup hide localtax2 and 3 if not defined.
FIX: Lose filter on payment type or category after a sort on invoice list.
FIX: Maxi debug to allow to load chart of account with multicompany.
FIX: Missing translation in predefined email to membership renewal.
FIX: Mixing tickets of different thirdparties.
FIX: "Other ..." link so the "Back to" link works.
FIX: PDF address: handle when contact thirdparty is different from thirdparty of document
FIX: Problems with permissions of module to record payment of salaries
FIX: remove debug
FIX: Several fixes on the management of minimal amount for orders
FIX: wrong var name
***** ChangeLog for 8.0.1 compared to 8.0.0 *****
FIX: #9258
FIX: #9328

View File

@ -846,6 +846,8 @@ if ($mode == 'common')
dol_fiche_end();
print '<br>';
// Show warning about external users
print info_admin(showModulesExludedForExternal($modules))."\n";

View File

@ -156,7 +156,8 @@ $i=0;
foreach($_SESSION as $key => $val)
{
if ($i > 0) print ', ';
print $key.' => '.dol_escape_htmltag($val);
if (is_array($val)) print $key.' => array(...)';
else print $key.' => '.dol_escape_htmltag($val);
$i++;
}
print '</td></tr>'."\n";

View File

@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -251,6 +252,19 @@ if ($action == 'add')
}
}
$object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0;
$taskid = GETPOST('taskid','int');
if(!empty($taskid)){
$taskProject = new Task($db);
if($taskProject->fetch($taskid)>0){
$object->fk_project = $taskProject->fk_project;
}
$object->fk_element = $taskid;
$object->elementtype = 'task';
}
$object->datep = $datep;
$object->datef = $datef;
$object->percentage = $percentage;
@ -876,11 +890,38 @@ if ($action == 'create')
{
// Projet associe
$langs->load("projects");
$projectid = GETPOST('projectid', 'int');
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td id="project-input-container" >';
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), GETPOST("projectid")?GETPOST("projectid"):'', 'projectid', 0, 0, 1, 1);
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
$urloption='?action=create';
$url = dol_buildpath('comm/action/card.php',2).$urloption;
// update task list
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$("#projectid").change(function () {
var url = "'.$url.'&projectid="+$("#projectid").val();
$.get(url, function(data) {
console.log($( data ).find("#taskid").html());
if (data) $("#taskid").html( $( data ).find("#taskid").html() ).select2();
})
});
})';
print '</script>'."\n";
print '</td></tr>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Task").'</td><td id="project-task-input-container" >';
$projectsListId=false;
if(!empty($projectid)){ $projectsListId=$projectid; }
$tid=GETPOST("projecttaskid")?GETPOST("projecttaskid"):'';
$formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500',$projectsListId);
print '</td></tr>';
}
if (!empty($origin) && !empty($originid))
@ -1270,10 +1311,41 @@ if ($id > 0)
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print '<tr>';
print '<td>'.$langs->trans("LinkedObject").'</td>';
print '<td>'.dolGetElementUrl($object->fk_element,$object->elementtype,1);
print '<input type="hidden" name="fk_element" value="'.$object->fk_element.'">';
print '<input type="hidden" name="elementtype" value="'.$object->elementtype.'">';
print '</td>';
if ($object->elementtype == 'task' && ! empty($conf->projet->enabled))
{
print '<td id="project-task-input-container" >';
$urloption='?action=create'; // we use create not edit for more flexibility
$url = DOL_URL_ROOT.'/comm/action/card.php'.$urloption;
// update task list
print "\n".'<script type="text/javascript" >';
print '$(document).ready(function () {
$("#projectid").change(function () {
var url = "'.$url.'&projectid="+$("#projectid").val();
$.get(url, function(data) {
console.log($( data ).find("#fk_element").html());
if (data) $("#fk_element").html( $( data ).find("#taskid").html() ).select2();
})
});
})';
print '</script>'."\n";
$formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $object->fk_element, 'fk_element', 24, 0, 0, 1, 0, 0, 'maxwidth500',$object->fk_project);
print '<input type="hidden" name="elementtype" value="'.$object->elementtype.'">';
print '</td>';
}
else
{
print '<td>';
print dolGetElementUrl($object->fk_element,$object->elementtype,1);
print '<input type="hidden" name="fk_element" value="'.$object->fk_element.'">';
print '<input type="hidden" name="elementtype" value="'.$object->elementtype.'">';
print '</td>';
}
print '</tr>';
}

View File

@ -666,6 +666,8 @@ if ($object->id > 0)
*/
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$langs->load("propal");
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
$sql.= ", p.tva as total_tva";
$sql.= ", p.total as total_ttc";
@ -674,7 +676,7 @@ if ($object->id > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
$sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
$sql.= " AND s.rowid = ".$object->id;
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND p.entity IN (".getEntity('propal').")";
$sql.= " ORDER BY p.datep DESC";
$resql=$db->query($sql);

View File

@ -13,6 +13,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
@ -1032,6 +1033,7 @@ class Propal extends CommonObject
// Add linked object (deprecated, use ->linkedObjectsIds instead)
if (! $error && $this->origin && $this->origin_id)
{
dol_syslog('Deprecated use of linked object, use ->linkedObjectsIds instead', LOG_WARNING);
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
@ -1104,13 +1106,6 @@ class Propal extends CommonObject
}
}
// Add linked object
if (! $error && $this->origin && $this->origin_id)
{
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
// Set delivery address
if (! $error && $this->fk_delivery_address)
{

View File

@ -0,0 +1,310 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Pierre-Henry Favre <support@atm-consulting.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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/recap-compta.php
* \ingroup compta
* \brief Page de fiche recap customer
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
restrictedArea($user,'banque');
$langs->load("companies");
if (! empty($conf->facture->enabled)) $langs->load("bills");
$date_start =GETPOST('date_start','alpha');
$date_startDay= GETPOST('date_startday','int');
$date_startMonth= GETPOST('date_startmonth','int');
$date_startYear= GETPOST('date_startyear','int');
$date_start=($date_startDay)?dol_mktime(0,0,0,$date_startMonth,$date_startDay,$date_startYear):strtotime($date_start);
$date_stop =GETPOST('date_stop','alpha');
$date_stopDay= GETPOST('date_stopday','int');
$date_stopMonth= GETPOST('date_stopmonth','int');
$date_stopYear= GETPOST('date_stopyear','int');
//FIXME doldate
$date_stop=($date_stopDay)?dol_mktime(0,0,0,$date_stopMonth,$date_stopDay,$date_stopYear):strtotime($date_stop);
$action =GETPOST('action','alpha');
// Security check
//if ($user->societe_id) $id=$user->societe_id;
//$result = restrictedArea($user, 'societe', $id, '&societe');
//$object = new Societe($db);
//if ($id > 0) $object->fetch($id);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('comptafilescard','globalcard'));
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="f.datef,f.rowid"; // Set here default search field
if (! $sortorder) $sortorder="DESC";
$arrayfields=array(
'date'=>array('label'=>"Date", 'checked'=>1),
//...
);
/*
* Actions
*/
//$parameters = array('socid' => $id);
//$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks
//if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
/*
* Fetch the lines/files from db /
*/
$filesarray=array();
$result=false;
if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){
$wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
$sql="SELECT rowid as id, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
$sql.=" WHERE datef between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn";
$sql.=" WHERE datef between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,ref,paid,total_ttc,fk_user_author as fk_soc,date_fin as date,'Expense' as item FROM ".MAIN_DB_PREFIX."expensereport";
$sql.=" WHERE date_fin between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,ref,paid,amount as total_ttc,CONCAT(firstname,' ',lastname) as fk_soc,datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don";
$sql.=" WHERE datedon between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,label as ref,1 as paid,amount as total_ttc,fk_user as fk_soc,datep as date,'Salary' as item FROM ".MAIN_DB_PREFIX."payment_salary";
$sql.=" WHERE datep between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,num_paiement as ref,1 as paid,amount as total_ttc,fk_charge as fk_soc,datep as date,'Charge' as item FROM ".MAIN_DB_PREFIX."paiementcharge";
$sql.=" WHERE datep between ".$wheretail;
$resd = $db->query($sql);
$files=array();
$link='';
if ($resd)
{
$numd = $db->num_rows($resd);
$upload_dir ='';
$i=0;
while($i<$numd)
{
$objd = $db->fetch_object($resd);
switch($objd->item){
case "Invoice":
$subdir=dol_sanitizeFileName($objd->ref);
$upload_dir = $conf->facture->dir_output.'/'.$subdir;
$link="../../document.php?modulepart=facture&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "InvoiceSupplier":
$subdir=get_exdir($objd->id,2,0,0,$objd,'invoice_supplier').dol_sanitizeFileName($objd->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir;
$link="../../document.php?modulepart=facture_fournisseur&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "Expense":
$subdir=dol_sanitizeFileName($objd->ref);
$upload_dir = $conf->expensereport->dir_output.'/'.$subdir;
$link="../../document.php?modulepart=expensereport&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "Salary":
$subdir=dol_sanitizeFileName($objd->id);
$upload_dir = $conf->salaries->dir_output.'/'.$subdir;
$link="../../document.php?modulepart=salaries&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "Donation":
$subdir=get_exdir(null,2,0,1,$objd,'donation'). '/'. dol_sanitizeFileName($objd->id);
$upload_dir = $conf->don->dir_output . '/' . $subdir;
$link="../../document.php?modulepart=don&file=".str_replace('/','%2F',$subdir).'%2F';
break;
case "Charge":
$subdir=dol_sanitizeFileName($objd->id);
$upload_dir = $conf->tax->dir_output . '/' . $subdir;
$link="../../document.php?modulepart=tax&file=".str_replace('/','%2F',$subdir).'%2F';
break;
default:
break;
}
if(!empty($upload_dir)){
$result=true;
$files=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','',SORT_ASC,1);
foreach ($files as $key => $file){
$file['date']=$db->idate($objd->date);
$file['paid']=$objd->paid;
$file['amount']=$objd->total_ttc;
$file['ref']=$objd->ref;
$file['fk']=$objd->fk_soc;
$file['item']=$objd->item;
$file['link']=$link.$file['name'];
$out.= '<br><a href="'.$link.$file['name'].'">'.$file['name'].'</a>';
$filesarray[]=$file;
}
if(count($files)<1){
$nofile['date']=$db->idate($objd->date);
$nofile['paid']=$objd->paid;
$nofile['amount']=$objd->total_ttc;
$nofile['ref']=$objd->ref;
$nofile['fk']=$objd->fk_soc;
$nofile['item']=$objd->item;
$filesarray[]=$nofile;
}
}
$i++;
}
}
$db->free($resd);
}
/*
* cleanup of old ZIP
*/
//FIXME
/*
*ZIP creation
*/
if($result & $action=="dl"){
unset($zip);
$log='date,type,ref,total,paid,filename,item_id'."\n";
$zipname = ($date_start)."-".($date_stop).'_export.zip';
$zip = new ZipArchive;
$res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE);
if ($res){
foreach ($filesarray as $key=> $file) {
if(file_exists($file["fullname"])) $zip->addFile($file["fullname"],$file["name"]);//
$log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n";
}
$zip->addFromString('log.csv', $log);
$zip->close();
///Then download the zipped file.
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.$zipname);
header('Content-Length: ' . filesize($zipname));
readfile($zipname);
unlink($zipname);
exit();
}
}
// None
/*
* View
*/
$form = new Form($db);
$userstatic=new User($db);
$title=$langs->trans("ComptaFiles").' - '.$langs->trans("List");
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary");
$help_url='EN:Module_Accounting|FR:Module_Compatibilite'; //FIXME
llxHeader('',$title,$help_url);
print '<div><form name="searchfiles" action="?action=searchfiles'.$tail.'" method="POST" >'."\n\t\t\t";
print '<a>'.$langs->trans("dateStart").': '.$form->select_date($date_start,'date_start',0,0,0,"",1,1,1)."\n</a>";
print '<a>'.$langs->trans("dateStop").': '.$form->select_date($date_stop,'date_stop',0,0,0,"",1,1,1)."\n</a>";
print '<input class="butAction" type="submit" value="Go" /></form></div>'."\n\t\t";
if (!empty($date_start) && !empty($date_stop))echo dol_print_date($date_start)." - ".dol_print_date($date_stop);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
//if (! empty($arrayfields['f.datef']['checked']))
print_liste_field_titre($arrayfields['date']['label'],$_SERVER["PHP_SELF"],"date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Ref").'</td>';
print '<td>'.$langs->trans("File").'</td>';
print '<td>'.$langs->trans("Paid").'</td>';
print '<td align="right">'.$langs->trans("Debit").'</td>';
print '<td align="right">'.$langs->trans("Credit").'</td>';
print '<td align="right">'.$langs->trans("Balance").'</td>';
print '</tr>';
if ($result)
{
$TData = dol_sort_array($filesarray, 'date', 'ASC');
if(empty($TData)) {
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td></tr>';
} else {
// Sort array by date ASC to calucalte balance
$totalDebit = 0;
$totalCredit = 0;
// Balance calculation
$balance = 0;
foreach($TData as &$data1) {
if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){
$data1['amount']=-$data1['amount'];
}
if ($data1['amount']>0){
}else{
}
$balance += $data1['amount'];
$data1['balance'] = $balance;
}
// Display array
foreach($TData as $data) {
$html_class = '';
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
print '<tr class="oddeven '.$html_class.'">';
print "<td align=\"center\">";
print dol_print_date($data['date'],'day');
print "</td>\n";
print '<td aling="left">'.$data['item'].'</td>';
print '<td aling="left">'.$data['ref'].'</td>';
print '<td> <a href='.$data['link'].">".$data['name']."</a></td>\n";
print '<td aling="left">'.$data['paid'].'</td>';
print '<td align="right">'.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."</td>\n";
$totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
print '<td align="right">'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."</td>\n";
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
// Balance
print '<td align="right">'.price($data['balance'])."</td>\n";
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="5">&nbsp;</td>';
print '<td align="right">'.price($totalDebit).'</td>';
print '<td align="right">'.price($totalCredit).'</td>';
print '<td align="right">'.price(price2num($totalDebit - $totalCredit, 'MT')).'</td>';
print '<td></td>';
print "</tr>\n";
}
}
print "</table>";
print '<form name="dl" action="?action=dl" method="POST" >'."\n\t\t\t";
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start,'dayxcard').'" />';
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
//print '<input type="hidden" name="date_stopDay" value="'.dol_print_date($date_stop, '%d').'" />';
//print '<input type="hidden" name="date_stopMonth" value="'.dol_print_date($date_stop, '%m').'" />';
//print '<input type="hidden" name="date_stopYear" value="'.dol_print_date($date_stop, '%Y').'" />';
//print '<input type="hidden" name="date_startDay" value="'.dol_print_date($date_start, '%d').'" />';
//print '<input type="hidden" name="date_startMonth" value="'.dol_print_date($date_start, '%m').'" />';
//print '<input type="hidden" name="date_startYear" value="'.dol_print_date($date_start, '%m').'" />';
print '<input class="butAction" type="submit" value="Download" /></form>'."\n\t\t</th>\n\t\t<th>\n\t\t\t";
llxFooter();
$db->close();

View File

@ -958,7 +958,7 @@ class FormMail extends Form
if (count($validpaymentmethod) > 0 && $paymenturl)
{
$langs->load('other');
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n',"\n",$langs->transnoentities("PredefinedMailContentLink", $paymenturl));
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl));
$this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl;
}
else

View File

@ -4175,13 +4175,13 @@ function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoi
* @param string $morehtmlright Added message to show on right
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param int $id To force an id on html objects
* @param string $id To force an id on html objects
* @param string $morecssontable More css on table
* @param string $morehtmlcenter Added message to show on center
* @return string
* @see print_barre_liste
*/
function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
{
global $conf;
@ -4191,7 +4191,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
$return.= "\n";
$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" class="centpercent notopnoleftnoright'.($morecssontable?' '.$morecssontable:'').'" style="margin-bottom: 2px;"><tr>';
if ($picto) $return.= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('',$picto, 'class="valignmiddle widthpictotitle" id="pictotitle"', $pictoisfullpath).'</td>';
if ($picto) $return.= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('',$picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>';
$return.= '<td class="nobordernopadding" valign="middle">';
$return.= '<div class="titre">'.$titre.'</div>';
$return.= '</td>';
@ -6110,7 +6110,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$paymenturl=$url;
}
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$outputlangs->trans("PredefinedMailContentLink", $paymenturl):'');
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)):'');
$substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl;
}
}

View File

@ -46,9 +46,9 @@ class doc_generic_order_odt extends ModelePDFCommandes
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -7,6 +7,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
@ -887,7 +888,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);

View File

@ -44,9 +44,9 @@ class doc_generic_contract_odt extends ModelePDFContract
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -47,9 +47,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -45,9 +45,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
public $emetteur; // Objet societe qui emet
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -8,6 +8,7 @@
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
@ -1117,7 +1118,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1);

View File

@ -86,49 +86,49 @@ class modBanque extends DolibarrModules
$r++;
$this->rights[$r][0] = 111; // id de la permission
$this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission
$this->rights[$r][1] = 'Read bank account and transactions';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire';
$r++;
$this->rights[$r][0] = 112; // id de la permission
$this->rights[$r][1] = 'Creer/modifier montant/supprimer ecriture bancaire'; // libelle de la permission
$this->rights[$r][1] = 'Creer/modifier montant/supprimer ecriture bancaire';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'modifier';
$r++;
$this->rights[$r][0] = 113; // id de la permission
$this->rights[$r][1] = 'Configurer les comptes bancaires (creer, gerer categories)'; // libelle de la permission
$this->rights[$r][1] = 'Configurer les comptes bancaires (creer, gerer categories)';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'configurer';
$r++;
$this->rights[$r][0] = 114; // id de la permission
$this->rights[$r][1] = 'Rapprocher les ecritures bancaires'; // libelle de la permission
$this->rights[$r][1] = 'Rapprocher les ecritures bancaires';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'consolidate';
$r++;
$this->rights[$r][0] = 115; // id de la permission
$this->rights[$r][1] = 'Exporter transactions et releves'; // libelle de la permission
$this->rights[$r][1] = 'Exporter transactions et releves';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'export';
$r++;
$this->rights[$r][0] = 116; // id de la permission
$this->rights[$r][1] = 'Virements entre comptes'; // libelle de la permission
$this->rights[$r][1] = 'Virements entre comptes';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'transfer';
$r++;
$this->rights[$r][0] = 117; // id de la permission
$this->rights[$r][1] = 'Gerer les envois de cheques'; // libelle de la permission
$this->rights[$r][1] = 'Gerer les envois de cheques';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'cheque';

View File

@ -50,7 +50,9 @@ class modSalaries extends DolibarrModules
$this->db = $db;
$this->numero = 510; // Perms from 501..519
$this->family = "compta";
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
// It is used to group modules by family in module setup page
$this->family = "financial";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -102,7 +102,7 @@ class modStripe extends DolibarrModules
'langs'=>'stripe', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>500,
'enabled'=>'$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->banque->consolidate', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'perms'=>'$user->rights->banque->modifier', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both
@ -117,8 +117,8 @@ class modStripe extends DolibarrModules
'url' => '',
'langs' => 'stripe',
'position' => 100,
'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 1',
'perms' => '$user->rights->banque->configurer',
'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
'perms' => '$user->rights->banque->lire',
'target' => '',
'user' => 0
);
@ -131,8 +131,8 @@ class modStripe extends DolibarrModules
'url' => '/stripe/charge.php',
'langs' => 'stripe',
'position' => 102,
'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2',
'perms' => '$user->rights->banque->configurer',
'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
'perms' => '$user->rights->banque->lire',
'target' => '',
'user' => 0
);
@ -145,8 +145,8 @@ class modStripe extends DolibarrModules
'url' => '/stripe/transaction.php',
'langs' => 'stripe',
'position' => 102,
'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2',
'perms' => '$user->rights->banque->configurer',
'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
'perms' => '$user->rights->banque->lire',
'target' => '',
'user' => 0
);

View File

@ -85,7 +85,20 @@ class modSyslog extends DolibarrModules
// Cronjobs
$this->cronjobs = array(
0=>array('label'=>'CompressSyslogs', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'compressSyslogs', 'parameters'=>'', 'comment'=>'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', 'frequency'=>1, 'unitfrequency'=> 3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>true),
0 => array(
'label' => 'CompressSyslogs',
'jobtype' => 'method',
'class' => 'core/class/utils.class.php',
'objectname' => 'Utils',
'method' => 'compressSyslogs',
'parameters' => '',
'comment' => 'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group',
'frequency' => 1,
'unitfrequency' => 3600 * 24,
'priority' => 50,
'status' => 0,
'test' => true,
),
);
}
}

View File

@ -43,9 +43,9 @@ class doc_generic_product_odt extends ModelePDFProduct
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -61,9 +61,9 @@ class doc_generic_task_odt extends ModelePDFTask
public $emetteur; // Objet societe qui emet
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -44,9 +44,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales
public $emetteur; // Objet societe qui emet
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -7,6 +7,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
@ -1064,7 +1065,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);

View File

@ -43,9 +43,9 @@ class doc_generic_stock_odt extends ModelePDFStock
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
@ -648,7 +649,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + $object->remise), 0, 'R', 1);

View File

@ -5,6 +5,7 @@
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
@ -821,7 +822,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1);

View File

@ -44,9 +44,9 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -38,7 +38,7 @@ class mod_ticket_universal extends ModeleNumRefTicket
/**
* @var string Error code (or message)
*/
public $error = '';
public $error = '';
/**
* @var string Nom du modele

View File

@ -42,9 +42,9 @@ class doc_generic_user_odt extends ModelePDFUser
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -44,9 +44,9 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -24,34 +24,36 @@
* $parameters
* $cols
*/
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
if (! is_object($form)) $form=new Form($db);
?>
<!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php -->
<?php
if (! is_array($parameters)) $parameters = array();
if (! empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"';
if (! empty($cols)) $parameters['cols'] = $cols;
if (! empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc;
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
//var_dump($extrafields->attributes[$object->table_element]);
if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label']))
{
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
{
// Discard if extrafield is a hidden field on form
$enabled = 1;
if ($enabled && isset($extrafields->attributes[$object->table_element]['enabled'][$key]))
{
@ -74,7 +76,6 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
// Load language if required
if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
if ($action == 'edit_extras')
{
$value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]);
@ -96,6 +97,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
print '<td';
print ' class="';
//var_dump($action);exit;
if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired';
print '">';
if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key]));
@ -105,18 +107,15 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
//TODO Improve element and rights detection
//var_dump($user->rights);
$permok=false;
$keyforperm=$object->element;
if ($object->element == 'fichinter') $keyforperm='ficheinter';
if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write;
if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer;
if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer;
if ($object->element=='shipping') $permok=$user->rights->expedition->creer;
if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer;
if ($object->element=='productlot') $permok=$user->rights->stock->creer;
if ($object->element=='facturerec') $permok=$user->rights->facture->creer;
if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key]))
&& $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key)
&& empty($extrafields->attributes[$object->table_element]['computed'][$key]))
@ -129,6 +128,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
print '</td>';
$html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : '';
print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.'"'.($cols?' colspan="'.$cols.'"':'').'>';
// Convert date into timestamp format
@ -143,21 +143,19 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
//print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour');
$value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring;
}
//TODO Improve element and rights detection
if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key)
{
$fieldid='id';
if ($object->table_element == 'societe') $fieldid='socid';
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">';
print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id);
print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">';
print '</form>';
@ -167,6 +165,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
//print $key.'-'.$value.'-'.$object->table_element;
print $extrafields->showOutputField($key, $value, '', $object->table_element);
}
print '</td>';
print '</tr>' . "\n";
}
@ -203,11 +202,10 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
});
});
}
setListDependencies();
});
</script>'."\n";
}
}
?>
<!-- END PHP TEMPLATE extrafields_view.tpl.php -->
<!-- END PHP TEMPLATE extrafields_view.tpl.php -->

View File

@ -66,7 +66,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
?>
<?php $coldisplay=0; ?>
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
<tr id="row-<?php echo $line->id?> class="drag drop oddeven" <?php echo $domData; ?> >
<tr id="row-<?php echo $line->id?>" class="drag drop oddeven" <?php echo $domData; ?> >
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php } ?>

View File

@ -73,10 +73,10 @@ BoxProposalsPerMonth=Proposals per month
NoTooLowStockProducts=No products are under the low stock limit
BoxProductDistribution=Products/Services Distribution
BoxProductDistributionFor=Distribution of %s by %s
BoxTitleLastModifiedSupplierBills=Supplier Invoices: last %s modified
BoxTitleLatestModifiedSupplierOrders=Supplier Orders: last %s modified
BoxTitleLastModifiedCustomerBills=Customer Invoices: last %s modified
BoxTitleLastModifiedCustomerOrders=Customer Orders: last %s modified
BoxTitleLastModifiedSupplierBills=Latest %s modified vendors invoices
BoxTitleLatestModifiedSupplierOrders=Last %s modified purchase orders
BoxTitleLastModifiedCustomerBills=Latest %s modified customers invoices
BoxTitleLastModifiedCustomerOrders=Latest %s modified customer orders
BoxTitleLastModifiedPropals=Latest %s modified proposals
ForCustomersInvoices=Customers invoices
ForCustomersOrders=Customers orders

View File

@ -328,7 +328,7 @@ Copy=Copy
Paste=Paste
Default=Default
DefaultValue=Default value
DefaultValues=Default values
DefaultValues=Default values/filters/sorting
Price=Price
PriceCurrency=Price (currency)
UnitPrice=Unit price
@ -951,3 +951,4 @@ Deletedraft=Delete draft
ConfirmMassDraftDeletion=Draft mass delete confirmation
FileSharedViaALink=File shared via a link
SelectAThirdPartyFirst=Select a third party first...
YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode

View File

@ -14,7 +14,6 @@ PaypalModeOnlyPaypal=PayPal only
ONLINE_PAYMENT_CSS_URL=Optional URL of CSS stylesheet on online payment page
ThisIsTransactionId=This is id of transaction: <b>%s</b>
PAYPAL_ADD_PAYMENT_URL=Add the url of PayPal payment when you send a document by mail
YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode
NewOnlinePaymentReceived=New online payment received
NewOnlinePaymentFailed=New online payment tried but failed
ONLINE_PAYMENT_SENDEMAIL=EMail to warn after a payment (success or not)

View File

@ -327,7 +327,7 @@ Copy=Copier
Paste=Coller
Default=Défaut
DefaultValue=Valeur par défaut
DefaultValues=Valeurs par défaut
DefaultValues=Valeurs/Filtres/Tri par défaut
Price=Prix
PriceCurrency=Prix (devise)
UnitPrice=Prix unitaire

View File

@ -454,6 +454,36 @@ class Loan extends CommonObject
return $result;
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{
global $user, $langs, $conf;
$now=dol_now();
// Initialise parameters
$this->id = 0;
$this->fk_bank = 1;
$this->label = 'SPECIMEN';
$this->specimen = 1;
$this->socid = 1;
$this->account_capital = 16;
$this->account_insurance = 616;
$this->account_interest = 518;
$this->datestart = $now;
$this->dateend = $now + (3600 * 24 * 365);
$this->note_public = 'SPECIMEN';
$this->capital = 20000;
$this->nbterm = 48;
$this->rate = 4.3;
}
/**
* Return amount of payments already done

View File

@ -712,6 +712,9 @@ foreach ($listofreferent as $key => $value)
$testnew=$value['testnew'];
$project_field=$value['project_field'];
$exclude_select_element = array('payment_various');
if (!empty($value['exclude_select_element'])) $exclude_select_element[] = $value['exclude_select_element'];
if ($qualified)
{
// If we want the project task array to have details of users
@ -731,7 +734,7 @@ foreach ($listofreferent as $key => $value)
if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
}
if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, array('payment_various')))
if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename,$exclude_select_element))
{
$selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300',-2,!empty($project_field)?$project_field:'fk_projet');
if (! $selectList || ($selectList<0))

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2018 PtibogXIV <support@ptibogxiv.net>
/* Copyright (C) 2018 Thibault FOUCART <support@ptibogxiv.net>
*
* 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
@ -62,13 +62,13 @@ llxHeader('', $langs->trans("StripeChargeList"));
if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')))
{
$service = 'StripeTest';
$servicestatus = '0';
$servicestatus = '0';
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
}
else
{
$service = 'StripeLive';
$servicestatus = '1';
$service = 'StripeLive';
$servicestatus = '1';
}
$stripeacc = $stripe->getStripeAccount($service);
@ -150,7 +150,7 @@ if (!$rowid)
print '<tr class="oddeven">';
if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/';
if (!empty($stripeacc)) $connect=$stripeacc.'/';
// Ref
$url='https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2018 PtibogXIV <support@ptibogxiv.net>
/* Copyright (C) 2018 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -26,9 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->accounting->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
}
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page
$langs->loadLangs(array('compta', 'salaries', 'bills', 'hrm', 'stripe'));
@ -65,14 +63,16 @@ llxHeader('', $langs->trans("StripeTransactionList"));
if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')))
{
$service = 'StripeTest';
$servicestatus = '0';
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
}
else
{
$service = 'StripeLive';
$servicestatus = '1';
}
$stripeaccount = $stripe->getStripeAccount($service);
$stripeacc = $stripe->getStripeAccount($service);
/*if (empty($stripeaccount))
{
print $langs->trans('ErrorStripeAccountNotDefined');
@ -81,9 +81,8 @@ $stripeaccount = $stripe->getStripeAccount($service);
if (! $rowid) {
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
}
if ($optioncss != '')
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
@ -92,7 +91,7 @@ if (! $rowid) {
print '<input type="hidden" name="page" value="' . $page . '">';
$title=$langs->trans("StripeTransactionList");
$title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeaccount.')':' (Stripe connection with keys from Stripe module setup)');
$title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')':' (Stripe connection with keys from Stripe module setup)');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
@ -113,9 +112,9 @@ if (! $rowid) {
print "</tr>\n";
if ($stripeaccount)
if ($stripeacc)
{
$txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeaccount));
$txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeacc));
}
else
{
@ -160,9 +159,28 @@ if (! $rowid) {
$societestatic->societe_id = $obj->fk_soc;
print '<tr class="oddeven">';
// Ref
print "<td><a href='" . DOL_URL_ROOT . "/stripe/transaction.php?rowid=" . $txn->source . "'>" . $txn->source . "</A></td>\n";
if (!empty($stripeacc)) $connect=$stripeacc.'/';
// Ref
if (preg_match('/po_/i', $txn->source)){
$origin="payouts";
} elseif (preg_match('/fee_/i', $txn->source)) {
$origin="connect/application_fees";
} else {
$origin="payments";
}
$url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source;
if ($servicestatus)
{
$url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source;
}
if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') {
print "<td>".$txn->type."</td>";
} else print "<td><a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "</a></td>\n";
// Stripe customer
//print "<td>".$charge->customer."</td>\n";
// Link
@ -177,16 +195,15 @@ if (! $rowid) {
}
print "</td>\n";*/
// Origine
//print "<td>";
////if ($charge->metadata->dol_type=="order"){
// $object = new Commande($db);
// $object->fetch($charge->metadata->dol_id);
// print "<A href='".DOL_URL_ROOT."/commande/card.php?id=".$charge->metadata->dol_id."'>".img_picto('', 'object_order')." ".$object->ref."</A>";
// print "<a href='".DOL_URL_ROOT."/commande/card.php?id=".$charge->metadata->dol_id."'>".img_picto('', 'object_order')." ".$object->ref."</a>";
//} elseif ($charge->metadata->dol_type=="invoice"){
// $object = new Facture($db);
// $object->fetch($charge->metadata->dol_id);
// print "<A href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'object_invoice')." ".$object->ref."</A>";
// print "<a href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'object_invoice')." ".$object->ref."</a>";
//}
//print "</td>\n";
// Date payment
@ -198,13 +215,12 @@ if (! $rowid) {
print "<td align=\"right\">" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "</td>";
// Status
print "<td align='right'>";
if ($txn->status=='available') {
print img_picto($langs->trans("".$txn->status.""),'statut4');
} elseif ($txn->status=='pending') {
print img_picto($langs->trans("".$txn->status.""),'statut7');
} elseif ($txn->status=='failed') {
print img_picto($langs->trans("".$txn->status.""),'statut8');
}
if ($txn->status=='available')
{print img_picto($langs->trans("".$txn->status.""),'statut4');}
elseif ($txn->status=='pending')
{print img_picto($langs->trans("".$txn->status.""),'statut7');}
elseif ($txn->status=='failed')
{print img_picto($langs->trans("".$txn->status.""),'statut8');}
print '</td>';
print "</tr>\n";
}

View File

@ -1378,7 +1378,7 @@ div.nopadding {
margin : 0px auto;
}
#pictotitle {
.pictotitle {
margin-<?php echo $right; ?>: 8px;
margin-bottom: 4px;
}

View File

@ -1372,7 +1372,7 @@ table.noborder tr.liste_titre td {
margin : 0px auto;
}
#pictotitle {
.pictotitle {
margin-<?php echo $right; ?>: 8px;
margin-bottom: 4px;
}

View File

@ -195,6 +195,8 @@ class AllTests
$suite->addTestSuite('HolidayTest');
require_once dirname(__FILE__).'/ExpenseReportTest.php';
$suite->addTestSuite('ExpenseReportTest');
require_once dirname(__FILE__).'/LoanTest.php';
$suite->addTestSuite('LoanTest');
require_once dirname(__FILE__).'/EntrepotTest.php';
$suite->addTestSuite('EntrepotTest');

217
test/phpunit/LoanTest.php Normal file
View File

@ -0,0 +1,217 @@
<?php
/* Copyright (C) 2018 Maxime Kohlhaas <support@atm-consulting.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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file test/phpunit/LoanTest.php
* \ingroup test
* \brief PHPUnit test
* \remarks To run this script as CLI: phpunit filename.php
*/
global $conf,$user,$langs,$db;
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
//require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/loan/class/loan.class.php';
if (empty($user->id))
{
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
/**
* Class for PHPUnit tests
*
* @backupGlobals disabled
* @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
*/
class LoanTest extends PHPUnit_Framework_TestCase
{
protected $savconf;
protected $savuser;
protected $savlangs;
protected $savdb;
/**
* Constructor
* We save global variables into local variables
*
* @return LoanTest
*/
function __construct()
{
parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
$this->savlangs=$langs;
$this->savdb=$db;
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
//print " - db ".$db->db;
print "\n";
}
// Static methods
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
$db->rollback();
print __METHOD__."\n";
}
/**
* Init phpunit tests
*
* @return void
*/
protected function setUp()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
print __METHOD__."\n";
//print $db->getVersion()."\n";
}
/**
* End phpunit tests
*
* @return void
*/
protected function tearDown()
{
print __METHOD__."\n";
}
/**
* testLoanCreate
*
* @return void
*/
public function testLoanCreate()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new Loan($this->savdb);
$localobject->initAsSpecimen();
$result=$localobject->create($user);
$this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n";
return $result;
}
/**
* testLoanFetch
*
* @param int $id Id of object
* @return void
*
* @depends testLoanCreate
* The depends says test is run only if previous is ok
*/
public function testLoanFetch($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new Loan($this->savdb);
$result=$localobject->fetch($id);
$this->assertLessThan($result, 0);
print __METHOD__." id=".$id." result=".$result."\n";
return $localobject;
}
/**
* testLoanOther
*
* @param Loan $localobject Loan
* @return int
*
* @depends testLoanFetch
* The depends says test is run only if previous is ok
*/
public function testLoanOther($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$result=$localobject->set_paid($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject->id;
}
/**
* testLoanDelete
*
* @param int $id Id of loan
* @return void
*
* @depends testLoanCreate
* The depends says test is run only if previous is ok
*/
public function testLoanDelete($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new Loan($this->savdb);
$result=$localobject->fetch($id);
$result=$localobject->delete($user);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $result;
}
}