diff --git a/COPYRIGHT b/COPYRIGHT index a86542700a2..d368f02d2e1 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -51,6 +51,7 @@ Copyright (C) 2012 - Juanjo Menent - Philippe Grand - Jean Heimburger +- Marcos García Copyright (C) 2011 - Laurent Destailleur diff --git a/ChangeLog b/ChangeLog index f9ef57c2d07..3310347ae10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,8 +18,17 @@ English Dolibarr ChangeLog - Fix: Allows to use a comma decimal separator in supplier invoices payments. - Fix: Translation for tr_TR, es_ES, pt_BR. - 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 ***** WARNING: PHP lower than 5.x are no more supported. diff --git a/build/pad/DoliWamp.pml b/build/pad/DoliWamp.pml index 6173d13eb8d..85ce4490c41 100644 --- a/build/pad/DoliWamp.pml +++ b/build/pad/DoliWamp.pml @@ -4,7 +4,7 @@ DoliWamp - 3.2..0 + 3.2.1 05 10 2012 diff --git a/build/pad/Dolibarr.pml b/build/pad/Dolibarr.pml index 7656ab96a22..a52f8dc1d76 100644 --- a/build/pad/Dolibarr.pml +++ b/build/pad/Dolibarr.pml @@ -4,7 +4,7 @@ Dolibarr - 3.2.0 + 3.2.1 05 10 2012 diff --git a/build/pad/pad_dolibarr.xml b/build/pad/pad_dolibarr.xml index 8b85e501dd7..32cbc5f9233 100644 --- a/build/pad/pad_dolibarr.xml +++ b/build/pad/pad_dolibarr.xml @@ -34,9 +34,9 @@ Dolibarr - 3.2.0 - 06 - 18 + 3.2.1 + 08 + 10 2012 diff --git a/build/pad/pad_doliwamp.xml b/build/pad/pad_doliwamp.xml index 84f9d2eee96..1060275c535 100644 --- a/build/pad/pad_doliwamp.xml +++ b/build/pad/pad_doliwamp.xml @@ -34,9 +34,9 @@ DoliWamp - 3.2.0 - 06 - 18 + 3.2.1 + 08 + 10 2012 diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index bfc17e21f81..bbf9297917c 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -708,36 +708,43 @@ class Adherent extends CommonObject $resql=$this->db->query($sql); if ($resql) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); - $resql=$this->db->query($sql); - if ($resql) - { - if ($this->db->affected_rows($resql)) - { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - - $this->db->commit(); - return 1; - } - else - { - // Rien a effacer - $this->db->rollback(); - return 0; - } - } - else - { - $this->error=$this->db->error(); - $this->db->rollback(); - return -3; - } + // Remove linked user + $ret=$this->setUserId(0); + if ($ret > 0) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid; + dol_syslog(get_class($this)."::delete sql=".$sql); + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->affected_rows($resql)) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + + $this->db->commit(); + return 1; + } + else + { + // Rien a effacer + $this->db->rollback(); + return 0; + } + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -3; + } + } } else { diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 9b0d1895e1b..286095a337d 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -247,7 +247,7 @@ if ($resql) $statictype->libelle=$obj->libelle; print ''.$staticmember->getNomUrl(1,24).''; print ''.$statictype->getNomUrl(1,16).''; - print ''.dol_print_date($db->jdate($obj->date_end),'dayhour').''; + print ''.dol_print_date($db->jdate($obj->datem),'dayhour').''; print ''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).''; print ''; $i++; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index f87df7b6ea9..bf84a84b82d 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011 Juanjo Menent +/* Copyright (C) 2003-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -112,7 +112,7 @@ $dirbarcode=array_merge(array("/core/modules/barcode/"),$conf->barcode_modules); foreach($dirbarcode as $reldir) { - $dir=dol_buildpath($reldir,0); + $dir=dol_buildpath($reldir); $newdir=dol_osencode($dir); // 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(); llxFooter(); -?> \ No newline at end of file +?> diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index fe686d85bd1..5a1b4bdff9d 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -158,7 +158,7 @@ if ($what == 'mysql') if (! empty($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 ''.$langs->trans("RunCommandSummary").':
'."\n"; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 2efad0d3cf4..ccdcbb37a72 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -447,7 +447,7 @@ if ($action == 'create') print ''.$langs->trans("Title").''; // Full day - print ''.$langs->trans("EventOnFullDay").''; + print ''.$langs->trans("EventOnFullDay").''; // Date start $datep=$actioncomm->datep; @@ -687,7 +687,7 @@ if ($id) print ''.$langs->trans("Title").''; // Full day event - print ''.$langs->trans("EventOnFullDay").'fulldayevent?' checked="checked"':'').'>'; + print ''.$langs->trans("EventOnFullDay").'fulldayevent?' checked="checked"':'').'>'; // Date start print ''.$langs->trans("DateActionStart").''; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 6ff8843da54..d1f35271f2f 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -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 { $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_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('/day=[0-9]+&?/i','',$newparam); + $newparam=preg_replace('/month=[0-9]+&?/i','',$newparam); $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam); + $newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter echo ''; echo ' '; $i=0; @@ -810,11 +812,13 @@ if (empty($action) || $action == 'show_month') // View by month elseif ($action == 'show_week') // View by week { $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_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('/day=[0-9]+&?/i','',$newparam); + $newparam=preg_replace('/month=[0-9]+&?/i','',$newparam); $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam); + $newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter echo '
'; echo ' '; $i=0; @@ -866,9 +870,6 @@ else // View by day $newparam=$param; // newparam is for birthday links $newparam=preg_replace('/action=show_month&?/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 $style='cal_current_month'; $today=0; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index ea786ed80c7..8e96c9982cf 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -1,7 +1,8 @@ * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García * * 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 @@ -66,7 +67,6 @@ $stats = new PropaleStats($db, $socid, $userid); // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); -//var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) @@ -110,7 +110,6 @@ if (! $mesg) // Build graphic amount of object $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); -//var_dump($data); // $data = array(array('Lib',val1,val2,val3),...) if (!$user->rights->societe->client->voir || $user->societe_id) @@ -151,13 +150,7 @@ if (! $mesg) $px2->draw($filenameamount,$fileurlamount); } - -$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]); -} +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -177,8 +170,7 @@ $mesg = $px3->isGraphKo(); if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index e8aa6c6ffea..aca6e1a1ab8 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -1,7 +1,8 @@ * Copyright (c) 2005 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García * * 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 @@ -73,7 +74,7 @@ class CommandeStats extends Stats $this->from = MAIN_DB_PREFIX.$object->table_element." as c"; $this->from.= ", ".MAIN_DB_PREFIX."societe as s"; $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; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 722a8a3f35f..f12d5bb309d 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -1,6 +1,8 @@ * Copyright (c) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García * * 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 @@ -168,12 +170,7 @@ if (! $mesg) } -$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]); -} +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -193,8 +190,7 @@ $mesg = $px3->isGraphKo(); if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i=$startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 5e2cba398e3..ad5205c99eb 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -48,6 +48,7 @@ $fieldtype = (! empty($ref) ? 'ref' :'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque',$fieldvalue,'bank_account','','',$fieldtype); +$paiementtype=GETPOST('paiementtype','alpha',3); $req_nb=GETPOST("req_nb",'',3); $thirdparty=GETPOST("thirdparty",'',3); $vline=GETPOST("vline"); @@ -78,17 +79,17 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu { $amount = - price2num($_POST["debit"]); } - + $dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]); $operation=$_POST["operation"]; $num_chq=$_POST["num_chq"]; $label=$_POST["label"]; $cat1=$_POST["cat1"]; - + if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date")); if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount")); - + if (! $mesg) { $object->fetch($id); @@ -143,15 +144,15 @@ if ($id > 0 || ! empty($ref)) } $result=$object->fetch($id, $ref); - + // Chargement des categories bancaires dans $options $nbcategories=0; - + $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " WHERE entity = ".$conf->entity; $sql.= " ORDER BY label"; - + $result = $db->query($sql); if ($result) { @@ -168,7 +169,7 @@ if ($id > 0 || ! empty($ref)) } $db->free($result); } - + // Definition de sql_rech et param $param=''; $sql_rech=''; @@ -203,13 +204,13 @@ if ($id > 0 || ! empty($ref)) $param.='&thirdparty='.urlencode($thirdparty); $mode_search = 1; } - if (GETPOST("paiementtype")) + if ($paiementtype) { - $sql_rech.=" AND b.fk_type = '".$db->escape(GETPOST("paiementtype"))."'"; - $param.='&paiementtype='.urlencode(GETPOST("paiementtype")); + $sql_rech.=" AND b.fk_type = '".$db->escape($paiementtype)."'"; + $param.='&paiementtype='.urlencode($paiementtype); $mode_search = 1; } - + $sql = "SELECT count(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $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 ba.entity = ".$conf->entity; $sql.= $sql_rech; - + dol_syslog("account.php count transactions - sql=".$sql, LOG_DEBUG); $result=$db->query($sql); if ($result) @@ -230,7 +231,7 @@ if ($id > 0 || ! empty($ref)) $obj = $db->fetch_object($result); $nbline = $obj->nb; $total_lines = $nbline; - + if ($nbline > $viewline ) $limit = $nbline - $viewline ; else $limit = $viewline; @@ -240,7 +241,7 @@ if ($id > 0 || ! empty($ref)) { dol_print_error($db); } - + if ($page > 0) { $limitsql = $nbline - ($page * $viewline); @@ -253,34 +254,34 @@ if ($id > 0 || ! empty($ref)) $limitsql = $nbline; } //print $limitsql.'-'.$page.'-'.$viewline; - + // Onglets $head=bank_prepare_head($object); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); - + print '
'; - + // Ref print ''; print ''; - + // Label print ''; print ''; - + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'ref','',1,'ref'); print '
'.$langs->trans("Label").''.$object->label.'
'; - + print '
'; - + dol_htmloutput_errors($mesg); - + /** * Search form */ $param.='&account='.$object->id; - + // Define transaction list navigation string $navig=''; $navig.='
'; @@ -289,6 +290,7 @@ if ($id > 0 || ! empty($ref)) if ($limitsql > $viewline) $navig.=''.img_previous().''; $navig.= $langs->trans("Page")." "; // ' Page '; $navig.=''; + $navig.=''; $navig.=''; $navig.=''; $navig.=''; @@ -303,7 +305,7 @@ if ($id > 0 || ! empty($ref)) } $navig.='
'; //var_dump($navig); - + // Confirmation delete if ($action == 'delete') { @@ -311,15 +313,15 @@ if ($id > 0 || ! empty($ref)) $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete'); if ($ret == 'html') print '
'; } - + print ''; - + // Show title if ($action != 'addline' && $action != 'delete') { print ''; } - + // Form to add a transaction with no invoice if ($user->rights->banque->modifier && $action == 'addline') { @@ -328,11 +330,11 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + print ''; print ''; print ''; - + print ''; print ''; print ''; @@ -343,7 +345,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + print ''; print ''; print ""; - + print ''."\n"; } - + /* * Affiche tableau des transactions bancaires */ - + // Ligne de titre tableau des ecritures print ''; print ''; @@ -389,19 +391,19 @@ if ($id > 0 || ! empty($ref)) if ($object->type != 2 && $object->rappro) print $langs->trans("AccountStatementShort"); else print ' '; print ''; - + print ''; print ''; print ''; print ''; - + print ''; print ''; print ''; print ''; print ''; print ''; @@ -412,13 +414,13 @@ if ($id > 0 || ! empty($ref)) print ''; print "\n"; print "\n"; - + /* * Another solution * create temporary table solde type=heap select amount from llx_bank limit 100 ; * select sum(amount) from solde ; */ - + $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"; if ($mode_search) @@ -428,11 +430,11 @@ if ($id > 0 || ! empty($ref)) /* if ($mode_search && $conf->adherent->enabled) { - + } if ($mode_search && $conf->tax->enabled) { - + } */ $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; @@ -459,22 +461,22 @@ if ($id > 0 || ! empty($ref)) $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->plimit($limitsql, 0); - + dol_syslog("account.php get transactions - sql=".$sql, LOG_DEBUG); $result = $db->query($sql); if ($result) { $now=dol_now(); $nows=dol_print_date($now,'%Y%m%d'); - + //$form->load_cache_types_paiements(); //$form->cache_types_paiements - + $var=true; - + $num = $db->num_rows($result); $i = 0; $total = 0; $sep = 0; - + while ($i < $num) { $objp = $db->fetch_object($result); @@ -482,7 +484,7 @@ if ($id > 0 || ! empty($ref)) if ($i >= ($nbline - $viewline)) { $var=!$var; - + // Is it a transaction in future ? $dos=dol_print_date($db->jdate($objp->do),'%Y%m%d'); //print "dos=".$dos." nows=".$nows; @@ -496,26 +498,26 @@ if ($id > 0 || ! empty($ref)) print ""; print ''; } - + print ''; - + print '\n"; - + print '\n"; - + // Payment type print "\n"; - + // Num print '\n"; - + // Description print ''; - + // Add third party column print ''; - + // Amount if ($objp->amount < 0) { @@ -637,7 +639,7 @@ if ($id > 0 || ! empty($ref)) { print ''."\n"; } - + // Balance if ($action != 'search') { @@ -654,7 +656,7 @@ if ($id > 0 || ! empty($ref)) { print ''; } - + // Transaction reconciliated or edit link 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 ''; } - + print ""; } - + $i++; } - + // Show total if ($page == 0 && ! $mode_search) { @@ -721,19 +723,19 @@ if ($id > 0 || ! empty($ref)) { dol_print_error($db); } - + print "
'.$navig.'
'.$langs->trans("AddBankRecordLong").'
'.$langs->trans("Date").' '.$langs->trans("Credit").' 
'; $form->select_date($dateop,'op',0,0,0,'transaction'); @@ -366,14 +368,14 @@ if ($id > 0 || ! empty($ref)) print ''; print '
 
