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

Conflicts:
	htdocs/filefunc.inc.php
	htdocs/projet/card.php
This commit is contained in:
Laurent Destailleur 2016-10-16 19:04:33 +02:00
commit 28933c31dd
18 changed files with 54 additions and 29 deletions

View File

@ -5,7 +5,7 @@
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -637,17 +637,19 @@ class Categorie extends CommonObject
{
if ($this->db->num_rows($resql) > 0)
{
$objparent = $this->db->fetch_object($resql);
$objparent = $this->db->fetch_object($resql);
if (!empty($objparent->fk_parent))
{
$cat = new Categorie($this->db);
$cat->id=$objparent->fk_parent;
$result=$cat->add_type($obj, $type);
if ($result < 0)
{
$this->error=$cat->error;
$error++;
$cat->id = $objparent->fk_parent;
if (!$cat->containsObject($type, $obj->id)) {
$result = $cat->add_type($obj, $type);
if ($result < 0)
{
$this->error = $cat->error;
$error++;
}
}
}
}

View File

@ -846,7 +846,7 @@ if ($id > 0 || ! empty($ref))
{
$loanstatic->label=$links[$key]['label'];
}
$loanstatic->ref=$loanstatic->label;
$loanstatic->ref=$links[$key]['url_id'];
print $loanstatic->getLinkUrl(1,16);
}
else if ($links[$key]['type']=='member')

View File

@ -385,6 +385,11 @@ if (! $sall)
$sql.= ' f.datec, f.tms,';
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code';
$sql.= ' ,state.code_departement, state.nom';
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
{
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
}
}
else
{

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juan José 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
@ -79,8 +80,10 @@ class box_project extends ModeleBoxes
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut ";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
$sql.= " ORDER BY p.datec DESC";
$sql.= $db->plimit($max, 0);

View File

@ -454,6 +454,10 @@ class ImportCsv extends ModeleImports
}
if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null"
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric')
{
$newval = price2num($newval);
}
//print 'Val to use as insert is '.$newval.'<br>';
}

View File

@ -76,7 +76,10 @@ class modFTP extends DolibarrModules
$this->requiredby = array(); // List of modules id to disable if this one is disabled
// Constants
$this->const = array(); // List of parameters
$this->const = array(
1=>array('FTP_CONNECT_WITH_SSL','chaine','0','Use FTPS for FTP module', 1, 'current', 1),
2=>array('FTP_CONNECT_WITH_SFTP','chaine','0','Use SFTP for FTP module', 1, 'current', 1)
); // List of parameters
// Boxes
$this->boxes = array(); // List of boxes

View File

@ -345,7 +345,8 @@ class modSociete extends DolibarrModules
's.code_client'=>array('rule'=>'getcustomercodeifauto'),
's.code_fournisseur'=>array('rule'=>'getsuppliercodeifauto'),
's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifauto'),
's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto')
's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifauto'),
's.capital'=>array('rule'=>'numeric')
);
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');

View File

@ -173,7 +173,7 @@ else
print '<tr class="pair">';
print '<td width="100">'.$langs->trans("Port").'</td>';
print '<td><input type="text" name="FTP_PORT_'.($lastftpentry+1).'" value="'.GETPOST("FTP_PORT_" . ($lastftpentry+1)).'" size="64"></td>';
print '<td>21</td>';
print '<td>21 for pure non crypted FTP or if option FTP_CONNECT_WITH_SSL (See Home-Setup-Other) is on (FTPS)<br>22 if option FTP_CONNECT_WITH_SFTP (See Home-Setup-Other) is on (SFTP)</td>';
print '</tr>';
print '<tr class="impair">';

View File

@ -458,7 +458,7 @@ else
// Construit liste des repertoires
print '<table width="100%" class="nobordernopadding">'."\n";
print '<table width="100%" class="noborder">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td class="liste_titre" align="left">'.$langs->trans("Content").'</td>'."\n";

View File

