From a886136e67eaf0711674583919830aeb9368b3f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Jan 2015 22:13:15 +0100 Subject: [PATCH 01/13] More comment and add a unit test to check that {t} tag is correctly supported. --- htdocs/core/lib/functions2.lib.php | 4 ++-- test/phpunit/NumberingModulesTest.php | 31 ++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 54014d907b1..cd99afaf373 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -628,8 +628,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if (preg_match('/\{(t+)\}/i',$mask,$regType)) { $masktype=$regType[1]; - $masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,dol_strlen($regType[1]));//get n first characters of client code where n is length in mask - $masktype_value=str_pad($masktype_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); + $masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,dol_strlen($regType[1]));// get n first characters of thirdpaty typent_code (where n is length in mask) + $masktype_value=str_pad($masktype_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask } else { diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index a3788b309d1..48d26216268 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -500,7 +500,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $conf->global->SOCIETE_FISCAL_MONTH_START=6; $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}{mm}-{0000@99}'; $conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}{mm}-{0000@99}'; - + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year @@ -510,7 +510,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('198001-0001', $result); // counter must start to 1 - + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year @@ -520,7 +520,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('198001-0002', $result); // counter must start to 2 - + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->date=dol_mktime(12, 0, 0, 2, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year @@ -530,7 +530,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('198002-0001', $result); // counter must start to 1 - + $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1981); // we use year 1981 to be sure to not have existing invoice for this year @@ -540,7 +540,28 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result3=$localobject->validate($user, $result); print __METHOD__." result=".$result."\n"; $this->assertEquals('198101-0001', $result); // counter must start to 1 - + + // Test with {t} tag + $conf->global->SOCIETE_FISCAL_MONTH_START=1; + $conf->global->FACTURE_MERCURE_MASK_CREDIT='{t}{yyyy}{mm}-{0000}'; + $conf->global->FACTURE_MERCURE_MASK_INVOICE='{t}{yyyy}{mm}-{0000}'; + + $tmpthirdparty=new Societe($this->savdb); + $tmpthirdparty->initAsSpecimen(); + $tmpthirdparty->typent_code = 'TE_ABC'; + + $localobject=new Facture($this->savdb); + $localobject->initAsSpecimen(); + $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1980 to be sure to not have existing invoice for this year + $numbering=new mod_facture_mercure(); + $result=$numbering->getNextValue($tmpthirdparty, $localobject); + $result2=$localobject->create($user,1); + $result3=$localobject->validate($user, $result); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('A198201-0001', $result); // counter must start to 1 + + + return $result; } From 806477977d0ccdf68723960fbdf5547d5f07edb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Jan 2015 13:51:21 +0100 Subject: [PATCH 02/13] Fix: css --- htdocs/comm/action/peruser.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/theme/eldy/img/menus/README.md | 12 +++++++++ htdocs/theme/eldy/img/menus/chart.png | Bin 0 -> 1792 bytes htdocs/theme/eldy/style.css.php | 34 ++++++------------------ 5 files changed, 22 insertions(+), 28 deletions(-) create mode 100644 htdocs/theme/eldy/img/menus/README.md create mode 100644 htdocs/theme/eldy/img/menus/chart.png diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 22cf8841c02..8379960f764 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -679,7 +679,7 @@ foreach ($usernames as $username) { $var = ! $var; echo ""; - echo '' . $username->getNomUrl(1). ''; + echo '' . $username->getNomUrl(1). ''; $tmpday = $sav; // Lopp on each day of week diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 74d6b95df73..8ae46c5d8da 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -354,7 +354,7 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, if ($showmode == 1) { print ''; - print '
'; + print '
'; print '
'; print ''; print ''; diff --git a/htdocs/theme/eldy/img/menus/README.md b/htdocs/theme/eldy/img/menus/README.md new file mode 100644 index 00000000000..1b3942d1913 --- /dev/null +++ b/htdocs/theme/eldy/img/menus/README.md @@ -0,0 +1,12 @@ + +Tutorial to create a new image for menu: + +1) First find an image. +2) With Gimp, open image and check there is a alpha channel. If not add one. +3) Convert image into back and white. +4) Use the degrade tool with option: +* Erase color +* Opacity: 50 +/- +* Offset: 0 +* Shape: Linear +Il est possible aussi d'augmenter la transparence globale depuis le calque. diff --git a/htdocs/theme/eldy/img/menus/chart.png b/htdocs/theme/eldy/img/menus/chart.png new file mode 100644 index 0000000000000000000000000000000000000000..abd089a44bea64e7880045b878c0392e57802c59 GIT binary patch literal 1792 zcmV+b2mknqP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2j2k> z3M&R+hlf)D00w|bL_t(o!_ArBixk-v$G_*^s#{gV^r+DuXBZtB96K?Sbps&}8%$s^ zK_MC;2#fd!H2{l850Q|N7u}cmTkxW zRn_&Qt4&K2AV+?rEMiYv~qBS=+_r7i0KM8{1TbiapDFwqYpzAtxT?Y|; zYTNd2EX(>c0PnvocvM~cN_)i4Y+8Vy*M1u11xJR61qA;hWS;o(!wX7kH1 z3`Ym$d2NI9`qLdLclN#l2QTyEX(4(d-vv_J$q&V@ZJRR z;MGAygvrTC95`?Ql}ZJRi;HX+2AQS_r4*PsM$mgxJfAiM%#4wd5n^WYeILw>D2i4S zhzJ1Q9M5+eVHkqBdtTnSabv&ZIQv}J-4{jC6K4M6!i5W84y4*J^X^)$wgf<>&#kPi zpw()v`ArCcCr_U2o1dR=5Yc;46#bByf8_f#hP^hSw) z{P;0Fefo64ah!>EQbX5u)-;VYO@j~unx@@TN`1!6zc_vRG!Gn`PWI+s`a70o z!8A<>A;ySk48ZrLl&9|Az57tt^$$;;JUP4V%nKpb)%vVl==2wR_U!R92P&2DaBIC4O@=BRGUsHb;BkM!*aT8cXPk>*52fd%@AcZ^H^V%D zp118gK}6Wi^V@>WMuw%5bI&GnU}v{#)0c$JVme_!tJgJw zh-w=N?He{(tpNb5SHy@Y>V!xlam9Y`+BTQXGT_WcszH3RL zotnHgk?JP?=FOYCvgX7>ewk7fB&YdeUv&^{Z zI>r;88d`5FWf{Oi2q!UTjp!(f5Jk~k6h;4jorI-c6So}!Eh~4@87qXKmoHz2wOXw) zGBPsUjvzIgO{djreI}*+G>W2s+P3|#*C~~pWk7m$O^kAy(+uq(A~=qNa=H9Y5ClJt zqUdeMasCx#|o+qZQgM5`0C8Q3s@oUZH1Jm46MBtBsnLI^Q( z@ZiCRSFT+7rR%yMT)TGd*E@Iayw{8Ho*r_8APB|!I>+^To!Vk4>CM^MS&~vNO-xLT z=kxj1-3HHl^-|V#-Da!R`aOV8N~O}hqeqW!`CWc5%!_QARy~@=#xzYVEG!(iZTovm zOG{s$oSgh7fbR$)K4~_acZCptcO0j3MPfbmsP$*#6u3how*(=^X&vTji zqe`XnTL3cokkQXUUBpxS{UMZ6IU&S1i0G}Usi~R$`}hCAG|jL2zW=9cwR-*V;lsZx il}a==Ha5^*@c#pOvA2INX1v${0000 div#tmenu_tooltip { @@ -673,7 +673,7 @@ div.mainmenu { position : relative; background-repeat:no-repeat; background-position:center top; - height: px; + height: px; margin-left: 0px; min-width: 40px; } @@ -698,16 +698,10 @@ div.mainmenu.bank { background-image: url(); } -div.mainmenu.bookmark { -} - div.mainmenu.cashdesk { background-image: url(); } -div.mainmenu.click2dial { -} - div.mainmenu.companies { background-image: url(); } @@ -728,12 +722,6 @@ div.mainmenu.ftp { background-image: url(); } -div.mainmenu.gravatar { -} - -div.mainmenu.geopipmaxmind { -} - div.mainmenu.hrm { background-image: url(); } @@ -742,9 +730,6 @@ div.mainmenu.members { background-image: url(); } -div.mainmenu.paypal { -} - div.mainmenu.products { background-image: url(); margin-left: 10px; @@ -758,14 +743,6 @@ div.mainmenu.tools { background-image: url(); } -div.mainmenu.webservices { -} - -div.mainmenu.google { - background-image: url(); -} - - 'name of class for div') @@ -2423,6 +2400,11 @@ li.cal_event { border: none; list-style-type: none; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); } .cal_event_busy { } +.cal_peruserviewname { max-width: 100px; height: 22px; } + +.topmenuimage { + background-size: 28px auto; +} /* ============================================================================== */ /* Ajax - Liste deroulante de l'autocompletion */ From e3f3956bedaa6022773e168cd2f1fd87218af357 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Jan 2015 19:10:48 +0100 Subject: [PATCH 03/13] Sec: Bad security test --- htdocs/public/test/test_arrays.php | 7 +++++-- htdocs/public/test/test_forms.php | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 6725c776cd4..5ff161f0b1a 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -4,11 +4,14 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site. require '../../main.inc.php'; -if ($_SERVER['HTTP_HOST'] != 'localhost') + +if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { - print "Page available only with url http://localhost/..."; + print "Page available only frome remote address 127.0.0.1"; exit; } + + $usedolheader=0; // 1 = Test inside a dolibarr page, 0 = Use hard coded header diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index c600e9b0acd..deb3e2fe0c4 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -6,9 +6,9 @@ define('REQUIRE_JQUERY_MULTISELECT','select2'); require '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if ($_SERVER['HTTP_HOST'] != 'localhost') +if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { - print "Page available only with url http://localhost/..."; + print "Page available only frome remote address 127.0.0.1"; exit; } From 4c64b8ceae276cee0f9953450de52a4d4ff67788 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Jan 2015 19:12:22 +0100 Subject: [PATCH 04/13] Add menu image --- htdocs/theme/eldy/img/menus/chart.png | Bin 1792 -> 1321 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/htdocs/theme/eldy/img/menus/chart.png b/htdocs/theme/eldy/img/menus/chart.png index abd089a44bea64e7880045b878c0392e57802c59..6efce90a78859b6f4649304a8481fd193e6cb609 100644 GIT binary patch delta 1253 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 WvA2INX1v${0000 Date: Wed, 14 Jan 2015 19:17:58 +0100 Subject: [PATCH 05/13] Fixed: Avoid space into address string --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dcb76a10cd7..3ec602c9d2b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -800,7 +800,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='') else if (in_array($object->country_code,array('ES','TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country { $ret .= ($ret ? $sep : '' ).$object->zip; - $ret .= ' '.$object->town; + $ret .= ($object->town?' '.$object->town:''); if ($object->state && in_array($object->country_code,$countriesusingstate)) { $ret.="\n".$object->state; @@ -810,14 +810,14 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='') else // Other: title firstname name \n address lines \n zip town \n country { $ret .= ($ret ? $sep : '' ).$object->zip; - $ret .= ' '.$object->town; + $ret .= ($object->town?' '.$object->town:''); if ($object->state && in_array($object->country_code,$countriesusingstate)) { $ret.=", ".$object->state; } } if (! is_object($outputlangs)) $outputlangs=$langs; - if ($withcountry) $ret.=($object->country_code?$sep.$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):''); + if ($withcountry) $ret.=($object->country_code?($ret?$sep:'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):''); return $ret; } From ba49cce47a9e62c930021bd5f7705e40bd6aecf2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Jan 2015 02:06:04 +0100 Subject: [PATCH 06/13] Fix: The filter into event views on user must be done on assigned resource, not only owner. --- htdocs/comm/action/class/actioncomm.class.php | 3 + htdocs/comm/action/index.php | 38 ++++---- htdocs/comm/action/listactions.php | 95 +++++-------------- htdocs/comm/action/peruser.php | 37 ++++---- htdocs/core/lib/agenda.lib.php | 2 +- .../install/mysql/migration/3.6.0-3.7.0.sql | 3 + .../tables/llx_actioncomm_resources.key.sql | 2 +- htdocs/install/upgrade2.php | 80 ++++++++++++++++ htdocs/langs/en_US/install.lang | 1 + 9 files changed, 146 insertions(+), 115 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 135b775249b..bf668be6daa 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -141,6 +141,9 @@ class ActionComm extends CommonObject $userownerid=$this->userownerid; $userdoneid=$this->userdoneid; + // Be sure assigned user array is not empty. + if (count($this->userassigned) == 0) $this->userassigned = array('id'=>$this->$userownerid); + if (! $this->type_id || ! $this->type_code) { $key=empty($this->type_id)?$this->type_code:$this->type_id; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 4630d486ebf..7820de113b7 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -40,9 +40,7 @@ if (! empty($conf->projet->enabled)) { if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; $filter=GETPOST("filter",'',3); -$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); -$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3); $usergroup = GETPOST("usergroup","int",3); $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; @@ -72,9 +70,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden(); if (! $user->rights->agenda->allactions->read) $canedit=0; if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me { - $filtera=$user->id; $filtert=$user->id; - $filterd=$user->id; } $action=GETPOST('action','alpha'); @@ -283,9 +279,7 @@ $param=''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; -if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; -if ($filterd) $param.="&filterd=".$filterd; if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; @@ -340,7 +334,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param); $head = calendars_prepare_head($paramnoaction); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); -print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup); +print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup); dol_fiche_end(); $showextcals=$listofextcals; @@ -405,27 +399,29 @@ print_fiche_titre($s,$link.'     '.$nav, ''); // Get event in an array $eventarray=array(); -$sql = 'SELECT a.id,a.label,'; +$sql = 'SELECT '; +if ($usergroup > 0) $sql.=" DISTINCT"; +$sql.= ' a.id, a.label,'; $sql.= ' a.datep,'; $sql.= ' a.datep2,'; -$sql.= ' a.datea,'; -$sql.= ' a.datea2,'; $sql.= ' a.percent,'; -$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; +$sql.= ' a.fk_user_author,a.fk_user_action,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.fk_soc, a.fk_contact,'; $sql.= ' ca.code as type_code, ca.libelle as type_label'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; -if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; +if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; -// FIXME: We must filter on assignement table -if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($action == 'show_day') { $sql.= " AND ("; @@ -459,14 +455,12 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } -// FIXME: We must filter on assignement table -if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) { $sql.= " AND ("; - if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; - if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; - if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; - if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; + if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert; + if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } // Sort on date @@ -1094,7 +1088,7 @@ $db->close(); function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60) { global $user, $conf, $langs; - global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form + global $action, $filter, $filtert, $status, $actioncode; // Filters used into search form global $theme_datacolor; global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; @@ -1383,7 +1377,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { print ''.img_picto("all","1downarrow_selected.png").' ...'; print ' +'.(count($eventarray[$daykey])-$maxprint); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index a53628e3d31..b8c913df271 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; +$langs->load("users"); $langs->load("companies"); $langs->load("agenda"); $langs->load("commercial"); @@ -52,9 +53,7 @@ if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $s if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); $filter=GETPOST("filter",'',3); -$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); -$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3); $usergroup = GETPOST("usergroup","int",3); $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; @@ -94,9 +93,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden(); if (! $user->rights->agenda->allactions->read) $canedit=0; if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permission to see all, we show only affected to me { - $filtera=$user->id; $filtert=$user->id; - $filterd=$user->id; } // Purge search criteria @@ -133,15 +130,14 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) */ $form=new Form($db); +$userstatic=new User($db); $nav=''; $nav.='  
'; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.=''; if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.=''; if ($filter) $nav.=''; -if ($filtera) $nav.=''; if ($filtert) $nav.=''; -if ($filterd) $nav.=''; if ($socid) $nav.=''; if ($showbirthday) $nav.=''; if ($pid) $nav.=''; @@ -163,65 +159,57 @@ $param=''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; -if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; -if ($filterd) $param.="&filterd=".$filterd; if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; if ($type) $param.="&type=".$type; if ($usergroup) $param.="&usergroup=".$usergroup; -$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; -$sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; -$sql.= " a.fk_contact, a.note, a.label, a.percent as percent,"; +$sql = "SELECT"; +if ($usergroup > 0) $sql.=" DISTINCT"; +$sql.= " s.nom as societe, s.rowid as socid, s.client,"; +$sql.= " a.id, a.label, a.datep as dp, a.datep2 as dp2,"; +$sql.= ' a.fk_user_author,a.fk_user_action,'; +$sql.= " a.fk_contact, a.note, a.percent as percent,"; $sql.= " c.code as type_code, c.libelle as type_label,"; -$sql.= " ua.login as loginauthor, ua.rowid as useridauthor,"; -$sql.= " ut.login as logintodo, ut.rowid as useridtodo,"; -//$sql.= " ud.login as logindone, ud.rowid as useriddone,"; $sql.= " sp.lastname, sp.firstname"; -$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,"; -$sql.= " ".MAIN_DB_PREFIX.'user as u,'; -$sql.= " ".MAIN_DB_PREFIX."actioncomm as a"; +$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON a.fk_user_author = ua.rowid"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid"; -//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid"; -if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; +if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= " WHERE c.id = a.fk_action"; -$sql.= ' AND a.fk_user_author = u.rowid'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND c.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; -// FIXME: We must filter on assignement table -if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($type) $sql.= " AND c.id = ".$type; if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } -// FIXME: We must filter on assignement table -if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) { $sql.= " AND ("; - if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; - if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; - if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; - if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; + if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert; + if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } + // The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case) if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))"; if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'"; if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); - //print $sql; dol_syslog("comm/action/listactions.php", LOG_DEBUG); @@ -246,7 +234,7 @@ if ($resql) $head = calendars_prepare_head($param); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); - print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,$action,-1,$actioncode,$usergroup); + print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup); dol_fiche_end(); // Add link to show birthdays @@ -275,14 +263,11 @@ if ($resql) print ''; print ''; print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; @@ -375,46 +360,16 @@ if ($resql) } print ''; - // User author - /* - print ''; - */ - // User to do print ''; - // User did - /* - print ''; - */ - // Status/Percent print ''; @@ -434,6 +389,6 @@ else } -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 8379960f764..04353190adb 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -39,9 +39,7 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; $filter=GETPOST("filter",'',3); -$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); -$filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filterd","int",3); $usergroup = GETPOST("usergroup","int",3); //if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id; //$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; @@ -73,9 +71,7 @@ if (! $user->rights->agenda->myactions->read) accessforbidden(); if (! $user->rights->agenda->allactions->read) $canedit=0; if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me { - $filtera=$user->id; $filtert=$user->id; - $filterd=$user->id; } //$action=GETPOST('action','alpha'); @@ -130,6 +126,7 @@ if (GETPOST('viewday') || $action == 'show_day') { } // View by day +$langs->load("users"); $langs->load("agenda"); $langs->load("other"); $langs->load("commercial"); @@ -198,9 +195,7 @@ $param=''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; -if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; -if ($filterd) $param.="&filterd=".$filterd; if ($usergroup) $param.="&usergroup=".$usergroup; if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; @@ -280,7 +275,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param); $head = calendars_prepare_head($paramnoaction); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); -print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup); +print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup); dol_fiche_end(); $showextcals=$listofextcals; @@ -332,27 +327,29 @@ print_fiche_titre($s,$link.'     '.$nav, ''); // Get event in an array $eventarray=array(); -$sql = 'SELECT a.id,a.label,'; +$sql = 'SELECT'; +if ($usergroup > 0) $sql.=" DISTINCT"; +$sql.= ' a.id, a.label,'; $sql.= ' a.datep,'; $sql.= ' a.datep2,'; -$sql.= ' a.datea,'; -$sql.= ' a.datea2,'; $sql.= ' a.percent,'; -$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; +$sql.= ' a.fk_user_author,a.fk_user_action,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,'; $sql.= ' ca.code, ca.color'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; -if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; +if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; -// FIXME: We must filter on assignement table -if ($usergroup > 0) $sql.= " AND ugu.fk_user = a.fk_user_action"; +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($action == 'show_day') { $sql.= " AND ("; @@ -386,14 +383,12 @@ if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } -// FIXME: We must filter on assignement table -if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) +// We must filter on assignement table +if ($filtert > 0 || $usergroup > 0) { $sql.= " AND ("; - if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera; - if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert; - if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; - if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; + if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert; + if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } // Sort on date @@ -809,7 +804,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & { global $db; global $user, $conf, $langs, $hookmanager, $action; - global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form + global $filter, $filtert, $status, $actioncode; // Filters used into search form global $theme_datacolor; // Array with a list of different we can use (come from theme) global $cachethirdparties, $cachecontacts, $colorindexused; global $begin_h, $end_h; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 23a17534ccf..80e556378c0 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -70,7 +70,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh { print ''; print ''; } +/** + * Migrate event assignement to owner + * + * @param DoliDB $db Database handler + * @param Translate $langs Object langs + * @param Conf $conf Object conf + * @return void + */ +function migrate_event_assignement($db,$langs,$conf) +{ + print ''; +} + /** * Migration directory * diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 20abe7b9c70..c296bd788e8 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -206,6 +206,7 @@ MigrationProjectTaskTime=Update time spent in seconds MigrationActioncommElement=Update data on actions MigrationPaymentMode=Data migration for payment mode MigrationCategorieAssociation=Migration of categories +MigrationEvents=Migration of events to add event owner into assignement table ShowNotAvailableOptions=Show not available options HideNotAvailableOptions=Hide not available options \ No newline at end of file From ccfbd3614e6bdfe07999e3a66e5d3a92725e190d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Jan 2015 02:09:28 +0100 Subject: [PATCH 07/13] Not nice looking --- htdocs/societe/soc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 1a936db37fb..72e249ce542 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1754,7 +1754,8 @@ else print ''; // Zip / Town diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3ec602c9d2b..cdb7e2b4d78 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4574,6 +4574,7 @@ function dol_eval($s,$returnvalue=0) global $leftmenu; global $rights; global $object; + global $soc; //print $s."
\n"; if ($returnvalue) return @eval('return '.$s.';'); diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php index 305936e6f56..9d06d203d9c 100644 --- a/htdocs/societe/info.php +++ b/htdocs/societe/info.php @@ -59,21 +59,21 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty"),$help_url); -$soc = new Societe($db); -$soc->fetch($socid); -$soc->info($socid); +$object = new Societe($db); +$object->fetch($socid); +$object->info($socid); /* * Affichage onglets */ -$head = societe_prepare_head($soc); +$head = societe_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("ThirdParty"),0,'company'); print '
'; - if ($obj->useridauthor) - { - $userstatic=new User($db); - $userstatic->id=$obj->useridauthor; - $userstatic->login=$obj->loginauthor; - print $userstatic->getLoginUrl(1); - } - else print ' '; - print ''; - if ($obj->useridtodo) + if ($obj->fk_user_action > 0) { - $userstatic=new User($db); - $userstatic->id=$obj->useridtodo; - $userstatic->login=$obj->logintodo; + $userstatic->fetch($obj->fk_user_action); print $userstatic->getLoginUrl(1); } else print ' '; print ''; - if ($obj->useriddone) - { - $userstatic=new User($db); - $userstatic->id=$obj->useriddone; - $userstatic->login=$obj->logindone; - print $userstatic->getLoginUrl(1); - } - else print ' '; - print ''.$actionstatic->LibStatut($obj->percent,6).'
'; - print $langs->trans("ActionsOwnedBy").'   '; + print $langs->trans("ActionsToDoBy").'   '; print ''; print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit); if (empty($conf->dol_optimize_smallscreen)) print '   '.$langs->trans("or") . ' '.$langs->trans("Group").'   '; diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index ad05f850e16..7dbdb7eb7dc 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -153,6 +153,9 @@ ALTER TABLE llx_projet_task_time ADD COLUMN task_datehour datetime after task_da ALTER TABLE llx_actioncomm_resources CHANGE COLUMN transparent transparency smallint default 1; +ALTER TABLE llx_actioncomm_resources DROP INDEX idx_actioncomm_resources_idx1; +ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX uk_actioncomm_resources(fk_actioncomm, element_type, fk_element); + -- Localtaxes by thirds ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(10); diff --git a/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql b/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql index caaa0969944..8c7bb4ad237 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql @@ -18,7 +18,7 @@ -- ============================================================================ -ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX idx_actioncomm_resources_idx1 (fk_actioncomm, element_type, fk_element); +ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX uk_actioncomm_resources(fk_actioncomm, element_type, fk_element); ALTER TABLE llx_actioncomm_resources ADD INDEX idx_actioncomm_resources_fk_element (fk_element); -- Pas de contrainte sur fk_source et fk_target car pointe sur differentes tables diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 57004f3cb16..86ab911c71b 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -362,6 +362,8 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) $beforeversionarray=explode('.','3.7.9'); // target is before this if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) { + migrate_event_assignement($db,$langs,$conf); + // Reload modules (this must be always and only into last targeted version) $listofmodule=array( 'MAIN_MODULE_AGENDA', @@ -391,6 +393,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) $db->commit(); $db->close(); + // Actions for all version (not in database) migrate_delete_old_files($db,$langs,$conf); @@ -3519,6 +3522,83 @@ function migrate_categorie_association($db,$langs,$conf) print '
'; + + print '
'; + print ''.$langs->trans('MigrationEvents')."
\n"; + + $error = 0; + + dolibarr_install_syslog("upgrade2::migrate_event_assignement"); + + $db->begin(); + + $sqlSelect = "SELECT a.id, a.fk_user_action"; + $sqlSelect.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; + $sqlSelect.= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type = 'user' AND ar.fk_element = a.fk_user_action"; + $sqlSelect.= " WHERE fk_user_action > 0 AND fk_user_action NOT IN (SELECT fk_element FROM ".MAIN_DB_PREFIX."actioncomm_resources as ar WHERE ar.fk_actioncomm = a.id AND ar.element_type = 'user')"; + $sqlSelect.= " ORDER BY a.id"; + //print $sqlSelect; + + $resql = $db->query($sqlSelect); + if ($resql) + { + $i = 0; + $num = $db->num_rows($resql); + + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + $sqlUpdate = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element) "; + $sqlUpdate.= "VALUES(".$obj->id.", 'user', ".$obj->fk_user_action.")"; + + $result=$db->query($sqlUpdate); + if (! $result) + { + $error++; + dol_print_error($db); + } + print ". "; + $i++; + } + } + else + { + print $langs->trans('AlreadyDone')."
\n"; + } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } + } + else + { + dol_print_error($db); + $db->rollback(); + } + + + print '
'.$langs->trans("Country").''; if (! empty($object->country_code)) { - $img=picto_from_langcode($object->country_code); + //$img=picto_from_langcode($object->country_code); + $img=''; if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); else print ($img?$img.' ':'').$object->country; } From 4d67e6f4d41611b3ceb2d3f73cce6aff9e1bd59d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Jan 2015 02:11:22 +0100 Subject: [PATCH 08/13] Add ignore --- htdocs/custom/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 htdocs/custom/.gitignore diff --git a/htdocs/custom/.gitignore b/htdocs/custom/.gitignore new file mode 100644 index 00000000000..ed069fdfd81 --- /dev/null +++ b/htdocs/custom/.gitignore @@ -0,0 +1,4 @@ +/a* +/b* +/c* +/d* From 362167f31974f2367faa4989ba896e6fd956ea33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Jan 2015 02:32:15 +0100 Subject: [PATCH 09/13] Fixed: Export was not using user assigned --- htdocs/admin/agenda_xcal.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 32 ++++++------------- htdocs/langs/en_US/agenda.lang | 2 +- htdocs/public/agenda/agendaexport.php | 4 +-- 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 40454ed1302..fd8c3092c0d 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -171,7 +171,7 @@ $message.='
'; print $message; $message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'
'; -$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'
'; +//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index bf668be6daa..9a750daa015 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -976,7 +976,7 @@ class ActionComm extends CommonObject $sql.= " a.label, a.code, a.note, a.fk_action as type_id,"; $sql.= " a.fk_soc,"; $sql.= " a.fk_user_author, a.fk_user_mod,"; - $sql.= " a.fk_user_action, a.fk_user_done,"; + $sql.= " a.fk_user_action,"; $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; @@ -984,9 +984,11 @@ class ActionComm extends CommonObject $sql.= " s.nom as socname,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; - $sql.= " WHERE a.fk_action=c.id"; + // We must filter on assignement table + if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; + $sql.= " WHERE a.fk_action=c.id"; $sql.= " AND a.entity = ".$conf->entity; foreach ($filters as $key => $value) { @@ -996,17 +998,8 @@ class ActionComm extends CommonObject if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0); if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0); if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0); - if ($key == 'login') - { - $login=$value; - $userforfilter=new User($this->db); - $result=$userforfilter->fetch('',$value); - $sql.= " AND ("; - $sql.= " a.fk_user_author = ".$userforfilter->id; - $sql.= " OR a.fk_user_action = ".$userforfilter->id; - $sql.= " OR a.fk_user_done = ".$userforfilter->id; - $sql.= ")"; - } + // We must filter on assignement table + if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($key == 'logina') { $logina=$value; @@ -1014,19 +1007,12 @@ class ActionComm extends CommonObject $result=$userforfilter->fetch('',$value); $sql.= " AND a.fk_user_author = ".$userforfilter->id; } - if ($key == 'logint') + if ($key == 'logint' || $key == 'login') { $logint=$value; $userforfilter=new User($this->db); $result=$userforfilter->fetch('',$value); - $sql.= " AND a.fk_user_action = ".$userforfilter->id; - } - if ($key == 'logind') - { - $logind=$value; - $userforfilter=new User($this->db); - $result=$userforfilter->fetch('',$value); - $sql.= " AND a.fk_user_done = ".$userforfilter->id; + $sql.= " AND ar.fk_element = ".$userforfilter->id; } } $sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 1cc01ec2e7b..9ed2d79edd2 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -68,7 +68,7 @@ DateActionDoneEnd= Real end date DateActionStart= Start date DateActionEnd= End date AgendaUrlOptions1=You can also add following parameters to filter output: -AgendaUrlOptions2=login=%s to restrict output to actions created by, assigned to or done by user %s. +AgendaUrlOptions2=login=%s to restrict output to actions created by or assigned to user %s. AgendaUrlOptions3=logina=%s to restrict output to actions owned by a user %s. AgendaUrlOptions4=logint=%s to restrict output to actions assigned to user %s. AgendaUrlOptionsProject=project=PROJECT_ID to restrict output to actions associated to project PROJECT_ID. diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index c36766e2777..2b1d02ef493 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -69,7 +69,6 @@ if (! empty($_GET["project"])) $filters['project']=$_GET["project"]; if (! empty($_GET["login"])) $filters['login']=$_GET["login"]; if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"]; if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"]; -if (! empty($_GET["logind"])) $filters['logind']=$_GET["logind"]; // Not older than if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; @@ -111,8 +110,7 @@ foreach ($filters as $key => $value) if ($key == 'project') $filename.='-project'.$value; if ($key == 'login') $filename.='-login'.$value; if ($key == 'logina') $filename.='-logina'.$value; // Author - if ($key == 'logind') $filename.='-logind'.$value; // Affected to - if ($key == 'logint') $filename.='-logint'.$value; // Done by + if ($key == 'logint') $filename.='-logint'.$value; // Assigned to } // Add extension if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; } From d16ce7eb96a8461a1eb5d251d09136085e3607e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Jan 2015 02:42:41 +0100 Subject: [PATCH 10/13] Fix: Bad var --- htdocs/comm/action/class/actioncomm.class.php | 2 +- test/phpunit/NumberingModulesTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9a750daa015..dd7819f7dbb 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -142,7 +142,7 @@ class ActionComm extends CommonObject $userdoneid=$this->userdoneid; // Be sure assigned user array is not empty. - if (count($this->userassigned) == 0) $this->userassigned = array('id'=>$this->$userownerid); + if (count($this->userassigned) == 0) $this->userassigned = array('id'=>$userownerid); if (! $this->type_id || ! $this->type_code) { diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index 48d26216268..891bc5495cf 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -165,7 +165,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $this->assertEquals(1, $result); // Can be deleted $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; - $this->assertEquals(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent + $this->assertEquals(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent) // Now we try with a reset $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}'; @@ -552,7 +552,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $localobject=new Facture($this->savdb); $localobject->initAsSpecimen(); - $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1980 to be sure to not have existing invoice for this year + $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1982 to be sure to not have existing invoice for this year $numbering=new mod_facture_mercure(); $result=$numbering->getNextValue($tmpthirdparty, $localobject); $result2=$localobject->create($user,1); From c5a3b4481e382ac2042a4a0d01c27b56f7921fc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Jan 2015 03:11:06 +0100 Subject: [PATCH 11/13] Fixed: use object --- htdocs/societe/agenda.php | 53 ++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 8d731875442..a6ba3d7b1cf 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -59,9 +59,6 @@ $contactstatic = new Contact($db); $form = new Form($db); -/* - * Fiche categorie de client et/ou fournisseur - */ if ($socid) { require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -70,79 +67,79 @@ if ($socid) $langs->load("companies"); - $soc = new Societe($db); - $result = $soc->fetch($socid); + $object = new Societe($db); + $result = $object->fetch($socid); llxHeader("",$langs->trans("Agenda"),''); if (! empty($conf->notification->enabled)) $langs->load("mails"); - $head = societe_prepare_head($soc); + $head = societe_prepare_head($object); dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"),0,'company'); print ''; print ''; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; } - if ($soc->client) + if ($object->client) { print ''; } - if ($soc->fournisseur) + if ($object->fournisseur) { print ''; } if (! empty($conf->barcode->enabled)) { - print ''; + print ''; } print ""; // Zip / Town - print '"; - print '"; + print '"; + print '"; // Country - if ($soc->country) { + if ($object->country) { print ''; } // EMail print ''; // Web print ''; // Phone / Fax - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans("ThirdPartyName").''; - print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom'); + print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print '
'.$langs->trans('Prefix').''.$soc->prefix_comm.'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; print $langs->trans('CustomerCode').''; - print $soc->code_client; - if ($soc->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + print $object->code_client; + if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; print '
'; print $langs->trans('SupplierCode').''; - print $soc->code_fournisseur; - if ($soc->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + print $object->code_fournisseur; + if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print '
'.$langs->trans('Gencod').''.$soc->barcode.'
'.$langs->trans('Gencod').''.$object->barcode.'
".$langs->trans('Address').""; - dol_print_address($soc->address, 'gmap', 'thirdparty', $soc->id); + dol_print_address($object->address, 'gmap', 'thirdparty', $object->id); print "
'.$langs->trans('Zip').''.$soc->zip."'.$langs->trans('Town').''.$soc->town."
'.$langs->trans('Zip').''.$object->zip."'.$langs->trans('Town').''.$object->town."
'.$langs->trans('Country').''; - $img=picto_from_langcode($soc->country_code); + $img=picto_from_langcode($object->country_code); print ($img?$img.' ':''); - print $soc->country; + print $object->country; print '
'.$langs->trans('EMail').''; - print dol_print_email($soc->email,0,$soc->id,'AC_EMAIL'); + print dol_print_email($object->email,0,$object->id,'AC_EMAIL'); print '
'.$langs->trans('Web').''; - print dol_print_url($soc->url); + print dol_print_url($object->url); print '
'.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'
'.$langs->trans('Phone').''.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'
'; @@ -171,7 +168,7 @@ if ($socid) print '
'; - $objthirdparty=$soc; + $objthirdparty=$object; $objcon=new stdClass(); $out=''; @@ -189,10 +186,10 @@ if ($socid) print load_fiche_titre($langs->trans("ActionsOnCompany"),$out,''); // List of todo actions - show_actions_todo($conf,$langs,$db,$soc); + show_actions_todo($conf,$langs,$db,$object); // List of done actions - show_actions_done($conf,$langs,$db,$soc); + show_actions_done($conf,$langs,$db,$object); } From e20c1decdf30886e4c36654ddd3175a92ea1bebc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Jan 2015 03:51:47 +0100 Subject: [PATCH 12/13] Fixed: object instead of soc and vis versa. --- htdocs/categories/categorie.php | 2 +- htdocs/core/lib/functions.lib.php | 1 + htdocs/societe/info.php | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index e9e11b656b9..a77751fcb29 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -278,7 +278,7 @@ if ($socid) // Address print '
'.$langs->trans('Address').''; - print dol_print_address($soc->address,'gmap','thirdparty',$object->id); + print dol_print_address($soc->address,'gmap','thirdparty',$soc->id); print '
'; -dol_print_object_info($soc); +dol_print_object_info($object); print '
'; From f03ffaf5a3fe2892daba5d637b65f9a54e23ead6 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 15 Jan 2015 10:00:52 +0100 Subject: [PATCH 13/13] Fix: withdrawal create error if in the same month are deleted previus withdrawals. Conflicts: ChangeLog --- ChangeLog | 2 ++ htdocs/compta/prelevement/class/bonprelevement.class.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3b8e1193ab..1e87b51ca43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -172,6 +172,8 @@ Dolibarr better: ***** ChangeLog for 3.6.3 compared to 3.6.2 ***** - Fix: ref_ext was not saved when recording a customer order from web service +- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid. +- Fix: withdrawal create error if in the same month are deleted previus withdrawals. ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 497d690072b..d044e32e078 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2014 Ferran Marcet * @@ -895,10 +895,11 @@ class BonPrelevement extends CommonObject { $ref = "T".substr($year,-2).$month; - $sql = "SELECT count(*)"; + $sql = "SELECT CAST(RIGHT(ref,2) AS SIGNED INTEGER)"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; $sql.= " WHERE ref LIKE '".$ref."%'"; $sql.= " AND entity = ".$conf->entity; + $sql.= " ORDER BY ref DESC LIMIT 1"; dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql = $this->db->query($sql);