Skip to content

Commit

Permalink
Merge branch 'develop' into new_export_stock_valo
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 24, 2017
2 parents cad2fed + 9836f42 commit d7f5f14
Show file tree
Hide file tree
Showing 63 changed files with 1,195 additions and 770 deletions.
11 changes: 10 additions & 1 deletion htdocs/accountancy/journal/purchasesjournal.php
Expand Up @@ -55,10 +55,19 @@
// Security check
if ($user->societe_id > 0)
accessforbidden();


$hookmanager->initHooks(array('purchasesjournal'));
$parameters=array();

/*
* Actions
*/
$reshook=$hookmanager->executeHooks('doActions',$parameters,$user,$action); // Note that $action and $object may have been modified by some hooks


/*
* Views
*/

// Get informations of journal
$accountingjournalstatic = new AccountingJournal($db);
Expand Down
28 changes: 19 additions & 9 deletions htdocs/adherents/index.php
@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -165,12 +165,13 @@
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
print '<tr '.$bc[0].'><td align="center" colspan="2">';
print '<tr><td align="center" colspan="2">';

$SommeA=0;
$SommeB=0;
$SommeC=0;
$SommeD=0;
$total=0;
$dataval=array();
$datalabels=array();
$i=0;
Expand All @@ -187,14 +188,23 @@
$SommeD+=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
$i++;
}

$total = $SommeA + $SommeB + $SommeC + $SommeD;
$dataseries=array();
$dataseries[]=array('label'=>$langs->trans("MenuMembersNotUpToDate"),'data'=>round($SommeB));
$dataseries[]=array('label'=>$langs->trans("MenuMembersUpToDate"),'data'=>round($SommeC));
$dataseries[]=array('label'=>$langs->trans("MembersStatusResiliated"),'data'=>round($SommeD));
$dataseries[]=array('label'=>$langs->trans("MembersStatusToValid"),'data'=>round($SommeA));
$data=array('series'=>$dataseries);
dol_print_graph('stats',300,180,$data,1,'pie',1);
$dataseries[]=array($langs->trans("MenuMembersNotUpToDate"), round($SommeB));
$dataseries[]=array($langs->trans("MenuMembersUpToDate"), round($SommeC));
$dataseries[]=array($langs->trans("MembersStatusResiliated"), round($SommeD));
$dataseries[]=array($langs->trans("MembersStatusToValid"), round($SommeA));

include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setWidth('100%');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total?0:1);

print '</td></tr>';
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
print $SommeA+$SommeB+$SommeC+$SommeD;
Expand Down
9 changes: 6 additions & 3 deletions htdocs/barcode/printsheet.php
Expand Up @@ -236,7 +236,10 @@
{
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
}
if (! $mesg) $result=doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, 'tmp_barcode_sheet.pdf');

$outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(),'dayhourlog').'.pdf';

if (! $mesg) $result=doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
}

if ($result <= 0)
Expand Down Expand Up @@ -292,9 +295,9 @@
$labeltoshow=$_Avery_Labels[$codecards]['name'];
//$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')';
$arrayoflabels[$codecards]=$labeltoshow;
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
}
print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE),1,0,0);
asort($arrayoflabels);
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '</div></div>';

// Number of stickers to print
Expand Down
2 changes: 1 addition & 1 deletion htdocs/comm/action/class/api_agendaevents.class.php
Expand Up @@ -76,7 +76,7 @@ function get($id)
throw new RestException(401, "Insuffisant rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
}

