This commit is contained in:
Laurent Destailleur 2012-08-28 18:42:39 +02:00
commit e5c2d07c53
44 changed files with 376 additions and 302 deletions

View File

@ -51,6 +51,7 @@ Copyright (C) 2012
- Juanjo Menent <jmenent@2byte.es> - Juanjo Menent <jmenent@2byte.es>
- Philippe Grand <philippe.grand@atoo-net.com> - Philippe Grand <philippe.grand@atoo-net.com>
- Jean Heimburger <jean@tiaris.info> - Jean Heimburger <jean@tiaris.info>
- Marcos García <marcosgdf@gmail.com>
Copyright (C) 2011 Copyright (C) 2011
- Laurent Destailleur <eldy@users.sourceforge.net> - Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -18,8 +18,17 @@ English Dolibarr ChangeLog
- Fix: Allows to use a comma decimal separator in supplier invoices payments. - Fix: Allows to use a comma decimal separator in supplier invoices payments.
- Fix: Translation for tr_TR, es_ES, pt_BR. - Fix: Translation for tr_TR, es_ES, pt_BR.
- Fix: Products with no prices not visible. - Fix: Products with no prices not visible.
- Fix: Access to product card created with very old version of Dolibarr.
- Fix: Delete temporary files after validating an invoice.
- Fix: preview of supplier order and invoice template.
- Fix: [ bug #485 ] Configurated amount for public auto-subscription form is not taken into account
- Fix: Average amount graphs weren't comparing the previous year stats
- Fix: Closed project didn't show the new status unless the page was refreshed
- Fix: Files were not being uploaded to a project's task
- Fix: [ bug #503 ] Unable to delete linked file to a deposit
- Fix: [ bug #501 ] Error while trying to modify an user
- Fix: [ bug #506 ] Can't set percentage of a started event
- Fix: Bad assignation of const for pdf delivery module name
***** ChangeLog for 3.2.0 compared to 3.1.3 ***** ***** ChangeLog for 3.2.0 compared to 3.1.3 *****
WARNING: PHP lower than 5.x are no more supported. WARNING: PHP lower than 5.x are no more supported.

View File

@ -4,7 +4,7 @@
<CompanyName /> <CompanyName />
<Program_Info> <Program_Info>
<Program_Name>DoliWamp</Program_Name> <Program_Name>DoliWamp</Program_Name>
<Program_Version>3.2..0</Program_Version> <Program_Version>3.2.1</Program_Version>
<Program_Release_Month>05</Program_Release_Month> <Program_Release_Month>05</Program_Release_Month>
<Program_Release_Day>10</Program_Release_Day> <Program_Release_Day>10</Program_Release_Day>
<Program_Release_Year>2012</Program_Release_Year> <Program_Release_Year>2012</Program_Release_Year>

View File

@ -4,7 +4,7 @@
<CompanyName /> <CompanyName />
<Program_Info> <Program_Info>
<Program_Name>Dolibarr</Program_Name> <Program_Name>Dolibarr</Program_Name>
<Program_Version>3.2.0</Program_Version> <Program_Version>3.2.1</Program_Version>
<Program_Release_Month>05</Program_Release_Month> <Program_Release_Month>05</Program_Release_Month>
<Program_Release_Day>10</Program_Release_Day> <Program_Release_Day>10</Program_Release_Day>
<Program_Release_Year>2012</Program_Release_Year> <Program_Release_Year>2012</Program_Release_Year>

View File

@ -34,9 +34,9 @@
</Company_Info> </Company_Info>
<Program_Info> <Program_Info>
<Program_Name>Dolibarr</Program_Name> <Program_Name>Dolibarr</Program_Name>
<Program_Version>3.2.0</Program_Version> <Program_Version>3.2.1</Program_Version>
<Program_Release_Month>06</Program_Release_Month> <Program_Release_Month>08</Program_Release_Month>
<Program_Release_Day>18</Program_Release_Day> <Program_Release_Day>10</Program_Release_Day>
<Program_Release_Year>2012</Program_Release_Year> <Program_Release_Year>2012</Program_Release_Year>
<Program_Cost_Dollars /> <Program_Cost_Dollars />
<Program_Cost_Other_Code /> <Program_Cost_Other_Code />

View File

@ -34,9 +34,9 @@
</Company_Info> </Company_Info>
<Program_Info> <Program_Info>
<Program_Name>DoliWamp</Program_Name> <Program_Name>DoliWamp</Program_Name>
<Program_Version>3.2.0</Program_Version> <Program_Version>3.2.1</Program_Version>
<Program_Release_Month>06</Program_Release_Month> <Program_Release_Month>08</Program_Release_Month>
<Program_Release_Day>18</Program_Release_Day> <Program_Release_Day>10</Program_Release_Day>
<Program_Release_Year>2012</Program_Release_Year> <Program_Release_Year>2012</Program_Release_Year>
<Program_Cost_Dollars /> <Program_Cost_Dollars />
<Program_Cost_Other_Code /> <Program_Cost_Other_Code />

View File

@ -708,36 +708,43 @@ class Adherent extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid; // Remove linked user
dol_syslog(get_class($this)."::delete sql=".$sql); $ret=$this->setUserId(0);
$resql=$this->db->query($sql); if ($ret > 0)
if ($resql) {
{ $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid;
if ($this->db->affected_rows($resql)) dol_syslog(get_class($this)."::delete sql=".$sql);
{ $resql=$this->db->query($sql);
// Appel des triggers if ($resql)
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); {
$interface=new Interfaces($this->db); if ($this->db->affected_rows($resql))
$result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf); {
if ($result < 0) { $error++; $this->errors=$interface->errors; } // Appel des triggers
// Fin appel triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$this->db->commit(); $result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf);
return 1; if ($result < 0) {
} $error++; $this->errors=$interface->errors;
else }
{ // Fin appel triggers
// Rien a effacer
$this->db->rollback(); $this->db->commit();
return 0; return 1;
} }
} else
else {
{ // Rien a effacer
$this->error=$this->db->error(); $this->db->rollback();
$this->db->rollback(); return 0;
return -3; }
} }
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -3;
}
}
} }
else else
{ {

View File

@ -247,7 +247,7 @@ if ($resql)
$statictype->libelle=$obj->libelle; $statictype->libelle=$obj->libelle;
print '<td>'.$staticmember->getNomUrl(1,24).'</td>'; print '<td>'.$staticmember->getNomUrl(1,24).'</td>';
print '<td>'.$statictype->getNomUrl(1,16).'</td>'; print '<td>'.$statictype->getNomUrl(1,16).'</td>';
print '<td>'.dol_print_date($db->jdate($obj->date_end),'dayhour').'</td>'; print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>'; print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -112,7 +112,7 @@ $dirbarcode=array_merge(array("/core/modules/barcode/"),$conf->barcode_modules);
foreach($dirbarcode as $reldir) foreach($dirbarcode as $reldir)
{ {
$dir=dol_buildpath($reldir,0); $dir=dol_buildpath($reldir);
$newdir=dol_osencode($dir); $newdir=dol_osencode($dir);
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php) // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
@ -334,4 +334,4 @@ dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
llxFooter(); llxFooter();
?> ?>

View File

@ -158,7 +158,7 @@ if ($what == 'mysql')
if (! empty($dolibarr_main_db_pass)) if (! empty($dolibarr_main_db_pass))
{ {
$paramcrypted.=' -p"'.preg_replace('/./i','*',$dolibarr_main_db_pass).'"'; $paramcrypted.=' -p"'.preg_replace('/./i','*',$dolibarr_main_db_pass).'"';
$paramclear.=' -p"'.str_replace('"','\"',$dolibarr_main_db_pass).'"'; $paramclear.=' -p"'.str_replace(array('"','`'),array('\"','\`'),$dolibarr_main_db_pass).'"';
} }
print '<b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n"; print '<b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";

View File

@ -447,7 +447,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Title").'</td><td><input type="text" name="label" size="60" value="'.GETPOST('label').'"></td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td><input type="text" name="label" size="60" value="'.GETPOST('label').'"></td></tr>';
// Full day // Full day
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked="checked"':'').'></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked="checked"':'').'></td></tr>';
// Date start // Date start
$datep=$actioncomm->datep; $datep=$actioncomm->datep;
@ -687,7 +687,7 @@ if ($id)
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$act->label.'"></td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$act->label.'"></td></tr>';
// Full day event // Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($act->fulldayevent?' checked="checked"':'').'></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($act->fulldayevent?' checked="checked"':'').'></td></tr>';
// Date start // Date start
print '<tr><td nowrap="nowrap" class="fieldrequired">'.$langs->trans("DateActionStart").'</td><td colspan="3">'; print '<tr><td nowrap="nowrap" class="fieldrequired">'.$langs->trans("DateActionStart").'</td><td colspan="3">';

View File

@ -744,11 +744,13 @@ if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), arr
if (empty($action) || $action == 'show_month') // View by month if (empty($action) || $action == 'show_month') // View by month
{ {
$newparam=$param; // newparam is for birthday links $newparam=$param; // newparam is for birthday links
$newparam=preg_replace('/showbirthday=/i','showbirthday_=',$newparam); // To avoid replacement when replace day= is done
$newparam=preg_replace('/action=show_month&?/i','',$newparam); $newparam=preg_replace('/action=show_month&?/i','',$newparam);
$newparam=preg_replace('/action=show_week&?/i','',$newparam); $newparam=preg_replace('/action=show_week&?/i','',$newparam);
$newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam); $newparam=preg_replace('/day=[0-9]+&?/i','',$newparam);
$newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam); $newparam=preg_replace('/month=[0-9]+&?/i','',$newparam);
$newparam=preg_replace('/year=[0-9]+&?/i','',$newparam); $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
$newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter
echo '<table width="100%" class="nocellnopadd">'; echo '<table width="100%" class="nocellnopadd">';
echo ' <tr class="liste_titre">'; echo ' <tr class="liste_titre">';
$i=0; $i=0;
@ -810,11 +812,13 @@ if (empty($action) || $action == 'show_month') // View by month
elseif ($action == 'show_week') // View by week elseif ($action == 'show_week') // View by week
{ {
$newparam=$param; // newparam is for birthday links $newparam=$param; // newparam is for birthday links
$newparam=preg_replace('/showbirthday=/i','showbirthday_=',$newparam); // To avoid replacement when replace day= is done
$newparam=preg_replace('/action=show_month&?/i','',$newparam); $newparam=preg_replace('/action=show_month&?/i','',$newparam);
$newparam=preg_replace('/action=show_week&?/i','',$newparam); $newparam=preg_replace('/action=show_week&?/i','',$newparam);
$newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam); $newparam=preg_replace('/day=[0-9]+&?/i','',$newparam);
$newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam); $newparam=preg_replace('/month=[0-9]+&?/i','',$newparam);
$newparam=preg_replace('/year=[0-9]+&?/i','',$newparam); $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
$newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter
echo '<table width="100%" class="nocellnopadd">'; echo '<table width="100%" class="nocellnopadd">';
echo ' <tr class="liste_titre">'; echo ' <tr class="liste_titre">';
$i=0; $i=0;
@ -866,9 +870,6 @@ else // View by day
$newparam=$param; // newparam is for birthday links $newparam=$param; // newparam is for birthday links
$newparam=preg_replace('/action=show_month&?/i','',$newparam); $newparam=preg_replace('/action=show_month&?/i','',$newparam);
$newparam=preg_replace('/action=show_week&?/i','',$newparam); $newparam=preg_replace('/action=show_week&?/i','',$newparam);
$newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam);
$newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam);
$newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
// Code to show just one day // Code to show just one day
$style='cal_current_month'; $style='cal_current_month';
$today=0; $today=0;

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -66,7 +67,6 @@ $stats = new PropaleStats($db, $socid, $userid);
// Build graphic number of object // Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...) // $data = array(array('Lib',val1,val2,val3),...)
@ -110,7 +110,6 @@ if (! $mesg)
// Build graphic amount of object // Build graphic amount of object
$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...) // $data = array(array('Lib',val1,val2,val3),...)
if (!$user->rights->societe->client->voir || $user->societe_id) if (!$user->rights->societe->client->voir || $user->societe_id)
@ -151,13 +150,7 @@ if (! $mesg)
$px2->draw($filenameamount,$fileurlamount); $px2->draw($filenameamount,$fileurlamount);
} }
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
$res = $stats->getAverageByMonth($year);
$data = array();
for ($i = 1 ; $i < 13 ; $i++)
{
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
}
if (!$user->rights->societe->client->voir || $user->societe_id) if (!$user->rights->societe->client->voir || $user->societe_id)
{ {
@ -177,8 +170,7 @@ $mesg = $px3->isGraphKo();
if (! $mesg) if (! $mesg)
{ {
$px3->SetData($data); $px3->SetData($data);
//$i=$startyear;$legend=array(); $i=$startyear;$legend=array();
$i=$endyear;$legend=array();
while ($i <= $endyear) while ($i <= $endyear)
{ {
$legend[]=$i; $legend[]=$i;

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -73,7 +74,7 @@ class CommandeStats extends Stats
$this->from = MAIN_DB_PREFIX.$object->table_element." as c"; $this->from = MAIN_DB_PREFIX.$object->table_element." as c";
$this->from.= ", ".MAIN_DB_PREFIX."societe as s"; $this->from.= ", ".MAIN_DB_PREFIX."societe as s";
$this->field='total_ht'; $this->field='total_ht';
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled $this->where.= " c.fk_statut > 2"; // Only approved & ordered
} }
$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; $this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;

View File

@ -1,6 +1,8 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -168,12 +170,7 @@ if (! $mesg)
} }
$res = $stats->getAverageByMonth($year); $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
$data = array();
for ($i = 1 ; $i < 13 ; $i++)
{
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
}
if (!$user->rights->societe->client->voir || $user->societe_id) if (!$user->rights->societe->client->voir || $user->societe_id)
{ {
@ -193,8 +190,7 @@ $mesg = $px3->isGraphKo();
if (! $mesg) if (! $mesg)
{ {
$px3->SetData($data); $px3->SetData($data);
//$i=$startyear;$legend=array(); $i=$startyear;$legend=array();
$i=$endyear;$legend=array();
while ($i <= $endyear) while ($i <= $endyear)
{ {
$legend[]=$i; $legend[]=$i;

View File

@ -48,6 +48,7 @@ $fieldtype = (! empty($ref) ? 'ref' :'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque',$fieldvalue,'bank_account','','',$fieldtype); $result=restrictedArea($user,'banque',$fieldvalue,'bank_account','','',$fieldtype);
$paiementtype=GETPOST('paiementtype','alpha',3);
$req_nb=GETPOST("req_nb",'',3); $req_nb=GETPOST("req_nb",'',3);
$thirdparty=GETPOST("thirdparty",'',3); $thirdparty=GETPOST("thirdparty",'',3);
$vline=GETPOST("vline"); $vline=GETPOST("vline");
@ -78,17 +79,17 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
{ {
$amount = - price2num($_POST["debit"]); $amount = - price2num($_POST["debit"]);
} }
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]); $dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
$operation=$_POST["operation"]; $operation=$_POST["operation"];
$num_chq=$_POST["num_chq"]; $num_chq=$_POST["num_chq"];
$label=$_POST["label"]; $label=$_POST["label"];
$cat1=$_POST["cat1"]; $cat1=$_POST["cat1"];
if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date"));
if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type"));
if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount"));
if (! $mesg) if (! $mesg)
{ {
$object->fetch($id); $object->fetch($id);
@ -143,15 +144,15 @@ if ($id > 0 || ! empty($ref))
} }
$result=$object->fetch($id, $ref); $result=$object->fetch($id, $ref);
// Chargement des categories bancaires dans $options // Chargement des categories bancaires dans $options
$nbcategories=0; $nbcategories=0;
$sql = "SELECT rowid, label"; $sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " WHERE entity = ".$conf->entity; $sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY label"; $sql.= " ORDER BY label";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
@ -168,7 +169,7 @@ if ($id > 0 || ! empty($ref))
} }
$db->free($result); $db->free($result);
} }
// Definition de sql_rech et param // Definition de sql_rech et param
$param=''; $param='';
$sql_rech=''; $sql_rech='';
@ -203,13 +204,13 @@ if ($id > 0 || ! empty($ref))
$param.='&amp;thirdparty='.urlencode($thirdparty); $param.='&amp;thirdparty='.urlencode($thirdparty);
$mode_search = 1; $mode_search = 1;
} }
if (GETPOST("paiementtype")) if ($paiementtype)
{ {
$sql_rech.=" AND b.fk_type = '".$db->escape(GETPOST("paiementtype"))."'"; $sql_rech.=" AND b.fk_type = '".$db->escape($paiementtype)."'";
$param.='&amp;paiementtype='.urlencode(GETPOST("paiementtype")); $param.='&amp;paiementtype='.urlencode($paiementtype);
$mode_search = 1; $mode_search = 1;
} }
$sql = "SELECT count(*) as nb"; $sql = "SELECT count(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank as b";
@ -222,7 +223,7 @@ if ($id > 0 || ! empty($ref))
$sql.= " AND b.fk_account = ba.rowid"; $sql.= " AND b.fk_account = ba.rowid";
$sql.= " AND ba.entity = ".$conf->entity; $sql.= " AND ba.entity = ".$conf->entity;
$sql.= $sql_rech; $sql.= $sql_rech;
dol_syslog("account.php count transactions - sql=".$sql, LOG_DEBUG); dol_syslog("account.php count transactions - sql=".$sql, LOG_DEBUG);
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
@ -230,7 +231,7 @@ if ($id > 0 || ! empty($ref))
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$nbline = $obj->nb; $nbline = $obj->nb;
$total_lines = $nbline; $total_lines = $nbline;
if ($nbline > $viewline ) $limit = $nbline - $viewline ; if ($nbline > $viewline ) $limit = $nbline - $viewline ;
else $limit = $viewline; else $limit = $viewline;
@ -240,7 +241,7 @@ if ($id > 0 || ! empty($ref))
{ {
dol_print_error($db); dol_print_error($db);
} }
if ($page > 0) if ($page > 0)
{ {
$limitsql = $nbline - ($page * $viewline); $limitsql = $nbline - ($page * $viewline);
@ -253,34 +254,34 @@ if ($id > 0 || ! empty($ref))
$limitsql = $nbline; $limitsql = $nbline;
} }
//print $limitsql.'-'.$page.'-'.$viewline; //print $limitsql.'-'.$page.'-'.$viewline;
// Onglets // Onglets
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>'; print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object,'ref','',1,'ref'); print $form->showrefnav($object,'ref','',1,'ref');
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>'; print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$object->label.'</td></tr>'; print '<td colspan="3">'.$object->label.'</td></tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg); dol_htmloutput_errors($mesg);
/** /**
* Search form * Search form
*/ */
$param.='&amp;account='.$object->id; $param.='&amp;account='.$object->id;
// Define transaction list navigation string // Define transaction list navigation string
$navig=''; $navig='';
$navig.='<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="GET">'; $navig.='<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="GET">';
@ -289,6 +290,7 @@ if ($id > 0 || ! empty($ref))
if ($limitsql > $viewline) $navig.='<a href="account.php?'.$param.'&amp;page='.($page+1).'">'.img_previous().'</a>'; if ($limitsql > $viewline) $navig.='<a href="account.php?'.$param.'&amp;page='.($page+1).'">'.img_previous().'</a>';
$navig.= $langs->trans("Page")." "; // ' Page '; $navig.= $langs->trans("Page")." "; // ' Page ';
$navig.='<input type="text" name="negpage" size="1" class="flat" value="'.($nbpage-$page).'">'; $navig.='<input type="text" name="negpage" size="1" class="flat" value="'.($nbpage-$page).'">';
$navig.='<input type="hidden" name="paiementtype" value="'.$paiementtype.'">';
$navig.='<input type="hidden" name="req_nb" value="'.$req_nb.'">'; $navig.='<input type="hidden" name="req_nb" value="'.$req_nb.'">';
$navig.='<input type="hidden" name="req_desc" value="'.GETPOST("req_desc").'">'; $navig.='<input type="hidden" name="req_desc" value="'.GETPOST("req_desc").'">';
$navig.='<input type="hidden" name="req_debit" value="'.GETPOST("req_debit").'">'; $navig.='<input type="hidden" name="req_debit" value="'.GETPOST("req_debit").'">';
@ -303,7 +305,7 @@ if ($id > 0 || ! empty($ref))
} }
$navig.='</form>'; $navig.='</form>';
//var_dump($navig); //var_dump($navig);
// Confirmation delete // Confirmation delete
if ($action == 'delete') if ($action == 'delete')
{ {
@ -311,15 +313,15 @@ if ($id > 0 || ! empty($ref))
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete'); $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete');
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
print '<table class="notopnoleftnoright" width="100%">'; print '<table class="notopnoleftnoright" width="100%">';
// Show title // Show title
if ($action != 'addline' && $action != 'delete') if ($action != 'addline' && $action != 'delete')
{ {
print '<tr><td colspan="9" align="right">'.$navig.'</td></tr>'; print '<tr><td colspan="9" align="right">'.$navig.'</td></tr>';
} }
// Form to add a transaction with no invoice // Form to add a transaction with no invoice
if ($user->rights->banque->modifier && $action == 'addline') if ($user->rights->banque->modifier && $action == 'addline')
{ {
@ -328,11 +330,11 @@ if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="vline" value="'.$vline.'">'; print '<input type="hidden" name="vline" value="'.$vline.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<tr>'; print '<tr>';
print '<td align="left" colspan="10"><b>'.$langs->trans("AddBankRecordLong").'</b></td>'; print '<td align="left" colspan="10"><b>'.$langs->trans("AddBankRecordLong").'</b></td>';
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td>'; print '<td>'.$langs->trans("Date").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
@ -343,7 +345,7 @@ if ($id > 0 || ! empty($ref))
print '<td align=right>'.$langs->trans("Credit").'</td>'; print '<td align=right>'.$langs->trans("Credit").'</td>';
print '<td colspan="2" align="center">&nbsp;</td>'; print '<td colspan="2" align="center">&nbsp;</td>';
print '</tr>'; print '</tr>';
print '<tr '.$bc[false].'>'; print '<tr '.$bc[false].'>';
print '<td nowrap="nowrap" colspan="2">'; print '<td nowrap="nowrap" colspan="2">';
$form->select_date($dateop,'op',0,0,0,'transaction'); $form->select_date($dateop,'op',0,0,0,'transaction');
@ -366,14 +368,14 @@ if ($id > 0 || ! empty($ref))
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
print '</td></tr>'; print '</td></tr>';
print "</form>"; print "</form>";
print '<tr class="noborder"><td colspan="8">&nbsp;</td></tr>'."\n"; print '<tr class="noborder"><td colspan="8">&nbsp;</td></tr>'."\n";
} }
/* /*
* Affiche tableau des transactions bancaires * Affiche tableau des transactions bancaires
*/ */
// Ligne de titre tableau des ecritures // Ligne de titre tableau des ecritures
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td>'; print '<td>'.$langs->trans("Date").'</td>';
@ -389,19 +391,19 @@ if ($id > 0 || ! empty($ref))
if ($object->type != 2 && $object->rappro) print $langs->trans("AccountStatementShort"); if ($object->type != 2 && $object->rappro) print $langs->trans("AccountStatementShort");
else print '&nbsp;'; else print '&nbsp;';
print '</td></tr>'; print '</td></tr>';
print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param.'" name="search" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param.'" name="search" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="search">'; print '<input type="hidden" name="action" value="search">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>'; print '<td>';
//$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...)
$filtertype=''; $filtertype='';
print $form->select_types_paiements($_REQUEST['paiementtype'],'paiementtype',$filtertype,2,1,1,8); print $form->select_types_paiements($paiementtype,'paiementtype',$filtertype,2,1,1,8);
print '</td>'; print '</td>';
print '<td><input type="text" class="flat" name="req_nb" value="'.$req_nb.'" size="2"></td>'; print '<td><input type="text" class="flat" name="req_nb" value="'.$req_nb.'" size="2"></td>';
print '<td><input type="text" class="flat" name="req_desc" value="'.GETPOST("req_desc").'" size="24"></td>'; print '<td><input type="text" class="flat" name="req_desc" value="'.GETPOST("req_desc").'" size="24"></td>';
@ -412,13 +414,13 @@ if ($id > 0 || ! empty($ref))
print '<td align="center" width="40"><input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>'; print '<td align="center" width="40"><input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print "</tr>\n"; print "</tr>\n";
print "</form>\n"; print "</form>\n";
/* /*
* Another solution * Another solution
* create temporary table solde type=heap select amount from llx_bank limit 100 ; * create temporary table solde type=heap select amount from llx_bank limit 100 ;
* select sum(amount) from solde ; * select sum(amount) from solde ;
*/ */
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type";
if ($mode_search) if ($mode_search)
@ -428,11 +430,11 @@ if ($id > 0 || ! empty($ref))
/* /*
if ($mode_search && $conf->adherent->enabled) if ($mode_search && $conf->adherent->enabled)
{ {
} }
if ($mode_search && $conf->tax->enabled) if ($mode_search && $conf->tax->enabled)
{ {
} }
*/ */
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
@ -459,22 +461,22 @@ if ($id > 0 || ! empty($ref))
$sql.= $sql_rech; $sql.= $sql_rech;
$sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day $sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
$sql.= $db->plimit($limitsql, 0); $sql.= $db->plimit($limitsql, 0);
dol_syslog("account.php get transactions - sql=".$sql, LOG_DEBUG); dol_syslog("account.php get transactions - sql=".$sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$now=dol_now(); $now=dol_now();
$nows=dol_print_date($now,'%Y%m%d'); $nows=dol_print_date($now,'%Y%m%d');
//$form->load_cache_types_paiements(); //$form->load_cache_types_paiements();
//$form->cache_types_paiements //$form->cache_types_paiements
$var=true; $var=true;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $total = 0; $sep = 0; $i = 0; $total = 0; $sep = 0;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
@ -482,7 +484,7 @@ if ($id > 0 || ! empty($ref))
if ($i >= ($nbline - $viewline)) if ($i >= ($nbline - $viewline))
{ {
$var=!$var; $var=!$var;
// Is it a transaction in future ? // Is it a transaction in future ?
$dos=dol_print_date($db->jdate($objp->do),'%Y%m%d'); $dos=dol_print_date($db->jdate($objp->do),'%Y%m%d');
//print "dos=".$dos." nows=".$nows; //print "dos=".$dos." nows=".$nows;
@ -496,26 +498,26 @@ if ($id > 0 || ! empty($ref))
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
print '</tr>'; print '</tr>';
} }
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n"; print '<td nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
print '<td nowrap="nowrap">'.dol_print_date($db->jdate($objp->dv),"day"); print '<td nowrap="nowrap">'.dol_print_date($db->jdate($objp->dv),"day");
print "</td>\n"; print "</td>\n";
// Payment type // Payment type
print "<td nowrap>"; print "<td nowrap>";
$label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type; $label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type;
// $label=$langs->getTradFromKey("PaymentTypeShort".$objp->fk_type); // $label=$langs->getTradFromKey("PaymentTypeShort".$objp->fk_type);
if ($objp->fk_type == 'SOLD') $label='&nbsp;'; if ($objp->fk_type == 'SOLD') $label='&nbsp;';
print $label; print $label;
print "</td>\n"; print "</td>\n";
// Num // Num
print '<td nowrap>'.($objp->num_chq?$objp->num_chq:"")."</td>\n"; print '<td nowrap>'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
// Description // Description
print '<td>'; print '<td>';
// Show generic description // Show generic description
@ -545,7 +547,7 @@ if ($id > 0 || ! empty($ref))
} }
else if ($links[$key]['type']=='company') else if ($links[$key]['type']=='company')
{ {
} }
else if ($links[$key]['type']=='payment_sc') else if ($links[$key]['type']=='payment_sc')
{ {
@ -567,11 +569,11 @@ if ($id > 0 || ! empty($ref))
} }
else if ($links[$key]['type']=='member') else if ($links[$key]['type']=='member')
{ {
} }
else if ($links[$key]['type']=='sc') else if ($links[$key]['type']=='sc')
{ {
} }
else else
{ {
@ -592,7 +594,7 @@ if ($id > 0 || ! empty($ref))
} }
} }
print '</td>'; print '</td>';
// Add third party column // Add third party column
print '<td>'; print '<td>';
foreach($links as $key=>$val) foreach($links as $key=>$val)
@ -627,7 +629,7 @@ if ($id > 0 || ! empty($ref))
} }
} }
print '</td>'; print '</td>';
// Amount // Amount
if ($objp->amount < 0) if ($objp->amount < 0)
{ {
@ -637,7 +639,7 @@ if ($id > 0 || ! empty($ref))
{ {
print '<td>&nbsp;</td><td align="right" nowrap="nowrap">&nbsp;'.price($objp->amount).'</td>'."\n"; print '<td>&nbsp;</td><td align="right" nowrap="nowrap">&nbsp;'.price($objp->amount).'</td>'."\n";
} }
// Balance // Balance
if ($action != 'search') if ($action != 'search')
{ {
@ -654,7 +656,7 @@ if ($id > 0 || ! empty($ref))
{ {
print '<td align="right">-</td>'; print '<td align="right">-</td>';
} }
// Transaction reconciliated or edit link // Transaction reconciliated or edit link
if ($objp->rappro && $object->canBeConciliated() > 0) // If line not conciliated and account can be conciliated if ($objp->rappro && $object->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
{ {
@ -697,13 +699,13 @@ if ($id > 0 || ! empty($ref))
} }
print '</td>'; print '</td>';
} }
print "</tr>"; print "</tr>";
} }
$i++; $i++;
} }
// Show total // Show total
if ($page == 0 && ! $mode_search) if ($page == 0 && ! $mode_search)
{ {
@ -721,19 +723,19 @@ if ($id > 0 || ! empty($ref))
{ {
dol_print_error($db); dol_print_error($db);
} }
print "</table>"; print "</table>";
print "\n</div>\n"; print "\n</div>\n";
/* /*
* Boutons actions * Boutons actions
*/ */
if ($action != 'delete') if ($action != 'delete')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate
{ {
if ($user->rights->banque->consolidate) if ($user->rights->banque->consolidate)
@ -745,7 +747,7 @@ if ($id > 0 || ! empty($ref))
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>'; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
} }
} }
if ($action != 'addline') if ($action != 'addline')
{ {
if ($user->rights->banque->modifier) if ($user->rights->banque->modifier)
@ -757,10 +759,10 @@ if ($id > 0 || ! empty($ref))
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>'; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
} }
} }
print '</div>'; print '</div>';
} }
print '<br>'; print '<br>';
} }
else else
@ -771,4 +773,4 @@ else
llxFooter(); llxFooter();
$db->close(); $db->close();
?> ?>

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -137,12 +138,7 @@ if (! $mesg)
} }
$res = $stats->getAverageByMonth($year); $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
$data = array();
for ($i = 1 ; $i < 13 ; $i++)
{
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
}
if (!$user->rights->societe->client->voir || $user->societe_id) if (!$user->rights->societe->client->voir || $user->societe_id)
{ {
@ -162,8 +158,7 @@ $mesg = $px3->isGraphKo();
if (! $mesg) if (! $mesg)
{ {
$px3->SetData($data); $px3->SetData($data);
//$i=$startyear;$legend=array(); $i = $startyear;$legend=array();
$i=$endyear;$legend=array();
while ($i <= $endyear) while ($i <= $endyear)
{ {
$legend[]=$i; $legend[]=$i;

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -148,12 +149,7 @@ if (! $mesg)
} }
$res = $stats->getAverageByMonth($year); $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
$data = array();
for ($i = 1 ; $i < 13 ; $i++)
{
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
}
if (!$user->rights->societe->client->voir || $user->societe_id) if (!$user->rights->societe->client->voir || $user->societe_id)
{ {
@ -173,8 +169,7 @@ $mesg = $px3->isGraphKo();
if (! $mesg) if (! $mesg)
{ {
$px3->SetData($data); $px3->SetData($data);
//$i=$startyear;$legend=array(); $i = $startyear;$legend=array();
$i=$endyear;$legend=array();
while ($i <= $endyear) while ($i <= $endyear)
{ {
$legend[]=$i; $legend[]=$i;

View File

@ -87,16 +87,21 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS); $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
$idpays = $p[0]; $idpays = $p[0];
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client , fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
$sql.= " p.accountancy_code_sell, s.code_compta , ct.accountancy_code"; $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
$sql.= " ct.accountancy_code";
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd"; $sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc"; $sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
$sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity; $sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_statut > 0";
$sql.= " AND fd.product_type IN (0,1)";
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql .= " order by f.rowid"; $sql.= " ORDER BY f.rowid";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)

View File

@ -216,6 +216,21 @@ if ($action == 'builddoc' && $user->rights->banque->cheque)
} }
} }
// Remove file in doc form
else if ($action == 'remove_file' && $user->rights->banque->cheque)
{
$remisecheque = new RemiseCheque($db);
if ($remisecheque->fetch($_GET["id"]) > 0)
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$langs->load("other");
$file=$dir.get_exdir($remisecheque->number,2,1) . GETPOST('file');
$ret=dol_delete_file($file);
}
}
/* /*
* View * View

View File

@ -69,7 +69,7 @@ class FormActions
print '<script type="text/javascript">'."\n"; print '<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function () {'."\n"; print 'jQuery(document).ready(function () {'."\n";
print 'jQuery("#select'.$htmlname.'").change(function() { select_status(document.'.$formname.'.status.value); });'."\n"; print 'jQuery("#select'.$htmlname.'").change(function() { select_status(document.'.$formname.'.status.value); });'."\n";
print 'jQuery("#val'.$htmlname.'").change(function() { select_status(document.'.$formname.'.status.value); });'."\n"; print 'jQuery("#val'.$htmlname.'").change(function() { select_status(jQuery("#val'.$htmlname.'").val()); });'."\n";
print 'select_status(document.'.$formname.'.status.value);'."\n"; print 'select_status(document.'.$formname.'.status.value);'."\n";
print '});'."\n"; print '});'."\n";
print 'function select_status(mypercentage) {'."\n"; print 'function select_status(mypercentage) {'."\n";
@ -78,7 +78,7 @@ class FormActions
print 'if (mypercentage == -1) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").hide(); }'."\n"; print 'if (mypercentage == -1) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").hide(); }'."\n";
print 'else if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").show();}'."\n"; print 'else if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").show();}'."\n";
print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").show();}'."\n"; print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").show();}'."\n";
print 'else { document.'.$formname.'.percentageshown.disabled=false; }'."\n"; print 'else { document.'.$formname.'.percentageshown.disabled=false; jQuery(".hideifna").show();}'."\n";
print '}'."\n"; print '}'."\n";
print '</script>'."\n"; print '</script>'."\n";
print '<select '.($canedit?'':'disabled="disabled" ').'name="status" id="select'.$htmlname.'" class="flat">'; print '<select '.($canedit?'':'disabled="disabled" ').'name="status" id="select'.$htmlname.'" class="flat">';

View File

@ -1,6 +1,8 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -103,6 +105,42 @@ abstract class Stats
return $data; return $data;
} }
/**
* Return average of entity by month for several years
*
* @param int $endyear Start year
* @param int $startyear End year
* @return array Array of values
*/
function getAverageByMonthWithPrevYear($endyear,$startyear)
{
if ($startyear > $endyear) return -1;
$datay=array();
$year=$startyear;
while($year <= $endyear)
{
$datay[$year] = $this->getAverageByMonth($year);
$year++;
}
$data = array();
for ($i = 0 ; $i < 12 ; $i++)
{
$data[$i][]=$datay[$endyear][$i][0];
$year=$startyear;
while($year <= $endyear)
{
$data[$i][]=$datay[$year][$i][1];
$year++;
}
}
return $data;
}
/** /**
* Return nb of elements by year * Return nb of elements by year
@ -295,7 +333,16 @@ abstract class Stats
$res[$i] = $result[$i] + 0; $res[$i] = $result[$i] + 0;
} }
return $res; $data = array();
for ($i = 1 ; $i < 13 ; $i++)
{
$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b");
$month=dol_substr($month,0,3);
$data[$i-1] = array(ucfirst($month), $res[$i]);
}
return $data;
} }
} }

View File

@ -232,8 +232,8 @@ function displayBox($selectedDate,$month,$year)
// Sur click dans calendrier, appelle fonction dpClickDay // Sur click dans calendrier, appelle fonction dpClickDay
echo "<TD class=\"".$dayclass."\""; echo "<TD class=\"".$dayclass."\"";
echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",".dol_print_date($thedate,"%m").",".$mydate["mday"].",tradMonths)\""; echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",tradMonths)\"";
echo " onClick=\"dpClickDay(".$mydate["year"].",".dol_print_date($thedate,"%m").",".$mydate["mday"].",'".$langs->trans("FormatDateShortJava")."')\""; echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJava")."')\"";
echo ">".sprintf("%02s",$mydate["mday"])."</TD>"; echo ">".sprintf("%02s",$mydate["mday"])."</TD>";
$cols++; $cols++;

View File

@ -253,7 +253,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
// Replace for encrypt data // Replace for encrypt data
if (preg_match_all('/__ENCRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) if (preg_match_all('/__ENCRYPT\(\'([A-Za-z0-9_]+)\'\)__/i',$newsql,$reg))
{ {
$num=count($reg[0]); $num=count($reg[0]);
@ -266,7 +266,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
} }
// Replace for decrypt data // Replace for decrypt data
if (preg_match_all('/__DECRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) if (preg_match_all('/__DECRYPT\(\'([A-Za-z0-9_]+)\'\)__/i',$newsql,$reg))
{ {
$num=count($reg[0]); $num=count($reg[0]);
@ -1138,15 +1138,15 @@ function form_constantes($tableau)
function addDocumentModel($name, $type, $label='', $description='') function addDocumentModel($name, $type, $label='', $description='')
{ {
global $db, $conf; global $db, $conf;
$db->begin(); $db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($name)."','".$type."',".$conf->entity.", "; $sql.= " VALUES ('".$db->escape($name)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", "; $sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($description)?"'".$db->escape($description)."'":"null"); $sql.= (! empty($description)?"'".$db->escape($description)."'":"null");
$sql.= ")"; $sql.= ")";
dol_syslog("admin.lib::addDocumentModel sql=".$sql); dol_syslog("admin.lib::addDocumentModel sql=".$sql);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -1172,9 +1172,9 @@ function addDocumentModel($name, $type, $label='', $description='')
function delDocumentModel($name, $type) function delDocumentModel($name, $type)
{ {
global $db, $conf; global $db, $conf;
$db->begin(); $db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$db->escape($name)."'"; $sql.= " WHERE nom = '".$db->escape($name)."'";
$sql.= " AND type = '".$type."'"; $sql.= " AND type = '".$type."'";

View File

@ -62,7 +62,7 @@ abstract class DolibarrModules
*/ */
function _init($array_sql, $options='') function _init($array_sql, $options='')
{ {
global $langs; global $conf, $langs;
$err=0; $err=0;
$this->db->begin(); $this->db->begin();
@ -113,6 +113,9 @@ abstract class DolibarrModules
$sql=$val; $sql=$val;
} }
// Add current entity id
$sql=str_replace('__ENTITY__', $conf->entity, $sql);
dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror." sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror." sql=".$sql, LOG_DEBUG);
$result=$this->db->query($sql); $result=$this->db->query($sql);
if (! $result) if (! $result)

View File

@ -112,9 +112,16 @@ class modBarcode extends DolibarrModules
// Permissions // Permissions
$this->remove($options); $this->remove($options);
$sql = array(); $sql = array(
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("EAN8", "EAN8", 0, "1234567", __ENTITY__)','ignoreerror'=>1),
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("EAN13", "EAN13", 0, "123456789012", __ENTITY__)','ignoreerror'=>1),
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("UPC", "UPC", 0, "123456789012", __ENTITY__)','ignoreerror'=>1),
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("ISBN", "ISBN", 0, "123456789", __ENTITY__)','ignoreerror'=>1),
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("C39", "Code 39", 0, "1234567890", __ENTITY__)','ignoreerror'=>1),
array('sql'=>'INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ("C128", "Code 128", 0, "ABCD1234567890", __ENTITY__)','ignoreerror'=>1)
);
return $this->_init($sql,$options); return $this->_init($sql, $options);
} }
/** /**
@ -129,7 +136,7 @@ class modBarcode extends DolibarrModules
{ {
$sql = array(); $sql = array();
return $this->_remove($sql,$options); return $this->_remove($sql, $options);
} }
} }

View File

@ -211,8 +211,8 @@ class modExpedition extends DolibarrModules
$sql = array( $sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','shipping',".$conf->entity.")", "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','shipping',".$conf->entity.")",
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[1][2]."' AND entity = ".$conf->entity, "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[2][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[1][2]."','delivery',".$conf->entity.")", "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[2][2]."','delivery',".$conf->entity.")",
); );
return $this->_init($sql,$options); return $this->_init($sql,$options);

View File

@ -1,37 +0,0 @@
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@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
-- the Free Software Foundation; either version 2 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/>.
--
--
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
--
-- Codes barres
--
INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (1, 'EAN8', 'EAN8', 0, '1234567');
INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (2, 'EAN13', 'EAN13', 0, '123456789012');
INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (3, 'UPC', 'UPC', 0, '123456789012');
INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (4, 'ISBN', 'ISBN', 0, '123456789');
INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (5, 'C39', 'Code 39', 0, '1234567890');
INSERT INTO llx_c_barcode_type (rowid, code, libelle, coder, example) VALUES (6, 'C128', 'Code 128', 0, 'ABCD1234567890');

View File

@ -35,6 +35,7 @@ insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_N
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_FEATURES_LEVEL','0','chaine','Level of features to show (0=stable only, 1=stable+experimental, 2=stable+experimental+development',1,0); insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_FEATURES_LEVEL','0','chaine','Level of features to show (0=stable only, 1=stable+experimental, 2=stable+experimental+development',1,0);
-- Hidden and common to all entities -- Hidden and common to all entities
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_FILE_ON','1','chaine','Log to file Directory where to write log file',0,0);
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_FILE','DOL_DATA_ROOT/dolibarr.log','chaine','Directory where to write log file',0,0); insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_FILE','DOL_DATA_ROOT/dolibarr.log','chaine','Directory where to write log file',0,0);
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_LEVEL','7','chaine','Level of debug info to show',0,0); insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_LEVEL','7','chaine','Level of debug info to show',0,0);

View File

@ -456,3 +456,7 @@ ALTER TABLE llx_product_fournisseur_price MODIFY fk_product_fournisseur integer
UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; UPDATE llx_product SET canvas = NULL where canvas = 'default@product';
UPDATE llx_product SET canvas = NULL where canvas = 'product@product'; UPDATE llx_product SET canvas = NULL where canvas = 'product@product';
UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; UPDATE llx_product SET canvas = NULL where canvas = 'service@product';
DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'SOCIETE_CODECOMPTA_ADDON' AND __DECRYPT('value')__ = 'mod_codecompta_digitaria';
ALTER TABLE llx_c_barcode_type ADD UNIQUE INDEX uk_c_barcode_type(code, entity);

View File

@ -47,6 +47,8 @@ UPDATE llx_product SET canvas = NULL where canvas = 'default@product';
DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def); DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def);
DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery';
-- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid -- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid
-- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note) -- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note)

View File

@ -0,0 +1,19 @@
-- ========================================================================
-- Copyright (C) 2012 Regis Houssin <regis@dolibarr.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 2 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/>.
--
-- ========================================================================
ALTER TABLE llx_c_barcode_type ADD UNIQUE INDEX uk_c_barcode_type(code, entity);

View File

@ -36,7 +36,7 @@ $langs->load("admin");
$langs->load("products"); $langs->load("products");
// Security check // Security check
if (! $user->admin || empty($conf->product->enabled)) if (! $user->admin || (empty($conf->product->enabled) && empty($conf->service->enabled)))
accessforbidden(); accessforbidden();
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -87,7 +88,7 @@ $head = product_admin_prepare_head(null, $tab);
dol_fiche_head($head, 'attributes', $tab, 0, 'product'); dol_fiche_head($head, 'attributes', $tab, 0, 'product');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n"; print $langs->trans('DefineHereComplementaryAttributes', $tab).'<br>'."\n";
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg); dol_htmloutput_errors($mesg);

View File

@ -604,6 +604,7 @@ class Project extends CommonObject
if (!$error) if (!$error)
{ {
$this->statut = 2;
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }

View File

@ -44,11 +44,11 @@ $ref= GETPOST('ref','alpha');
$withproject=GETPOST('withproject','int'); $withproject=GETPOST('withproject','int');
$project_ref = GETPOST('project_ref','alpha'); $project_ref = GETPOST('project_ref','alpha');
$mesg=''; $mesg='';
if (isset($_SESSION['DolMessage'])) if (isset($_SESSION['DolMessage']))
{ {
$mesg=$_SESSION['DolMessage']; $mesg=$_SESSION['DolMessage'];
unset($_SESSION['DolMessage']); unset($_SESSION['DolMessage']);
} }
// Security check // Security check
@ -79,55 +79,6 @@ $projectstatic = new Project($db);
* Actions * Actions
*/ */
// Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if (dol_mkdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
{
// Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
// Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
}
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
}
else
{
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
}
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
}
else // Known error
{
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
}
}
}
}
// Delete
if ($action=='delete')
{
$langs->load("other");
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit;
}
// Retreive First Task ID of Project if withprojet is on to allow project prev next to work // Retreive First Task ID of Project if withprojet is on to allow project prev next to work
if (! empty($project_ref) && ! empty($withproject)) if (! empty($project_ref) && ! empty($withproject))
{ {
@ -164,6 +115,56 @@ if ($id > 0 || ! empty($ref))
} }
} }
// Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if (dol_mkdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
{
// Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
// Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
}
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
}
else
{
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
}
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
}
else // Known error
{
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
}
}
}
}
// Delete
if ($action=='delete')
{
$langs->load("other");
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit;
}
/* /*
* View * View
*/ */

