Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.9' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/fourn/facture/list.php
	htdocs/projet/card.php
	htdocs/societe/consumption.php
  • Loading branch information
eldy committed Jul 1, 2016
2 parents f3821c3 + 29e26c2 commit 05384b2
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 31 deletions.
6 changes: 3 additions & 3 deletions htdocs/comm/index.php
Expand Up @@ -423,7 +423,7 @@
$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++;
Expand Down Expand Up @@ -729,7 +729,7 @@
$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";
Expand Down Expand Up @@ -828,7 +828,7 @@
$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";
Expand Down
8 changes: 4 additions & 4 deletions htdocs/compta/bank/annuel.php
Expand Up @@ -36,10 +36,10 @@
$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());
Expand Down Expand Up @@ -146,7 +146,7 @@
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
if ($_GET["account"])
if (!empty($id))
{
if (! preg_match('/,/', $id))
{
Expand Down
11 changes: 5 additions & 6 deletions htdocs/compta/prelevement/class/bonprelevement.class.php
Expand Up @@ -919,7 +919,10 @@ function Create($banque=0, $agence=0, $mode='real')
$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 (";
Expand All @@ -935,10 +938,6 @@ function Create($banque=0, $agence=0, $mode='real')
{
$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
{
Expand Down Expand Up @@ -1034,7 +1033,7 @@ function Create($banque=0, $agence=0, $mode='real')
// 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);
}

/*
Expand Down
6 changes: 2 additions & 4 deletions htdocs/core/class/html.formfile.class.php
Expand Up @@ -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
Expand Down Expand Up @@ -687,7 +688,7 @@ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed
*
* @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
*/
Expand Down Expand Up @@ -720,9 +721,6 @@ function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter='')
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).'"';
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/lib/sendings.lib.php
Expand Up @@ -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

Expand Down
15 changes: 13 additions & 2 deletions htdocs/fourn/card.php
Expand Up @@ -448,6 +448,18 @@
}

// 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;
Expand All @@ -458,7 +470,6 @@
if ($resql)
{
$i = 0 ;
$num = $db->num_rows($resql);

if ($num > 0)
{
Expand All @@ -474,7 +485,7 @@
}

$var = True;
while ($i < $num && $i <= $MAXLIST)
while ($i < $num && $i < $MAXLIST)
{
$obj = $db->fetch_object($resql);
$var=!$var;
Expand Down
11 changes: 7 additions & 4 deletions htdocs/fourn/facture/list.php
Expand Up @@ -743,17 +743,20 @@
$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']++;
}
Expand Down
10 changes: 7 additions & 3 deletions htdocs/projet/card.php
Expand Up @@ -666,9 +666,13 @@ function change_percent()
$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
Expand Down
1 change: 1 addition & 0 deletions htdocs/projet/class/project.class.php
Expand Up @@ -1145,6 +1145,7 @@ function createFromClone($fromid,$clone_contact=false,$clone_task=true,$clone_pr

// Load source object
$clone_project->fetch($fromid);
$clone_project->fetch_optionals();
$clone_project->fetch_thirdparty();

$orign_dt_start=$clone_project->date_start;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/projet/tasks/time.php
Expand Up @@ -53,7 +53,7 @@
* Actions
*/

if ($action == 'addtimespent' && $user->rights->projet->creer)
if ($action == 'addtimespent' && $user->rights->projet->lire)
{
$error=0;

Expand Down
4 changes: 2 additions & 2 deletions htdocs/societe/consumption.php
Expand Up @@ -276,7 +276,7 @@
$thirdTypeSelect='customer';
}

if ($sql_select)
if (!empty($sql_select))
{
$sql = $sql_select;
$sql.= ' d.description as description,';
Expand All @@ -302,7 +302,7 @@
$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)."%'";
Expand Down
3 changes: 1 addition & 2 deletions htdocs/user/class/userbankaccount.class.php
Expand Up @@ -141,8 +141,7 @@ function fetch($id)
$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)
Expand Down

0 comments on commit 05384b2

Please sign in to comment.