@ -4,6 +4,7 @@ Loans=Loans
NewLoan=New Loan
ShowLoan=Show Loan
PaymentLoan=Loan payment
LoanPayment=Loan payment
ShowLoanPayment=Show Loan Payment
LoanCapital=Capital
Insurance=Insurance

View File

@ -512,6 +512,7 @@ ReportPeriod=Report period
ReportDescription=Description
Report=Report
Keyword=Keyword
Origin=Origin
Legend=Legend
Fill=Fill
Reset=Reset

View File

@ -491,7 +491,6 @@ if ($id > 0)
print '<td align="center">'.$langs->trans("Insurance").'</td>';
print '<td align="center">'.$langs->trans("Interest").'</td>';
print '<td align="center">'.$langs->trans("LoanCapital").'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
$var=True;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -385,6 +385,7 @@ class PaymentLoan extends CommonObject
* All payment properties must have been set first like after a call to create().
*
* @param User $user Object of user making payment
* @param int $fk_loan Id of fk_loan to do link with this payment
* @param string $mode 'payment_loan'
* @param string $label Label to use in bank record
* @param int $accountid Id of bank account to do link with
@ -392,7 +393,7 @@ class PaymentLoan extends CommonObject
* @param string $emetteur_banque Name of bank
* @return int <0 if KO, >0 if OK
*/
function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
function addPaymentToBank($user, $fk_loan, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{
global $conf;
@ -445,11 +446,10 @@ class PaymentLoan extends CommonObject
}
}
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
//$linkaddedforthirdparty=array();
// Add link 'loan' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
if ($mode == 'payment_loan')
{
$result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label?$this->label:''),'loan');
$result=$acc->add_url_line($bank_line_id, $fk_loan, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label?$this->label:''),'loan');
if ($result <= 0) dol_print_error($this->db);
}
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2014-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

View File

@ -116,7 +116,7 @@ if ($action == 'add_payment')
if (! $error)
{
$result = $payment->addPaymentToBank($user, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', '');
$result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', '');
if (! $result > 0)
{
setEventMessages($payment->error, $payment->errors, 'errors');
@ -175,7 +175,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$loan->label."</td></tr>\n";
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">'.price($loan->capital,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
$sql = "SELECT SUM(amount_capital + amount_insurance + amount_interest) as total";
$sql = "SELECT SUM(amount_capital) as total";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_loan";
$sql.= " WHERE fk_loan = ".$chid;
$resql = $db->query($sql);

View File

@ -1242,6 +1242,9 @@ class Task extends CommonObject
// Load source object
$clone_task->fetch($fromid);
$clone_task->fetch_optionals();
//var_dump($clone_task->array_options);exit;
$origin_task->fetch($fromid);
$defaultref='';

View File

@ -150,6 +150,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$day='';
$month='';
$year='';
$search_array_options=array();
}
if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1;

View File

@ -170,7 +170,7 @@ $arrayfields=array(
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
@ -341,8 +341,9 @@ else dol_print_error($db);
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, ";
$sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4, s.fk_pays,";
$sql.= " s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.fk_pays,";
$sql.= " s.tms as date_update, s.datec as date_creation,";
$sql.= " s.code_compta,s.code_compta_fournisseur,";
$sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name";
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
@ -408,7 +409,7 @@ foreach ($search_array_options as $key => $val)
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
@ -439,7 +440,6 @@ if (! $resql)
$num = $db->num_rows($resql);
$i = 0;
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
{
$obj = $db->fetch_object($resql);
@ -980,6 +980,7 @@ while ($i < min($num, $limit))
print $s;
print '</td>';
}
if (! empty($arrayfields['s.fk_prospectlevel']['checked']))
{
// Prospect level
@ -987,6 +988,7 @@ while ($i < min($num, $limit))
print $companystatic->getLibProspLevel();
print "</td>";
}
if (! empty($arrayfields['s.fk_stcomm']['checked']))
{
// Prospect status
@ -1004,9 +1006,9 @@ while ($i < min($num, $limit))
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields["ef.".$key]['checked']))
{
print '<td';
$align=$extrafields->getAlignFlag($key);