if ( ! DolibarrApi::_checkAccessToResource('agenda',$this->actioncomm->id)) {
if ( ! DolibarrApi::_checkAccessToResource('agenda',$this->actioncomm->id,'actioncomm','','fk_soc','id')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

Expand Down
37 changes: 18 additions & 19 deletions htdocs/comm/propal/index.php
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -61,7 +61,6 @@

if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
Expand Down Expand Up @@ -115,14 +114,13 @@

print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Proposals").'</td></tr>'."\n";
$var=true;
$listofstatus=array(0,1,2,3,4);
foreach ($listofstatus as $status)
{
$dataseries[]=array('label'=>$propalstatic->LibStatut($status,1),'data'=>(isset($vals[$status])?(int) $vals[$status]:0));
$dataseries[]=array($propalstatic->LibStatut($status,1), (isset($vals[$status])?(int) $vals[$status]:0));
if (! $conf->use_javascript_ajax)
{

print '<tr class="oddeven">';
print '<td>'.$propalstatic->LibStatut($status,0).'</td>';
print '<td align="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status])?$vals[$status]:0).'</a></td>';
Expand All @@ -131,9 +129,18 @@
}
if ($conf->use_javascript_ajax)
{
print '<tr class="impair"><td align="center" colspan="2">';
$data=array('series'=>$dataseries);
dol_print_graph('stats',300,180,$data,1,'pie',1);
print '<tr><td align="center" colspan="2">';

include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setWidth('100%');
$dolgraph->draw('idgraphthirdparties');
print $dolgraph->show($total?0:1);

print '</td></tr>';
}
//if ($totalinprocess != $total)
Expand Down Expand Up @@ -173,10 +180,8 @@
if ($num)
{
$i = 0;
$var = True;
while ($i < $num)
{

$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';

Expand Down Expand Up @@ -233,10 +238,8 @@
if ($num)
{
$i = 0;
$var = True;
while ($i < $num)
{

$obj = $db->fetch_object($resql);

print '<tr class="oddeven">';
Expand Down Expand Up @@ -308,16 +311,14 @@
$i = 0;
if ($num > 0)
{
$var=true;

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></td></tr>';

$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop)
{
$obj = $db->fetch_object($result);

print '<tr class="oddeven">';

// Ref
Expand Down Expand Up @@ -402,10 +403,9 @@
if ($num)
{
$i = 0;
$var = True;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="nowrap">';
Expand Down Expand Up @@ -474,10 +474,9 @@
if ($num)
{
$i = 0;
$var = True;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td width="20%" class="nowrap">';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/commande/class/commande.class.php
Expand Up @@ -768,7 +768,7 @@ function create($user, $notrigger=0)
$sql.= ", multicurrency_code";
$sql.= ", multicurrency_tx";
$sql.= ")";
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
$sql.= " VALUES ('(PROV)', ".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
$sql.= ", ".($this->fk_project>0?$this->fk_project:"null");
$sql.= ", '".$this->db->idate($date)."'";
$sql.= ", ".($this->source>=0 && $this->source != '' ?$this->db->escape($this->source):'null');
Expand Down
42 changes: 21 additions & 21 deletions htdocs/commande/index.php
Expand Up @@ -79,15 +79,16 @@
* Statistics
*/

$sql = "SELECT count(c.rowid), c.fk_statut, c.facture";
$sql = "SELECT count(c.rowid), c.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity IN (".getEntity('societe').")";
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY c.fk_statut, c.facture";
$sql.= " GROUP BY c.fk_statut";

$resql = $db->query($sql);
if ($resql)
{
Expand All @@ -98,7 +99,6 @@
$totalinprocess=0;
$dataseries=array();
$vals=array();
$bool=false;
// -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not)
while ($i < $num)
{
Expand All @@ -107,8 +107,7 @@
{
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
{
$bool=(! empty($row[2])?true:false);
if (! isset($vals[$row[1].$bool])) $vals[$row[1].$bool]=0;
if (! isset($vals[$row[1]])) $vals[$row[1]]=0;
$vals[$row[1].$bool]+=$row[0];
$totalinprocess+=$row[0];
}
Expand All @@ -119,37 +118,38 @@
$db->free($resql);
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'</th></tr>'."\n";
$listofstatus=array(0,1,2,3,3,-1);
$bool=false;
$listofstatus=array(0,1,2,3,-1);
foreach ($listofstatus as $status)
{
$dataseries[]=array('label'=>$commandestatic->LibStatut($status,$bool,1),'data'=>(isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0));
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
$dataseries[]=array($commandestatic->LibStatut($status,$bool,1), (isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0));
}
if ($conf->use_javascript_ajax)
{
print '<tr class="impair"><td align="center" colspan="2">';
$data=array('series'=>$dataseries);
dol_print_graph('stats',300,180,$data,1,'pie',1);

include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setWidth('100%');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total?0:1);

print '</td></tr>';
}
$var=true;
$bool=false;
foreach ($listofstatus as $status)
else
{
if (! $conf->use_javascript_ajax)
{

print '<tr class="oddeven">';
foreach ($listofstatus as $status)
{
print '<tr class="oddeven">';
print '<td>'.$commandestatic->LibStatut($status,$bool,0).'</td>';
print '<td align="right"><a href="list.php?viewstatut='.$status.'">'.(isset($vals[$status.$bool])?$vals[$status.$bool]:0).' ';
print $commandestatic->LibStatut($status,$bool,3);
print '</a>';
print '</td>';
print "</tr>\n";
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
}
}
//if ($totalinprocess != $total)
Expand Down
7 changes: 2 additions & 5 deletions htdocs/compta/bank/releve.php
Expand Up @@ -41,10 +41,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';

$langs->load("banks");
$langs->load("categories");
$langs->load("companies");
$langs->load("bills");
$langs->loadLangs(array("banks","categories","companies","bills","trips"));

$action=GETPOST('action', 'alpha');
$id=GETPOST('account','int');
Expand Down Expand Up @@ -705,7 +702,7 @@
$newline=0;
}
elseif ($links[$key]['type']=='user') {
print '<a href="'.DOL_URL_ROOT.'/user/card.php?rowid='.$links[$key]['url_id'].'">';
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowUser'),'user').' ';
print $links[$key]['label'];
print '</a>';
Expand Down
19 changes: 14 additions & 5 deletions htdocs/compta/deplacement/index.php
Expand Up @@ -106,14 +106,23 @@
$listoftype=$tripandexpense_static->listOfTypes();
foreach ($listoftype as $code => $label)
{
$dataseries[]=array('label'=>$label,'data'=>(isset($nb[$code])?(int) $nb[$code]:0));
$dataseries[]=array($label, (isset($nb[$code])?(int) $nb[$code]:0));
}

if ($conf->use_javascript_ajax)
{
print '<tr '.$bc[false].'><td align="center" colspan="4">';
$data=array('series'=>$dataseries);
dol_print_graph('stats',300,180,$data,1,'pie',1);
print '<tr><td align="center" colspan="4">';

include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setWidth('100%');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($totalnb?0:1);

print '</td></tr>';
}

Expand Down Expand Up @@ -180,7 +189,7 @@
print '<td align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
print '<td>'.$deplacementstatic->LibStatut($obj->fk_statut,3).'</td>';
print '</tr>';

$i++;
}

Expand Down

0 comments on commit d7f5f14

Please sign in to comment.