Merge remote-tracking branch 'origin/3.9' into develop

Conflicts:
	htdocs/fourn/facture/list.php
	htdocs/projet/card.php
	htdocs/societe/consumption.php
This commit is contained in:
Laurent Destailleur 2016-07-01 02:39:29 +02:00
commit 05384b2f88
12 changed files with 47 additions and 31 deletions

View File

@ -423,7 +423,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'customer',16);
print $companystatic->getNomUrl(1,'supplier',16);
print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
$i++;
@ -729,7 +729,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1, 'company', 44);
print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>';
print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
@ -828,7 +828,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1, 'company', 44);
print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>';
print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";

View File

@ -36,10 +36,10 @@ $id=GETPOST('account');
$ref=GETPOST('ref');
// Security check
$fieldid = (! empty($ref)?$ref:$id);
$fieldname = isset($ref)?'ref':'rowid';
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
$fieldtype = (! empty($ref) ? 'ref' :'rowid');
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque',$fieldid,'bank_account','','',$fieldname);
$result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype);
$year_start=GETPOST('year_start');
$year_current = strftime("%Y",time());
@ -146,7 +146,7 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("B
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
if ($_GET["account"])
if (!empty($id))
{
if (! preg_match('/,/', $id))
{

View File

@ -919,7 +919,10 @@ class BonPrelevement extends CommonObject
$row = $this->db->fetch_row($resql);
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT);
$this->filename = $conf->prelevement->dir_output.'/receipts/'.$ref.'.xml';
$dir=$conf->prelevement->dir_output.'/receipts';
if (! is_dir($dir)) dol_mkdir($dir);
$this->filename = $dir.'/receipts/'.$ref.'.xml';
// Create withdraw receipt in database
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
@ -935,10 +938,6 @@ class BonPrelevement extends CommonObject
{
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
$this->id = $prev_id;
$dir=$conf->prelevement->dir_output.'/receipts';
$file=$filebonprev;
if (! is_dir($dir)) dol_mkdir($dir);
}
else
{
@ -1034,7 +1033,7 @@ class BonPrelevement extends CommonObject
// Generation of SEPA file
$this->generate();
}
dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG);
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
}
/*

View File

@ -6,6 +6,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@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
@ -687,7 +688,7 @@ class FormFile
*
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
* @param string $filedir Directory to scan
* @param string $filedir Full path to directory to scan
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
*/
@ -720,9 +721,6 @@ class FormFile
if ($modulepart == 'export') {
$relativepath = $file["name"];
}
if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_fournisseur') {
$relativepath = get_exdir($modulesubdir, 2,0,0,null,'invoice_supplier'). $modulesubdir. "/" . $file["name"];
}
// Show file name with link to download
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'"';

View File

@ -310,6 +310,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$expedition->id=$objp->sendingid;
$expedition->fetchObjectLinked($expedition->id,$expedition->element);
//var_dump($expedition->linkedObjects);
$receiving='';
if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link

View File

@ -448,6 +448,18 @@ if ($object->id > 0)
}
// TODO move to DAO class
$sql = "SELECT count(p.rowid) as total";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
$sql.= " WHERE p.fk_soc =".$object->id;
$sql.= " AND p.entity =".$conf->entity;
$sql.= " ORDER BY p.date_commande DESC";
$resql=$db->query($sql);
if ($resql)
{
$object_count = $db->fetch_object($resql);
$num = $object_count->total;
}
$sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
$sql.= " WHERE p.fk_soc =".$object->id;
@ -458,7 +470,6 @@ if ($object->id > 0)
if ($resql)
{
$i = 0 ;
$num = $db->num_rows($resql);
if ($num > 0)
{
@ -474,7 +485,7 @@ if ($object->id > 0)
}
$var = True;
while ($i < $num && $i <= $MAXLIST)
while ($i < $num && $i < $MAXLIST)
{
$obj = $db->fetch_object($resql);
$var=!$var;

View File

@ -743,17 +743,20 @@ if ($resql)
$facturestatic->ref_supplier=$obj->ref_supplier;
$facturestatic->date_echeance = $db->jdate($obj->datelimite);
$facturestatic->statut = $obj->fk_statut;
print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['f.ref']['checked']))
{
print '<td class="nowrap">';
print $facturestatic->getNomUrl(1);
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir);
print "</td>\n";
$subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}

View File

@ -666,9 +666,13 @@ else
$filteronlist='';
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
$text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300');
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
print '</td></tr>';
if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
{
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
}
else print $text;
print '</td></tr>';
}
// Visibility

View File

@ -1145,6 +1145,7 @@ class Project extends CommonObject
// Load source object
$clone_project->fetch($fromid);
$clone_project->fetch_optionals();
$clone_project->fetch_thirdparty();
$orign_dt_start=$clone_project->date_start;

View File

@ -53,7 +53,7 @@ $projectstatic = new Project($db);
* Actions
*/
if ($action == 'addtimespent' && $user->rights->projet->creer)
if ($action == 'addtimespent' && $user->rights->projet->lire)
{
$error=0;

View File

@ -276,7 +276,7 @@ if ($type_element == 'contract')
$thirdTypeSelect='customer';
}
if ($sql_select)
if (!empty($sql_select))
{
$sql = $sql_select;
$sql.= ' d.description as description,';
@ -302,7 +302,7 @@ if ($sql_select)
$sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
}
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";
if ($sprod_fulldescr)
if ($sprod_fulldescr)
{
$sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'";
if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'";

View File

@ -141,8 +141,7 @@ class UserBankAccount extends Account
$sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
$sql.= " owner_address, label, datec, tms as datem";
$sql.= " FROM ".MAIN_DB_PREFIX."user_rib";
if ($id) $sql.= " WHERE rowid = ".$id;
if ($socid) $sql.= " WHERE fk_user = ".$userid;
$sql.= " WHERE rowid = ".$id;
$resql = $this->db->query($sql);
if ($resql)