'.$langs->trans("Date").'
  '; //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) $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 '
 
'.dol_print_date($db->jdate($objp->do),"day")."'.dol_print_date($db->jdate($objp->dv),"day"); print ""; $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); - + if ($objp->fk_type == 'SOLD') $label=' '; print $label; print "'.($objp->num_chq?$objp->num_chq:"")."'; // Show generic description @@ -545,7 +547,7 @@ if ($id > 0 || ! empty($ref)) } else if ($links[$key]['type']=='company') { - + } 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']=='sc') { - + } else { @@ -592,7 +594,7 @@ if ($id > 0 || ! empty($ref)) } } print ''; foreach($links as $key=>$val) @@ -627,7 +629,7 @@ if ($id > 0 || ! empty($ref)) } } print '  '.price($objp->amount).'-
"; - + print "\n\n"; - + /* * Boutons actions */ - + if ($action != 'delete') { print '
'; - + if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate { if ($user->rights->banque->consolidate) @@ -745,7 +747,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Conciliate").''; } } - + if ($action != 'addline') { if ($user->rights->banque->modifier) @@ -757,10 +759,10 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("AddBankRecord").''; } } - + print '
'; } - + print '
'; } else @@ -771,4 +773,4 @@ else llxFooter(); $db->close(); -?> \ No newline at end of file +?> diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index d07f816f1bc..a5aa5ccf864 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -1,6 +1,7 @@ * Copyright (c) 2004-2012 Laurent Destailleur + * Copyright (C) 2012 Marcos García * * 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 @@ -137,12 +138,7 @@ if (! $mesg) } -$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]); -} +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -162,8 +158,7 @@ $mesg = $px3->isGraphKo(); if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i = $startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 510091c4832..9ba9672b176 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -1,6 +1,7 @@ * Copyright (c) 2004-2012 Laurent Destailleur + * Copyright (C) 2012 Marcos García * * 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 @@ -148,12 +149,7 @@ if (! $mesg) } -$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]); -} +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->societe_id) { @@ -173,8 +169,7 @@ $mesg = $px3->isGraphKo(); if (! $mesg) { $px3->SetData($data); - //$i=$startyear;$legend=array(); - $i=$endyear;$legend=array(); + $i = $startyear;$legend=array(); while ($i <= $endyear) { $legend[]=$i; diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 54763392ef7..79a8c154322 100755 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -87,16 +87,21 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS); $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.= " p.accountancy_code_sell, s.code_compta , ct.accountancy_code"; +$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,"; +$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.= " 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."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.= " 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)."'"; -$sql .= " order by f.rowid"; +$sql.= " ORDER BY f.rowid"; $result = $db->query($sql); if ($result) diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index 6c49ce2a582..82eeb10e6e3 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -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 diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index efb5fde0093..6405577e228 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -69,7 +69,7 @@ class FormActions print ''."\n"; print '