View File

@ -46,17 +46,17 @@ if (!$user->rights->projet->lire) accessforbidden();
$object = new Task($db); $object = new Task($db);
$projectstatic = new Project($db); $projectstatic = new Project($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
if ($object->fetch($id,$ref) > 0) if ($object->fetch($id,$ref) > 0)
{ {
$projectstatic->fetch($object->fk_project); $projectstatic->fetch($object->fk_project);
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
} }
} }
@ -78,18 +78,20 @@ if (! empty($project_ref) && ! empty($withproject))
} }
} }
$permission=($user->rights->projet->creer || $user->rights->projet->all->creer);
/* /*
* Actions * Actions
*/ */
if ($action == 'setnote_public' && $user->rights->ficheinter->creer) if ($action == 'setnote_public' && ! empty($permission))
{ {
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
else if ($action == 'setnote_private' && $user->rights->ficheinter->creer) else if ($action == 'setnote_private' && ! empty($permission))
{ {
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
@ -203,7 +205,6 @@ if ($object->id > 0)
print '<br>'; print '<br>';
$colwidth=30; $colwidth=30;
$permission=($user->rights->projet->creer || $user->rights->projet->all->creer);
$moreparam=$param; $moreparam=$param;
include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'); include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');

View File

@ -3,6 +3,7 @@
* Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -537,6 +538,10 @@ if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)
{ {
// $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount
$amount=0; $amount=0;
if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
$amount=$conf->global->MEMBER_NEWFORM_AMOUNT;
}
if (! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) if (! empty($conf->global->MEMBER_NEWFORM_PAYONLINE))
{ {
$amount=GETPOST('amount')?GETPOST('amount'):$conf->global->MEMBER_NEWFORM_AMOUNT; $amount=GETPOST('amount')?GETPOST('amount'):$conf->global->MEMBER_NEWFORM_AMOUNT;

View File

@ -1984,10 +1984,10 @@ class User extends CommonObject
* Return number of existing users * Return number of existing users
* *
* @param string $limitTo Limit to 'active' or 'superadmin' users * @param string $limitTo Limit to 'active' or 'superadmin' users
* @param int $all Return for all entities * @param bool $all Return for all entities
* @return int Number of users * @return int Number of users
*/ */
function getNbOfUsers($limitTo='',$all=0) function getNbOfUsers($limitTo='active', $all=false)
{ {
global $conf; global $conf;
@ -1999,7 +1999,7 @@ class User extends CommonObject
} }
else else
{ {
if ($all) $sql.= " WHERE entity IS NOT NULL"; // all users except superadmin if ($all) $sql.= " WHERE entity > 0"; // all users except superadmins
else $sql.= " WHERE entity = ".$conf->entity; else $sql.= " WHERE entity = ".$conf->entity;
if ($limitTo == 'active') $sql.= " AND statut = 1"; if ($limitTo == 'active') $sql.= " AND statut = 1";
} }

View File

@ -123,7 +123,7 @@ if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser)
if (!empty($conf->file->main_limit_users)) if (!empty($conf->file->main_limit_users))
{ {
$nb = $edituser->getNbOfUsers("active",1); $nb = $edituser->getNbOfUsers("active");
if ($nb >= $conf->file->main_limit_users) if ($nb >= $conf->file->main_limit_users)
{ {
$message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>'; $message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>';
@ -178,7 +178,7 @@ if ($action == 'add' && $canadduser)
if (! empty($conf->file->main_limit_users)) // If option to limit users is set if (! empty($conf->file->main_limit_users)) // If option to limit users is set
{ {
$nb = $edituser->getNbOfUsers("active",1); $nb = $edituser->getNbOfUsers("active");
if ($nb >= $conf->file->main_limit_users) if ($nb >= $conf->file->main_limit_users)
{ {
$message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>'; $message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>';