2
0
forked from Wavyzz/dolibarr

Compare commits

...

72 Commits

Author SHA1 Message Date
Laurent Destailleur
d7f7f5bf3d Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0 2020-01-10 19:42:34 +01:00
Laurent Destailleur
7c0a6946a7 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2020-01-10 19:42:15 +01:00
Laurent Destailleur
1ecc1afa9e Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2020-01-10 19:41:49 +01:00
Laurent Destailleur
ceb1e699b7 Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.7 2020-01-10 19:37:16 +01:00
Laurent Destailleur
c028819cab FIX clone of purchase order 2020-01-10 19:35:49 +01:00
Laurent Destailleur
d59b1bb0c6 Merge 2018-11-23 11:44:07 +01:00
Laurent Destailleur
9d582a53ca Fix compatibility with new mysql versions 2018-11-23 11:28:28 +01:00
Laurent Destailleur
8eac45a762 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0 2018-11-10 15:48:07 +01:00
Laurent Destailleur
3d85407619 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2018-11-10 15:46:31 +01:00
Laurent Destailleur
ca1e3b4d55 Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2018-11-10 15:15:33 +01:00
Laurent Destailleur
94bb1ac511 Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.7 2018-11-10 12:49:22 +01:00
Laurent Destailleur
8893d8d59f Fix compatiblity with new version of PHP 2018-11-10 11:56:23 +01:00
Laurent Destailleur
5bab9d59b2 Fix var_dump 2018-09-02 14:19:23 +02:00
Laurent Destailleur
e41b55af13 Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 4.0 2018-09-02 14:10:28 +02:00
Laurent Destailleur
a69c3caf2c Prepare compatibility with phpunit 6.1 2018-09-02 14:10:06 +02:00
Laurent Destailleur
e03d7eba8c Merge pull request #9254 from frederic34/patch-17
Build Badge by branch
2018-08-21 12:48:23 +02:00
Frédéric FRANCE
2aa0956f15 Update README.md 2018-08-16 16:08:04 +02:00
Frédéric FRANCE
bb09bcece4 Update README.md 2018-08-16 16:03:56 +02:00
Laurent Destailleur
94de6efa4b Merge pull request #8291 from ATM-Marc/FIX_order_export_date_livraison
FIX: add planned delivery to order exports
2018-03-07 12:59:32 +01:00
Marc de Lima Lucio
dd208348c4 FIX: add planned delivery to order exports 2018-03-07 12:18:08 +01:00
Laurent Destailleur
c0e719e3d8 Fix package scripts 2018-01-26 01:39:42 +01:00
Laurent Destailleur
5adeaf9d76 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0 2018-01-11 00:54:30 +01:00
Laurent Destailleur
9253fed754 Revert "Code comment"
This reverts commit 8000777864.
2018-01-11 00:17:32 +01:00
Laurent Destailleur
8000777864 Code comment 2018-01-10 20:43:56 +01:00
Laurent Destailleur
e4725f4248 FIX #7933 2017-12-10 20:55:51 +01:00
Laurent Destailleur
6de3a40546 Merge pull request #7916 from atm-ph/fix_4.0_require_class
Fix include class WorkboardResponse
2017-12-08 10:40:26 +01:00
atm-ph
c90ece1188 Fix include class WorkboardResponse 2017-12-06 14:22:37 +01:00
Laurent Destailleur
c7d0e917fb Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0 2017-12-02 14:12:43 +01:00
Laurent Destailleur
42b7d80567 FIX #7824
Conflicts:
	htdocs/product/stock/replenishorders.php
2017-11-17 14:12:53 +01:00
Laurent Destailleur
141df52dd6 Merge pull request #7741 from frederic34/patch-1
swap llxfooter() and $db->close()
2017-11-02 09:53:06 +01:00
Frédéric FRANCE
01a3787664 swap llxfooter() and $db->close() 2017-10-31 13:45:13 +01:00
Laurent Destailleur
783efd1a71 Merge pull request #7722 from fmarcet/4.0
FIX: paid supplier invoices are shown as abandoned
2017-10-28 22:01:30 +02:00
Ferran Marcet
9178d80349 Merge remote-tracking branch 'origin/4.0' into 4.0 2017-10-27 11:52:15 +02:00
Ferran Marcet
bc8127d685 Fix: paid supplier invoices are shown as abandoned on the consumption card. 2017-10-27 11:52:05 +02:00
Laurent Destailleur
9bcf01bf3f Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 4.0 2017-10-27 02:30:55 +02:00
Laurent Destailleur
fed0f3d09e Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0
Conflicts:
	htdocs/core/lib/project.lib.php
	htdocs/projet/class/task.class.php
2017-10-27 02:30:33 +02:00
Laurent Destailleur
c387436a68 Merge pull request #7671 from simnandez/4.0
FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart
2017-10-22 03:20:22 +02:00
Laurent Destailleur
8ac7dd8e9a Merge pull request #7660 from atm-gauthier/fix_project_time_spent
FIX : wrong personnal project time spent
2017-10-22 02:26:34 +02:00
Juanjo Menent
75580f253e FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart 2017-10-20 12:57:32 +02:00
gauthier
3793ae323a FIX : wrong personnal project time spent 2017-10-19 09:46:19 +02:00
Laurent Destailleur
ef61407d95 Merge pull request #7459 from fmarcet/4.0
Fix: #7358 User can't create holiday requests
2017-09-24 21:54:33 +02:00
Laurent Destailleur
5776a948c4 Update card.php 2017-09-24 21:54:26 +02:00
fmarcet
72108c3a4e Fix: #7358 User can't create holiday requests with 'Create/modify your leave requests' rights 2017-09-21 15:59:50 +02:00
Laurent Destailleur
e61bcd03ed Fix travis 2017-09-16 13:03:27 +02:00
Laurent Destailleur
3295498e9e Remove code comment 2017-09-16 12:50:34 +02:00
Laurent Destailleur
e9912c020e Merge pull request #7333 from fappels/4.0_fix_transfer_line_extrafields
FIX transfer of line extrafields from order to invoice
2017-09-11 14:06:50 +02:00
fappels
7c743eb7da Rename $extrafields because already used 2017-09-07 21:04:15 +02:00
Laurent Destailleur
6701ad8b73 Merge pull request #7334 from fappels/4.0_fix_export_missing_sup_discount_qty
FIX missing supplier qty and supplier discount in available fields for product export.
2017-09-07 18:02:58 +02:00
fappels
5a75e14a8a Add supplier qty and supplier discount for export 2017-09-05 22:50:34 +02:00
fappels
f5e14c9d70 Transfer of customer order line extrafield should only transfer fields available in target 2017-09-05 21:41:49 +02:00
fappels
237270a27e Add missing transfer of line extrafields in create invoice from supplier order 2017-09-05 21:40:04 +02:00
Laurent Destailleur
67b5353861 Merge pull request #7327 from marcosgdf/bug-7000
FIX #7000 Dashboard link for late pending payment supplier invoices do not work
2017-09-04 10:54:58 +02:00
Laurent Destailleur
4dd58a94f3 Update list.php 2017-09-04 10:54:50 +02:00
Laurent Destailleur
1821be87e9 Merge pull request #7326 from marcosgdf/bug-7325
FIX #7325 Default VAT rate when editing template invoices is 0%
2017-09-04 10:53:07 +02:00
Laurent Destailleur
1154f871f1 Update fiche-rec.php 2017-09-04 10:52:49 +02:00
Marcos García
eb9e8c9dfc FIX #7000 Dashboard link for late pending payment supplier invoices do not work
Close #7000
2017-09-03 12:42:05 +02:00
Marcos García
ac7f1035e1 FIX #7325 Default VAT rate when editing template invoices is 0%
Close #7325
2017-09-03 12:25:27 +02:00
Laurent Destailleur
9fe1d8462a Merge pull request #7318 from atm-maxime/fix_extrafieldsline_insert
Fix extrafieldsline insert
2017-09-02 00:07:00 +02:00
Maxime Kohlhaas
cf49c274a6 Better fix 2017-09-01 10:38:50 +02:00
Maxime Kohlhaas
1a956cce9a Fix : insert line extrafield 2017-09-01 10:31:22 +02:00
Laurent Destailleur
256f6e410c Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0 2017-08-22 11:14:51 +02:00
Laurent Destailleur
d5d337c631 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-08-22 11:14:27 +02:00
Laurent Destailleur
71818da6a5 Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2017-08-22 11:13:58 +02:00
Laurent Destailleur
c53aef9955 Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.7 2017-08-22 10:51:30 +02:00
Laurent Destailleur
a18995d3dc Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.7 2017-08-22 10:47:47 +02:00
Laurent Destailleur
112a6f7b44 Fix travis 2017-08-17 23:51:35 +02:00
Laurent Destailleur
9ad2a9ac85 Merge pull request #7248 from fappels/4.0_fix_best_buy_price_calculation
FIX Best buy price calculation
2017-08-10 13:51:01 +02:00
Laurent Destailleur
2a59dbbc89 Merge pull request #7243 from altatof/fix_fourcard_hooks
FIX : supplier id was not passed to hooks
2017-08-10 13:44:43 +02:00
fappels
ca3cdfabec FIX Best buy price calculation
Best buy price also depends on buy discount.
2017-08-09 14:15:26 +02:00
Laurent Destailleur
bfa8630feb Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 4.0 2017-08-07 20:07:36 +02:00
Laurent Destailleur
0bf4ac6fb3 Add missing field fk_supplier_proposal 2017-08-07 20:06:26 +02:00
altatof
2be75420ca FIX : supplier id was not passed to hooks 2017-08-07 10:21:38 +02:00
84 changed files with 472 additions and 274 deletions

View File

@@ -2,6 +2,7 @@
# from Dolibarr GitHub repository. # from Dolibarr GitHub repository.
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/
dist: precise
sudo: required sudo: required
language: php language: php
@@ -130,10 +131,10 @@ before_script:
echo "Set timezone" echo "Set timezone"
echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
echo #echo
echo "Enabling APC for PHP <= 5.4" #echo "Enabling APC for PHP <= 5.4"
# Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6! # Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini #echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
echo echo
echo "Enabling Memcached for PHP <= 5.4" echo "Enabling Memcached for PHP <= 5.4"
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly! # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly!

View File

@@ -1,6 +1,6 @@
# DOLIBARR ERP & CRM # DOLIBARR ERP & CRM
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) ![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/4.0.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg)
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...). Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).

View File

@@ -19,7 +19,7 @@ use Cwd;
# Change this to defined target for option 98 and 99 # Change this to defined target for option 98 and 99
$PROJECT="dolibarr"; $PROJECT="dolibarr";
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr"; $PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
$PUBLISHBETARC="ldestailleur\@vmprod.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files"; $PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages #@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages

View File

@@ -2,8 +2,8 @@
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-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-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 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
@@ -1255,6 +1255,7 @@ class ActionComm extends CommonObject
{ {
// Note: Output of sql request is encoded in $conf->file->character_set_client // Note: Output of sql request is encoded in $conf->file->character_set_client
// This assignment in condition is not a bug. It allows walking the results. // This assignment in condition is not a bug. It allows walking the results.
$diff = 0;
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$qualified=true; $qualified=true;
@@ -1289,8 +1290,9 @@ class ActionComm extends CommonObject
if ($qualified && $datestart) if ($qualified && $datestart)
{ {
$eventarray[$datestart]=$event; $eventarray[$datestart+$diff]=$event;
} }
$diff++;
} }
} }
else else

View File

@@ -1153,7 +1153,9 @@ if (empty($reshook))
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid); $targetExtraFields = new ExtraFields($db);
$targetExtraFieldLabels = $targetExtraFields->fetch_name_optionals_label($object->table_element_line);
$lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraFieldLabels);
$array_options = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
* *
* 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
@@ -161,6 +162,6 @@ else
print $langs->trans("ErrorUnknown"); print $langs->trans("ErrorUnknown");
} }
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@@ -896,7 +896,7 @@ if ($action == 'create')
$langs->load('projects'); $langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td>'; print '<tr><td>' . $langs->trans('Project') . '</td><td>';
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0); $numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td></tr>'; print '</td></tr>';
} }
@@ -963,7 +963,7 @@ if ($action == 'create')
$disableedit=1; $disableedit=1;
$disablemove=1; $disablemove=1;
$disableremove=1; $disableremove=1;
$ret = $object->printObjectLines('', $mysoc, $soc, $lineid, 0); // No date selector for template invoice $ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
} }
print "</table>\n"; print "</table>\n";
@@ -1307,7 +1307,7 @@ else
{ {
//$disableedit=1; //$disableedit=1;
//$disablemove=1; //$disablemove=1;
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice $ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
} }
// Form to add new line // Form to add new line
@@ -1318,7 +1318,7 @@ else
$var = true; $var = true;
// Add free products/services // Add free products/services
$object->formAddObjectLine(0, $mysoc, $soc); // No date selector for template invoice $object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@@ -4156,6 +4156,13 @@ abstract class CommonObject
foreach($this->array_options as $key => $value) foreach($this->array_options as $key => $value)
{ {
$attributeKey = substr($key,8); // Remove 'options_' prefix $attributeKey = substr($key,8); // Remove 'options_' prefix
// array_option may contain extrafields from an origin object that doesn't exist in current object, we should not try to insert them
if(empty($extrafields->attribute_type[$attributeKey])) {
unset($this->array_options[$key]);
continue;
}
$attributeType = $extrafields->attribute_type[$attributeKey]; $attributeType = $extrafields->attribute_type[$attributeKey];
$attributeLabel = $extrafields->attribute_label[$attributeKey]; $attributeLabel = $extrafields->attribute_label[$attributeKey];
$attributeParam = $extrafields->attribute_param[$attributeKey]; $attributeParam = $extrafields->attribute_param[$attributeKey];

View File

@@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
function project_prepare_head($object) function project_prepare_head($object)
{ {
global $db, $langs, $conf, $user; global $db, $langs, $conf, $user;
$h = 0; $h = 0;
$head = array(); $head = array();
@@ -114,7 +114,7 @@ function project_prepare_head($object)
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove'); complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove');
return $head; return $head;
@@ -487,7 +487,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick); if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
$level--; $level--;
} }
$total_projectlinesa_spent += $lines[$i]->duration; $total_projectlinesa_spent += $lines[$i]->duration;
$total_projectlinesa_planned += $lines[$i]->planned_workload; $total_projectlinesa_planned += $lines[$i]->planned_workload;
if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration; if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration;
@@ -551,9 +551,9 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
$lastprojectid=0; $lastprojectid=0;
$workloadforid=array(); $workloadforid=array();
$lineswithoutlevel0=array(); $lineswithoutlevel0=array();
$numlines=count($lines); $numlines=count($lines);
// Create a smaller array with sublevels only to be used later. This increase dramatically performances. // Create a smaller array with sublevels only to be used later. This increase dramatically performances.
if ($parent == 0) // Always and only if at first level if ($parent == 0) // Always and only if at first level
{ {
@@ -561,10 +561,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
{ {
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
} }
} }
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
for ($i = 0 ; $i < $numlines ; $i++) for ($i = 0 ; $i < $numlines ; $i++)
{ {
if ($parent == 0) $level = 0; if ($parent == 0) $level = 0;
@@ -575,7 +575,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
{ {
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
// Break on a new project // Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{ {
@@ -585,7 +585,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
$projectstatic->id = $lines[$i]->fk_project; $projectstatic->id = $lines[$i]->fk_project;
} }
} }
if (empty($workloadforid[$projectstatic->id])) if (empty($workloadforid[$projectstatic->id]))
{ {
if ($preselectedday) if ($preselectedday)
@@ -594,7 +594,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
$workloadforid[$projectstatic->id]=1; $workloadforid[$projectstatic->id]=1;
} }
} }
$projectstatic->id=$lines[$i]->fk_project; $projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref; $projectstatic->ref=$lines[$i]->projectref;
$projectstatic->title=$lines[$i]->projectlabel; $projectstatic->title=$lines[$i]->projectlabel;
@@ -702,16 +702,16 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print '<textarea name="'.$lines[$i]->id.'note" rows="2" id="note">'; print '<textarea name="'.$lines[$i]->id.'note" rows="2" id="note">';
print '</textarea>'; print '</textarea>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }
$inc++; $inc++;
$level++; $level++;
if ($lines[$i]->id > 0) if ($lines[$i]->id > 0)
{ {
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var); if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var); else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
} }
$level--; $level--;
} }
@@ -752,7 +752,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
$lastprojectid=0; $lastprojectid=0;
$workloadforid=array(); $workloadforid=array();
$lineswithoutlevel0=array(); $lineswithoutlevel0=array();
// Create a smaller array with sublevels only to be used later. This increase dramatically performances. // Create a smaller array with sublevels only to be used later. This increase dramatically performances.
if ($parent == 0) // Always and only if at first level if ($parent == 0) // Always and only if at first level
{ {
@@ -763,18 +763,18 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
} }
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); //dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
for ($i = 0 ; $i < $numlines ; $i++) for ($i = 0 ; $i < $numlines ; $i++)
{ {
if ($parent == 0) $level = 0; if ($parent == 0) $level = 0;
if ($lines[$i]->fk_task_parent == $parent) if ($lines[$i]->fk_task_parent == $parent)
{ {
// If we want all or we have a role on task, we show it // If we want all or we have a role on task, we show it
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
{ {
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
// Break on a new project // Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{ {
@@ -782,13 +782,13 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
$lastprojectid=$lines[$i]->fk_project; $lastprojectid=$lines[$i]->fk_project;
$projectstatic->id = $lines[$i]->fk_project; $projectstatic->id = $lines[$i]->fk_project;
} }
if (empty($workloadforid[$projectstatic->id])) if (empty($workloadforid[$projectstatic->id]))
{ {
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
$workloadforid[$projectstatic->id]=1; $workloadforid[$projectstatic->id]=1;
} }
print "<tr ".$bc[$var].">\n"; print "<tr ".$bc[$var].">\n";
// Project // Project
@@ -868,7 +868,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
} }
//var_dump($projectstatic->weekWorkLoadPerTask); //var_dump($projectstatic->weekWorkLoadPerTask);
// Fields to show current time // Fields to show current time
$tableCell=''; $modeinput='hours'; $tableCell=''; $modeinput='hours';
for ($idw = 0; $idw < 7; $idw++) for ($idw = 0; $idw < 7; $idw++)
@@ -879,7 +879,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
$alreadyspent=''; $alreadyspent='';
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
$alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']); $alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']);
$tableCell ='<td align="center" class="hide'.$idw.'">'; $tableCell ='<td align="center" class="hide'.$idw.'">';
if ($alreadyspent) if ($alreadyspent)
{ {
@@ -895,7 +895,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print $tableCell; print $tableCell;
} }
dol_syslog("yyy"); dol_syslog("yyy");
print '<td align="right">'; print '<td align="right">';
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou")); else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
@@ -907,7 +907,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
// Call to show task with a lower level (task under the current task) // Call to show task with a lower level (task under the current task)
$inc++; $inc++;
$level++; $level++;
if ($lines[$i]->id > 0) if ($lines[$i]->id > 0)
{ {
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var); if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var); else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
@@ -981,7 +981,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
$projectstatic=new Project($db); $projectstatic=new Project($db);
$thirdpartystatic=new Societe($db); $thirdpartystatic=new Societe($db);
$sortfield=''; $sortfield='';
$sortorder=''; $sortorder='';
$project_year_filter=0; $project_year_filter=0;
@@ -990,7 +990,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]);
$arrayidtypeofcontact=array(); $arrayidtypeofcontact=array();
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
@@ -1033,11 +1033,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
$sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")"; $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")";
} }
} }
// Get id of project we must show tasks // Get id of project we must show tasks
$arrayidofprojects=array(); $arrayidofprojects=array();
$sql1 = "SELECT p.rowid as projectid"; $sql1 = "SELECT p.rowid as projectid";
$sql1.= $sql; $sql1.= $sql;
$resql = $db->query($sql1); $resql = $db->query($sql1);
if ($resql) if ($resql)
{ {
@@ -1052,7 +1052,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
} }
else dol_print_error($db); else dol_print_error($db);
if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1; if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1;
// Get list of project with calculation on tasks // Get list of project with calculation on tasks
$sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,"; $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,";
$sql2.= " p.dateo, p.datee,"; $sql2.= " p.dateo, p.datee,";
@@ -1083,7 +1083,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
print_liste_field_titre($langs->trans("OpportunityAmount"),"","","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("OpportunityAmount"),"","","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder);
} }
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre($langs->trans("PlannedWorkload"),"","","","",'align="right"',$sortfield,$sortorder); if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre($langs->trans("PlannedWorkload"),"","","","",'align="right"',$sortfield,$sortorder);
@@ -1091,7 +1091,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
} }
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
@@ -1109,7 +1109,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
$projectstatic->title = $objp->title; $projectstatic->title = $objp->title;
$projectstatic->datee = $db->jdate($objp->datee); $projectstatic->datee = $db->jdate($objp->datee);
$projectstatic->dateo = $db->jdate($objp->dateo); $projectstatic->dateo = $db->jdate($objp->dateo);
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td>'; print '<td>';
@@ -1135,17 +1135,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
if ($code) print $langs->trans("OppStatus".$code); if ($code) print $langs->trans("OppStatus".$code);
print '</td>'; print '</td>';
} }
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
print '<td align="right">'.$objp->nb.'</td>'; print '<td align="right">'.$objp->nb.'</td>';
$plannedworkload=$objp->planned_workload; $plannedworkload=$objp->planned_workload;
$total_plannedworkload+=$plannedworkload; $total_plannedworkload+=$plannedworkload;
if (! in_array('plannedworkload', $hiddenfields)) if (! in_array('plannedworkload', $hiddenfields))
{ {
print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>'; print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>';
} }
if (! in_array('declaredprogress', $hiddenfields)) if (! in_array('declaredprogress', $hiddenfields))
{ {
$declaredprogressworkload=$objp->declared_progess_workload; $declaredprogressworkload=$objp->declared_progess_workload;
$total_declaredprogressworkload+=$declaredprogressworkload; $total_declaredprogressworkload+=$declaredprogressworkload;
@@ -1155,7 +1155,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
print '</td>'; print '</td>';
} }
} }
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>'; print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
print "</tr>\n"; print "</tr>\n";
@@ -1174,7 +1174,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>'; print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>';
print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>'; print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>';
} }
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
print '<td class="liste_total" align="right">'.$total_task.'</td>'; print '<td class="liste_total" align="right">'.$total_task.'</td>';
if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>'; if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>';
@@ -1182,7 +1182,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
} }
print '<td class="liste_total"></td>'; print '<td class="liste_total"></td>';
print '</tr>'; print '</tr>';
$db->free($resql); $db->free($resql);
} }
else else

View File

@@ -72,7 +72,7 @@ class modCommande extends DolibarrModules
$this->depends = array("modSociete"); $this->depends = array("modSociete");
$this->requiredby = array("modExpedition"); $this->requiredby = array("modExpedition");
$this->conflictwith = array(); $this->conflictwith = array();
$this->langfiles = array('orders', 'bills', 'companies','products', 'deliveries'); $this->langfiles = array('orders', 'bills', 'companies','products', 'deliveries', 'sendings');
// Constants // Constants
$this->const = array(); $this->const = array();
@@ -178,9 +178,9 @@ class modCommande extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("commande","commande","export")); $this->export_permission[$r]=array(array("commande","commande","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.date_livraison'=>"DateDeliveryPlanned",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text'); $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.date_livraison'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'pj.ref'=>'project','cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'pj.ref'=>'project','cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect='commande'; $keyforelement='order'; $keyforaliasextra='extra'; $keyforselect='commande'; $keyforelement='order'; $keyforaliasextra='extra';

View File

@@ -73,7 +73,7 @@ class modFournisseur extends DolibarrModules
// Dependencies // Dependencies
$this->depends = array("modSociete"); $this->depends = array("modSociete");
$this->requiredby = array(); $this->requiredby = array();
$this->langfiles = array('bills', 'companies', 'suppliers', 'orders'); $this->langfiles = array('bills', 'companies', 'suppliers', 'orders', 'sendings');
// Config pages // Config pages
$this->config_page_url = array("supplier_order.php"); $this->config_page_url = array("supplier_order.php");
@@ -443,14 +443,14 @@ class modFournisseur extends DolibarrModules
$this->export_label[$r]='Commandes fournisseurs et lignes de commandes'; $this->export_label[$r]='Commandes fournisseurs et lignes de commandes';
$this->export_icon[$r]='order'; $this->export_icon[$r]='order';
$this->export_permission[$r]=array(array("fournisseur","commande","export")); $this->export_permission[$r]=array(array("fournisseur","commande","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId', $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.date_livraison'=>"DateDeliveryPlanned",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId',
'p.ref'=>'ProductRef','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel'); 'p.ref'=>'ProductRef','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel');
if (empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)) if (empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL))
{ {
unset($this->export_fields_array['f.date_approve2']); unset($this->export_fields_array['f.date_approve2']);
unset($this->export_fields_array['ua2.login']); unset($this->export_fields_array['ua2.login']);
} }
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label', $this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.date_livraison'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label',
'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text'); 'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product', $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product',
'p.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project'); 'p.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project');

View File

@@ -151,14 +151,14 @@ class modProduct extends DolibarrModules
if ($mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR'; if ($mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices')); if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'BuyingPrice','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin'));
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice')); if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric')); if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text'));
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product");

View File

@@ -66,7 +66,7 @@ $hookmanager->initHooks(array('suppliercard','globalcard'));
* Action * Action
*/ */
$parameters=array('socid'=>$socid); $parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@@ -1143,6 +1143,7 @@ class CommandeFournisseur extends CommonOrder
$this->lines[$i]->remise_percent, $this->lines[$i]->remise_percent,
'HT', 'HT',
0, 0,
$this->lines[$i]->product_type,
$this->lines[$i]->info_bits $this->lines[$i]->info_bits
); );
if ($result < 0) if ($result < 0)

View File

@@ -1507,7 +1507,7 @@ class FactureFournisseur extends CommonInvoice
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24;
$response->label=$langs->trans("SupplierBillsToPay"); $response->label=$langs->trans("SupplierBillsToPay");
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills'; $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=f.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills';
$response->img=img_object($langs->trans("Bills"),"bill"); $response->img=img_object($langs->trans("Bills"),"bill");
$facturestatic = new FactureFournisseur($this->db); $facturestatic = new FactureFournisseur($this->db);

View File

@@ -581,7 +581,8 @@ class ProductFournisseur extends Product
foreach($record_array as $record) foreach($record_array as $record)
{ {
$fourn_price = $record["price"]; $fourn_price = $record["price"];
$fourn_unitprice = $record["unitprice"]; // discount calculated buy price
$fourn_unitprice = $record["unitprice"] * (1 - $record["remise_percent"] / 100) + $record["unitcharges"] - $record["remise"];
if (!empty($conf->dynamicprices->enabled) && !empty($record["fk_supplier_price_expression"])) { if (!empty($conf->dynamicprices->enabled) && !empty($record["fk_supplier_price_expression"])) {
$prod_supplier = new ProductFournisseur($this->db); $prod_supplier = new ProductFournisseur($this->db);
$prod_supplier->product_fourn_price_id = $record["product_fourn_price_id"]; $prod_supplier->product_fourn_price_id = $record["product_fourn_price_id"];
@@ -613,7 +614,7 @@ class ProductFournisseur extends Product
$this->fourn_qty = $record["quantity"]; $this->fourn_qty = $record["quantity"];
$this->fourn_remise_percent = $record["remise_percent"]; $this->fourn_remise_percent = $record["remise_percent"];
$this->fourn_remise = $record["remise"]; $this->fourn_remise = $record["remise"];
$this->fourn_unitprice = $fourn_unitprice; $this->fourn_unitprice = $record["unitprice"];
$this->fourn_charges = $record["charges"]; // deprecated $this->fourn_charges = $record["charges"]; // deprecated
$this->fourn_unitcharges = $record["unitcharges"]; // deprecated $this->fourn_unitcharges = $record["unitcharges"]; // deprecated
$this->fourn_tva_tx = $record["tva_tx"]; $this->fourn_tva_tx = $record["tva_tx"];
@@ -622,7 +623,7 @@ class ProductFournisseur extends Product
$this->delivery_time_days = $record["delivery_time_days"]; $this->delivery_time_days = $record["delivery_time_days"];
$this->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; $this->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
$this->id = $prodid; $this->id = $prodid;
$min = $this->fourn_unitprice; $min = $fourn_unitprice;
} }
} }
} }

View File

@@ -456,7 +456,13 @@ if (empty($reshook))
$date_end=$lines[$i]->date_fin_prevue; $date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$targetExtraFields = new ExtraFields($db);
$targetExtraFieldLabels = $targetExtraFields->fetch_name_optionals_label($object->table_element_line);
$lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraFieldLabels);
}
// FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
$result = $object->addline( $result = $object->addline(
$desc, $desc,

View File

@@ -84,9 +84,12 @@ $day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int'); $month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int'); $year_lim = GETPOST('year_lim','int');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$filter = GETPOST('filtre','alpha');
$option = GETPOST('option'); $option = GETPOST('option');
if ($option == 'late') $filter = 'paye:0'; if ($option == 'late') {
$filter = 'paye:0';
}
$search_all = GETPOST('sall'); $search_all = GETPOST('sall');
$search_label = GETPOST("search_label","alpha"); $search_label = GETPOST("search_label","alpha");

View File

@@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
$myparam = GETPOST("myparam"); $myparam = GETPOST("myparam");
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$id=GETPOST('id', 'int'); $id=GETPOST('id', 'int');
$fuserid = (GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id);
// Protection if external user // Protection if external user
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();

View File

@@ -383,7 +383,7 @@ if ($showweather) $boxwork.='<th class="liste_titre hideonsmartphone" width="80"
$boxwork.='</tr>'."\n"; $boxwork.='</tr>'."\n";
// Do not include sections without management permission // Do not include sections without management permission
require DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
// Number of actions to do (late) // Number of actions to do (late)
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read)

View File

@@ -34,6 +34,7 @@ ALTER TABLE llx_product_customer_price ADD COLUMN localtax1_type varchar(10) NO
ALTER TABLE llx_product_customer_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx; ALTER TABLE llx_product_customer_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx; ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx;
ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx; ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx;
ALTER TABLE llx_supplier_proposaldet CHANGE COLUMN fk_askpricesupplier fk_supplier_proposal integer NOT NULL;
ALTER TABLE llx_opensurvey_sondage ADD COLUMN status integer DEFAULT 1 after date_fin; ALTER TABLE llx_opensurvey_sondage ADD COLUMN status integer DEFAULT 1 after date_fin;

View File

@@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once './lib/replenishment.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/lib/replenishment.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("products"); $langs->load("products");
$langs->load("stocks"); $langs->load("stocks");
@@ -39,6 +40,46 @@ $langs->load("orders");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service'); $result=restrictedArea($user,'produit|service');
$sall = GETPOST('search_all', 'alphanohtml');
$sref = GETPOST('search_ref', 'alpha');
$snom = GETPOST('search_nom', 'alpha');
$suser = GETPOST('search_user', 'alpha');
$sttc = GETPOST('search_ttc', 'alpha');
$page = GETPOST('page', 'int');
$sproduct = GETPOST('sproduct', 'int');
$search_dateyear = GETPOST('search_dateyear', 'int');
$search_datemonth = GETPOST('search_datemonth', 'int');
$search_dateday = GETPOST('search_dateday', 'int');
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder");
if (!$sortorder) $sortorder = 'DESC';
if (!$sortfield) $sortfield = 'cf.date_creation';
$page = GETPOST("page");
if ($page < 0) $page = 0;
$offset = $limit * $page;
/*
* Actions
*/
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$sall="";
$sref="";
$snom="";
$suser="";
$sttc="";
$search_date='';
$search_datemonth='';
$search_dateday='';
$search_dateyear='';
$sproduct=0;
}
/* /*
@@ -120,17 +161,18 @@ if ($suser) {
if ($sttc) { if ($sttc) {
$sql .= ' AND cf.total_ttc = ' . price2num($sttc); $sql .= ' AND cf.total_ttc = ' . price2num($sttc);
} }
if ($sdate) if ($search_datemonth > 0)
{ {
if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int')) if ($search_dateyear > 0 && empty($search_dateday))
{ $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,$search_datemonth,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,$search_datemonth,false))."'";
$date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int')); else if ($search_dateyear > 0 && ! empty($search_dateday))
} $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_datemonth, $search_dateday, $search_dateyear))."'";
else else
{ $sql.= " AND date_format(cf.date_creation, '%m') = '".$search_datemonth."'";
$date = dol_stringtotime($sdate); }
} else if ($search_dateyear > 0)
$sql .= " AND cf.date_creation = '" . $db->idate($date) . "'"; {
$sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,12,false))."'";
} }
if ($sall) { if ($sall) {
$sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" '; $sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" ';
@@ -159,6 +201,18 @@ if ($resql)
print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, ''); print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, '');
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($sref) $param.='&search_ref='.urlencode($sref);
if ($snom) $param.='&search_nom='.urlencode($snom);
if ($suser) $param.='&search_user='.urlencode($suser);
if ($sttc) $param.='&search_ttc='.urlencode($sttc);
if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear);
if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth);
if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<table class="noborder" width="100%">'. print '<table class="noborder" width="100%">'.
@@ -168,7 +222,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.ref', 'cf.ref',
'', '',
'', $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
@@ -178,7 +232,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
's.nom', 's.nom',
'', '',
'', $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
@@ -188,7 +242,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'u.login', 'u.login',
'', '',
'', $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
@@ -198,7 +252,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.total_ttc', 'cf.total_ttc',
'', '',
'', $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
@@ -208,7 +262,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.date_creation', 'cf.date_creation',
'', '',
'', $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
@@ -218,11 +272,12 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.fk_statut', 'cf.fk_statut',
'', '',
'', $param,
'align="right"', 'align="right"',
$sortfield, $sortfield,
$sortorder $sortorder
); );
print '</tr>'. print '</tr>'.
'<tr class="liste_titre">'. '<tr class="liste_titre">'.
@@ -239,7 +294,7 @@ if ($resql)
'<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">'. '<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">'.
'</td>'. '</td>'.
'<td class="liste_titre">'. '<td class="liste_titre">'.
$form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). $form->select_date($search_date, 'search_date', 0, 0, 1, '', 1, 0, 1, 0, '').
'</td>'. '</td>'.
'<td class="liste_titre" align="right">'; '<td class="liste_titre" align="right">';
$src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png'; $src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png';

View File

@@ -631,7 +631,7 @@ class Task extends CommonObject
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2"; $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2";
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2";
} }
else else
{ {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
} }
@@ -884,7 +884,7 @@ class Task extends CommonObject
$tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time"); $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time");
$ret = $tasktime_id; $ret = $tasktime_id;
$this->timespent_id = $ret; $this->timespent_id = $ret;
if (! $notrigger) if (! $notrigger)
{ {
// Call trigger // Call trigger
@@ -948,10 +948,10 @@ class Task extends CommonObject
global $langs; global $langs;
$id=$this->id; $id=$this->id;
if (empty($id)) if (empty($id))
{ {
dol_syslog("getSummaryOfTimeSpent called on a not loaded task", LOG_ERR); dol_syslog("getSummaryOfTimeSpent called on a not loaded task", LOG_ERR);
return -1; return -1;
} }
$result=array(); $result=array();
@@ -963,7 +963,7 @@ class Task extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql.= " WHERE t.fk_task = ".$id; $sql.= " WHERE t.fk_task = ".$id;
if ($userid > 0) $sql.=" AND t.fk_user = ".$userid; if ($userid > 0) $sql.=" AND t.fk_user = ".$userid;
dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@@ -1267,7 +1267,7 @@ class Task extends CommonObject
$clone_task->fetch($fromid); $clone_task->fetch($fromid);
$clone_task->fetch_optionals(); $clone_task->fetch_optionals();
//var_dump($clone_task->array_options);exit; //var_dump($clone_task->array_options);exit;
$origin_task->fetch($fromid); $origin_task->fetch($fromid);
$defaultref=''; $defaultref='';
@@ -1581,7 +1581,7 @@ class Task extends CommonObject
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
@@ -1591,12 +1591,12 @@ class Task extends CommonObject
function load_board($user) function load_board($user)
{ {
global $conf, $langs; global $conf, $langs;
$mine=0; $socid=$user->societe_id; $mine=0; $socid=$user->societe_id;
$projectstatic = new Project($this->db); $projectstatic = new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
// List of tasks (does not care about permissions. Filtering will be done later) // List of tasks (does not care about permissions. Filtering will be done later)
$sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,"; $sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
$sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,"; $sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
@@ -1619,29 +1619,29 @@ class Task extends CommonObject
if ($resql) if ($resql)
{ {
$task_static = new Task($this->db); $task_static = new Task($this->db);
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay = $conf->projet->task->warning_delay/60/60/24; $response->warning_delay = $conf->projet->task->warning_delay/60/60/24;
$response->label = $langs->trans("OpenedTasks"); $response->label = $langs->trans("OpenedTasks");
if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project'; if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project';
else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&amp;mainmenu=project'; else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&amp;mainmenu=project';
$response->img = img_object($langs->trans("Tasks"),"task"); $response->img = img_object($langs->trans("Tasks"),"task");
// This assignment in condition is not a bug. It allows walking the results. // This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$response->nbtodo++; $response->nbtodo++;
$task_static->projectstatus = $obj->projectstatus; $task_static->projectstatus = $obj->projectstatus;
$task_static->progress = $obj->progress; $task_static->progress = $obj->progress;
$task_static->fk_statut = $obj->status; $task_static->fk_statut = $obj->status;
$task_static->date_end = $this->db->jdate($obj->datee); $task_static->date_end = $this->db->jdate($obj->datee);
if ($task_static->hasDelay()) { if ($task_static->hasDelay()) {
$response->nbtodolate++; $response->nbtodolate++;
} }
} }
return $response; return $response;
} }
else else
@@ -1650,7 +1650,7 @@ class Task extends CommonObject
return -1; return -1;
} }
} }
/** /**
* Is the task delayed? * Is the task delayed?
* *
@@ -1659,7 +1659,7 @@ class Task extends CommonObject
public function hasDelay() public function hasDelay()
{ {
global $conf; global $conf;
if (! ($this->progress >= 0 && $this->progress < 100)) { if (! ($this->progress >= 0 && $this->progress < 100)) {
return false; return false;
} }
@@ -1669,5 +1669,5 @@ class Task extends CommonObject
$datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0); $datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0);
return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay))); return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay)));
} }
} }

View File

@@ -3,7 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015-2017 Ferran Marcet <fmarcet@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
@@ -245,7 +245,7 @@ if ($type_element == 'supplier_invoice')
{ // Supplier : Show products from invoices. { // Supplier : Show products from invoices.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$documentstatic=new FactureFournisseur($db); $documentstatic=new FactureFournisseur($db);
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, '; $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, ';
$tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d";
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_facture_fourn = f.rowid"; $where.= " AND d.fk_facture_fourn = f.rowid";

View File

@@ -489,7 +489,7 @@ foreach ($search_array_options as $key => $val)
$crit=$val; $crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
// Show delete result message // Show delete result message
if (GETPOST('delsoc')) if (GETPOST('delsoc'))
@@ -599,9 +599,9 @@ if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titr
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@@ -797,9 +797,9 @@ if (! empty($arrayfields['s.fk_stcomm']['checked']))
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) if (! empty($arrayfields["ef.".$key]['checked']))
{ {
$align=$extrafields->getAlignFlag($key); $align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key]; $typeofextrafield=$extrafields->attribute_type[$key];
@@ -854,7 +854,7 @@ while ($i < min($num, $limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
$companystatic->id=$obj->rowid; $companystatic->id=$obj->rowid;
$companystatic->name=$obj->name; $companystatic->name=$obj->name;
$companystatic->canvas=$obj->canvas; $companystatic->canvas=$obj->canvas;
@@ -865,7 +865,7 @@ while ($i < min($num, $limit))
$companystatic->code_fournisseur=$obj->code_fournisseur; $companystatic->code_fournisseur=$obj->code_fournisseur;
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel; $companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
$companystatic->name_alias=$obj->name_alias; $companystatic->name_alias=$obj->name_alias;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@@ -907,12 +907,12 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['s.zip']['checked'])) if (! empty($arrayfields['s.zip']['checked']))
{ {
print "<td>".$obj->zip."</td>\n"; print "<td>".$obj->zip."</td>\n";
} }
// State // State
if (! empty($arrayfields['state.nom']['checked'])) if (! empty($arrayfields['state.nom']['checked']))
{ {
print "<td>".$obj->state_name."</td>\n"; print "<td>".$obj->state_name."</td>\n";
} }
// Country // Country
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {
@@ -925,7 +925,7 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['typent.code']['checked'])) if (! empty($arrayfields['typent.code']['checked']))
{ {
print '<td align="center">'; print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code]; print $typenArray[$obj->typent_code];
print '</td>'; print '</td>';
} }

View File

@@ -61,7 +61,9 @@ class AdherentTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -79,7 +81,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) {
print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n"; print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n";
die(); die();
} }

View File

@@ -59,7 +59,9 @@ class AdminLibTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -142,21 +144,21 @@ class AdminLibTest extends PHPUnit_Framework_TestCase
return $result; return $result;
} }
/** /**
* testEnableModule * testEnableModule
* *
* @return void * @return void
*/ */
public function testEnableModule() public function testEnableModule()
{ {
global $conf, $db, $langs, $user; global $conf, $db, $langs, $user;
require_once dirname(__FILE__).'/../../htdocs/core/modules/modExpenseReport.class.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/modExpenseReport.class.php';
print "Enable module modExpenseReport"; print "Enable module modExpenseReport";
$moduledescriptor=new modExpenseReport($db); $moduledescriptor=new modExpenseReport($db);
$moduledescriptor->init(); $moduledescriptor->init();
$conf->setValues($db); $conf->setValues($db);
} }
} }

View File

@@ -61,7 +61,9 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -62,6 +62,8 @@ class BonPrelevementTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -89,7 +89,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -59,7 +59,9 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -103,7 +105,7 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
$db=$this->savdb; $db=$this->savdb;
$conf->global->MAIN_DISABLE_ALL_MAILS=1; // If I comment/remove this lien, unit test still works alone but failed when ran from AllTest. Don't know why. $conf->global->MAIN_DISABLE_ALL_MAILS=1; // If I comment/remove this lien, unit test still works alone but failed when ran from AllTest. Don't know why.
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**

View File

@@ -60,7 +60,9 @@ class CategorieTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -60,6 +60,8 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -117,7 +119,7 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
/** /**
* testChargeSocialesCreate * testChargeSocialesCreate
* *
* @return void * @return void
*/ */
public function testChargeSocialesCreate() public function testChargeSocialesCreate()
@@ -139,10 +141,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
/** /**
* testChargeSocialesFetch * testChargeSocialesFetch
* *
* @param int $id Id of social contribution * @param int $id Id of social contribution
* @return void * @return void
* *
* @depends testChargeSocialesCreate * @depends testChargeSocialesCreate
* The depends says test is run only if previous is ok * The depends says test is run only if previous is ok
*/ */
@@ -164,10 +166,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
/** /**
* testChargeSocialesValid * testChargeSocialesValid
* *
* @param Object $localobject Social contribution * @param Object $localobject Social contribution
* @return void * @return void
* *
* @depends testChargeSocialesFetch * @depends testChargeSocialesFetch
* The depends says test is run only if previous is ok * The depends says test is run only if previous is ok
*/ */
@@ -188,10 +190,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
/** /**
* testChargeSocialesOther * testChargeSocialesOther
* *
* @param Object $localobject Social contribution * @param Object $localobject Social contribution
* @return void * @return void
* *
* @depends testChargeSocialesValid * @depends testChargeSocialesValid
* The depends says test is run only if previous is ok * The depends says test is run only if previous is ok
*/ */
@@ -216,10 +218,10 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
/** /**
* testChargeSocialesDelete * testChargeSocialesDelete
* *
* @param int $id Social contribution * @param int $id Social contribution
* @return void * @return void
* *
* @depends testChargeSocialesOther * @depends testChargeSocialesOther
* The depends says test is run only if previous is ok * The depends says test is run only if previous is ok
*/ */

View File

@@ -61,7 +61,9 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -59,7 +59,9 @@ class CommandeTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -60,7 +60,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -60,6 +60,8 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -68,6 +68,8 @@ class ContactTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -207,7 +209,7 @@ class ContactTest extends PHPUnit_Framework_TestCase
$localobject->email='newemail@newemail.com'; $localobject->email='newemail@newemail.com';
$localobject->jabberid='New im id'; $localobject->jabberid='New im id';
$localobject->default_lang='es_ES'; $localobject->default_lang='es_ES';
$result=$localobject->update($localobject->id,$user); $result=$localobject->update($localobject->id,$user);
print __METHOD__." id=".$localobject->id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0, 'Contact::update error'); $this->assertLessThan($result, 0, 'Contact::update error');

View File

@@ -60,6 +60,8 @@ class ContratTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -62,7 +62,9 @@ class CoreTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -290,22 +292,22 @@ class CoreTest extends PHPUnit_Framework_TestCase
} }
// Run tests // Run tests
$_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices'; $_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices';
$result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2); $result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2);
$expectedresult=0; $expectedresult=0;
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1a'); $this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1a');
$_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices;badaction'; $_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices;badaction';
$result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2); $result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2);
$expectedresult=1; $expectedresult=1;
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1b'); $this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1b');
$_GET['aaa']="<img src='1.jpg' onerror =javascript:alert('XSS')>"; $_GET['aaa']="<img src='1.jpg' onerror =javascript:alert('XSS')>";
$result=test_sql_and_script_inject($_GET['aaa'], 0); $result=test_sql_and_script_inject($_GET['aaa'], 0);
$expectedresult=1; $expectedresult=1;
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 2'); $this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 2');
$_POST['bbb']="<img src='1.jpg' onerror =javascript:alert('XSS')>"; $_POST['bbb']="<img src='1.jpg' onerror =javascript:alert('XSS')>";
$result=test_sql_and_script_inject($_POST['bbb'], 2); $result=test_sql_and_script_inject($_POST['bbb'], 2);
$expectedresult=1; $expectedresult=1;

View File

@@ -60,6 +60,8 @@ class DateLibTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -179,32 +181,32 @@ class DateLibTest extends PHPUnit_Framework_TestCase
$user=$this->savuser; $user=$this->savuser;
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
// With same hours - Tuesday/Wednesday jan 2013 // With same hours - Tuesday/Wednesday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 1, 2013); $date1=dol_mktime(0, 0, 0, 1, 1, 2013);
$date2=dol_mktime(0, 0, 0, 1, 2, 2013); $date2=dol_mktime(0, 0, 0, 1, 2, 2013);
$result=num_public_holiday($date1,$date2,'FR',1); $result=num_public_holiday($date1,$date2,'FR',1);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(1,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for FR'); // 1 closed days $this->assertEquals(1,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for FR'); // 1 closed days
$result=num_public_holiday($date1,$date2,'XX',1); $result=num_public_holiday($date1,$date2,'XX',1);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(0,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for XX'); // no closed days (country unknown) $this->assertEquals(0,$result,'NumPublicHoliday for Tuesday/Wednesday jan 2013 for XX'); // no closed days (country unknown)
// With same hours - Friday/Sunday jan 2013 // With same hours - Friday/Sunday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 4, 2013); $date1=dol_mktime(0, 0, 0, 1, 4, 2013);
$date2=dol_mktime(0, 0, 0, 1, 6, 2013); $date2=dol_mktime(0, 0, 0, 1, 6, 2013);
$result=num_public_holiday($date1,$date2,'FR',1); $result=num_public_holiday($date1,$date2,'FR',1);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(2,$result,'NumPublicHoliday for FR'); // 1 opened day, 2 closed days $this->assertEquals(2,$result,'NumPublicHoliday for FR'); // 1 opened day, 2 closed days
$result=num_public_holiday($date1,$date2,'XX',1); $result=num_public_holiday($date1,$date2,'XX',1);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(2,$result,'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown) $this->assertEquals(2,$result,'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown)
} }
/** /**
* testNumOpenDay * testNumOpenDay
* *
@@ -217,32 +219,32 @@ class DateLibTest extends PHPUnit_Framework_TestCase
$user=$this->savuser; $user=$this->savuser;
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
// With same hours - Tuesday/Wednesday jan 2013 // With same hours - Tuesday/Wednesday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 1, 2013); $date1=dol_mktime(0, 0, 0, 1, 1, 2013);
$date2=dol_mktime(0, 0, 0, 1, 2, 2013); $date2=dol_mktime(0, 0, 0, 1, 2, 2013);
$result=num_open_day($date1,$date2,0,1,0,'FR'); $result=num_open_day($date1,$date2,0,1,0,'FR');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(1,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for FR'); // 1 opened days $this->assertEquals(1,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for FR'); // 1 opened days
$result=num_open_day($date1,$date2,0,1,0,'XX'); $result=num_open_day($date1,$date2,0,1,0,'XX');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(2,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for XX'); // 2 opened days (country unknown) $this->assertEquals(2,$result,'NumOpenDay Tuesday/Wednesday jan 2013 for XX'); // 2 opened days (country unknown)
// With same hours - Friday/Sunday jan 2013 // With same hours - Friday/Sunday jan 2013
$date1=dol_mktime(0, 0, 0, 1, 4, 2013); $date1=dol_mktime(0, 0, 0, 1, 4, 2013);
$date2=dol_mktime(0, 0, 0, 1, 6, 2013); $date2=dol_mktime(0, 0, 0, 1, 6, 2013);
$result=num_open_day($date1,$date2,0,1,0,'FR'); $result=num_open_day($date1,$date2,0,1,0,'FR');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(1,$result,'NumOpenDay for FR'); // 1 opened day, 2 closed $this->assertEquals(1,$result,'NumOpenDay for FR'); // 1 opened day, 2 closed
$result=num_open_day($date1,$date2,'XX',1); $result=num_open_day($date1,$date2,'XX',1);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(1,$result,'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown) $this->assertEquals(1,$result,'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown)
} }
/** /**
* testConvertTime2Seconds * testConvertTime2Seconds
* *

View File

@@ -60,6 +60,8 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -60,6 +60,8 @@ class DiscountTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -60,6 +60,8 @@ class EntrepotTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -64,6 +64,8 @@ class ExportTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -60,6 +60,8 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -61,6 +61,8 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -59,7 +59,9 @@ class FactureTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -60,6 +60,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -60,6 +60,8 @@ class FichinterTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -61,6 +61,8 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -399,7 +401,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".join(',',$result)."\n"; print __METHOD__." result=".join(',',$result)."\n";
$this->assertEquals(0,count($result)); $this->assertEquals(0,count($result));
} }
/** /**
* testDolDirList * testDolDirList
* *
@@ -411,7 +413,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
public function testDolDirList() public function testDolDirList()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
// Scan dir to guaruante we on't have library jquery twice (we accept exception of duplicte into ckeditor because all dir is removed for debian package, so there is no duplicate). // Scan dir to guaruante we on't have library jquery twice (we accept exception of duplicte into ckeditor because all dir is removed for debian package, so there is no duplicate).
$founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor')); $founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor'));
print __METHOD__." count(founddirs)=".count($founddirs)."\n"; print __METHOD__." count(founddirs)=".count($founddirs)."\n";

View File

@@ -60,6 +60,8 @@ class FormAdminTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -63,7 +63,9 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -63,7 +63,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -130,21 +132,21 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
/*$tmp=dol_buildpath('/google/oauth2callback.php', 0); /*$tmp=dol_buildpath('/google/oauth2callback.php', 0);
var_dump($tmp); var_dump($tmp);
*/ */
/*$tmp=dol_buildpath('/google/oauth2callback.php', 1); /*$tmp=dol_buildpath('/google/oauth2callback.php', 1);
var_dump($tmp); var_dump($tmp);
*/ */
$result=dol_buildpath('/google/oauth2callback.php', 2); $result=dol_buildpath('/google/oauth2callback.php', 2);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertStringStartsWith('http', $result); $this->assertStringStartsWith('http', $result);
$result=dol_buildpath('/google/oauth2callback.php', 3); $result=dol_buildpath('/google/oauth2callback.php', 3);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertStringStartsWith('http', $result); $this->assertStringStartsWith('http', $result);
} }
/** /**
* testGetBrowserInfo * testGetBrowserInfo
* *
@@ -999,5 +1001,5 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
return true; return true;
} }
} }

View File

@@ -62,6 +62,8 @@ class HolidayTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -201,11 +203,11 @@ class HolidayTest extends PHPUnit_Framework_TestCase
$localobject->email='newemail@newemail.com'; $localobject->email='newemail@newemail.com';
$localobject->jabberid='New im id'; $localobject->jabberid='New im id';
$localobject->default_lang='es_ES'; $localobject->default_lang='es_ES';
$result=$localobject->update($localobject->id,$user); $result=$localobject->update($localobject->id,$user);
print __METHOD__." id=".$localobject->id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0, 'Holiday::update error'); $this->assertLessThan($result, 0, 'Holiday::update error');
$result=$localobject->update_note($localobject->note_private,'_private'); $result=$localobject->update_note($localobject->note_private,'_private');
print __METHOD__." id=".$localobject->id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0, 'Holiday::update_note (private) error'); $this->assertLessThan($result, 0, 'Holiday::update_note (private) error');
@@ -213,7 +215,7 @@ class HolidayTest extends PHPUnit_Framework_TestCase
$result=$localobject->update_note($localobject->note_public, '_public'); $result=$localobject->update_note($localobject->note_public, '_public');
print __METHOD__." id=".$localobject->id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0, 'Holiday::update_note (public) error'); $this->assertLessThan($result, 0, 'Holiday::update_note (public) error');
$newobject=new Holiday($this->savdb); $newobject=new Holiday($this->savdb);
$result=$newobject->fetch($localobject->id); $result=$newobject->fetch($localobject->id);

View File

@@ -61,6 +61,8 @@ class ImagesLibTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -62,6 +62,8 @@ class ImportTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -62,7 +62,9 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -134,7 +136,7 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
// Do a test with an array starting with 0 // Do a test with an array starting with 0
$arraytotest=array(0=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "')); $arraytotest=array(0=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "'));
$arrayencodedexpected='[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]'; $arrayencodedexpected='[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]';
$encoded=json_encode($arraytotest); $encoded=json_encode($arraytotest);
$this->assertEquals($arrayencodedexpected,$encoded); $this->assertEquals($arrayencodedexpected,$encoded);
$decoded=json_decode($encoded,true); $decoded=json_decode($encoded,true);
@@ -148,7 +150,7 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
// Same test but array start with 2 instead of 0 // Same test but array start with 2 instead of 0
$arraytotest=array(2=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "')); $arraytotest=array(2=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "'));
$arrayencodedexpected='{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}'; $arrayencodedexpected='{"2":{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}}';
$encoded=json_encode($arraytotest); $encoded=json_encode($arraytotest);
$this->assertEquals($arrayencodedexpected,$encoded); $this->assertEquals($arrayencodedexpected,$encoded);
$decoded=json_decode($encoded,true); $decoded=json_decode($encoded,true);
@@ -158,7 +160,7 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
$this->assertEquals($arrayencodedexpected,$encoded); $this->assertEquals($arrayencodedexpected,$encoded);
$decoded=dol_json_decode($encoded,true); $decoded=dol_json_decode($encoded,true);
$this->assertEquals($arraytotest,$decoded,'test for dol_json_xxx'); $this->assertEquals($arraytotest,$decoded,'test for dol_json_xxx');
// Test with object // Test with object
$now=gmmktime(12,0,0,1,1,1970); $now=gmmktime(12,0,0,1,1,1970);
$objecttotest=new stdClass(); $objecttotest=new stdClass();

View File

@@ -72,6 +72,8 @@ class LangTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -60,6 +60,8 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -136,16 +138,15 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase
$this->assertEquals(25,$result[1]); $this->assertEquals(25,$result[1]);
print __METHOD__." result[2]=".$result[2]."\n"; print __METHOD__." result[2]=".$result[2]."\n";
$this->assertEquals(20,$result[2]); $this->assertEquals(20,$result[2]);
$result=getMarginInfos(10, 10, 19.6, 0, 0, 0, 8); $result=getMarginInfos(10, 10, 19.6, 0, 0, 0, 8);
var_dump($result);
print __METHOD__." result[0]=".$result[0]."\n"; print __METHOD__." result[0]=".$result[0]."\n";
$this->assertEquals(8,$result[0]); $this->assertEquals(8,$result[0]);
print __METHOD__." result[1]=".$result[1]."\n"; print __METHOD__." result[1]=".$result[1]."\n";
$this->assertEquals(12.5,$result[1]); $this->assertEquals(12.5,$result[1]);
print __METHOD__." result[2]=".$result[2]."\n"; print __METHOD__." result[2]=".$result[2]."\n";
$this->assertEquals(1/9*100,$result[2]); $this->assertEquals(1/9*100,$result[2]);
return 0; return 0;
} }

View File

@@ -59,6 +59,8 @@ class ModulesTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -62,6 +62,8 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -59,6 +59,8 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -75,7 +77,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n"; print __METHOD__."\n";
@@ -138,7 +140,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}'; $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}';
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000}'; $conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000}';
$conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED=0; $conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED=0;
$localobject=new Facture($this->savdb); $localobject=new Facture($this->savdb);
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year

View File

@@ -61,6 +61,8 @@ class PaypalTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -135,9 +137,9 @@ class PaypalTest extends PHPUnit_Framework_TestCase
$urltotest=getPaypalPaymentUrl(1,'free'); $urltotest=getPaypalPaymentUrl(1,'free');
print "urltotest=".$urltotest."\n"; print "urltotest=".$urltotest."\n";
$result=getURLContent($urltotest, 'GET'); $result=getURLContent($urltotest, 'GET');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThanOrEqual($result, 0); $this->assertLessThanOrEqual($result, 0);

View File

@@ -63,6 +63,8 @@ class PdfDocTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -62,6 +62,8 @@ class PgsqlTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -167,13 +169,13 @@ class PgsqlTest extends PHPUnit_Framework_TestCase
$result=DoliDBPgsql::convertSQLFromMysql($sql); $result=DoliDBPgsql::convertSQLFromMysql($sql);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (without SEPARATOR)'); $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (without SEPARATOR)');
// Test GROUP_CONCAT (with SEPARATOR) // Test GROUP_CONCAT (with SEPARATOR)
$sql="SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b"; $sql="SELECT a.b, GROUP_CONCAT(a.c SEPARATOR ',') FROM table GROUP BY a.b";
$result=DoliDBPgsql::convertSQLFromMysql($sql); $result=DoliDBPgsql::convertSQLFromMysql($sql);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)'); $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b", 'Test GROUP_CONCAT (with SEPARATOR)');
return $result; return $result;
} }
} }

View File

@@ -67,7 +67,9 @@ class PricesTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -160,8 +162,8 @@ class PricesTest extends PHPUnit_Framework_TestCase
print __METHOD__." result1=".join(', ',$result1)."\n"; print __METHOD__." result1=".join(', ',$result1)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.56),$result1,'Test1 FR'); $this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.56),$result1,'Test1 FR');
/* /*
* Country Spain * Country Spain
*/ */

View File

@@ -60,7 +60,9 @@ class ProductTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -61,6 +61,8 @@ class ProjectTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -60,6 +60,8 @@ class PropalTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -64,7 +64,9 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -106,7 +108,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
$user=$this->savuser; $user=$this->savuser;
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
$this->api_url=DOL_MAIN_URL_ROOT.'/api/index.php'; $this->api_url=DOL_MAIN_URL_ROOT.'/api/index.php';
$login='admin'; $login='admin';
@@ -149,7 +151,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
$url = $this->api_url.'/user/123456789?api_key='.$this->api_key; $url = $this->api_url.'/user/123456789?api_key='.$this->api_key;
//$addheaders=array('Content-Type: application/json'); //$addheaders=array('Content-Type: application/json');
print __METHOD__." Request url=".$url."\n"; print __METHOD__." Request url=".$url."\n";
$result=getURLContent($url, 'GET', '', 1, array()); $result=getURLContent($url, 'GET', '', 1, array());
//print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n";
@@ -158,7 +160,7 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
$object=json_decode($result['content'], true); $object=json_decode($result['content'], true);
$this->assertNotNull($object, "Parsing of json result must no be null"); $this->assertNotNull($object, "Parsing of json result must no be null");
$this->assertEquals(404, $object['error']['code']); $this->assertEquals(404, $object['error']['code']);
$url = $this->api_url.'/user/1?api_key='.$this->api_key; $url = $this->api_url.'/user/1?api_key='.$this->api_key;
print __METHOD__." Request url=".$url."\n"; print __METHOD__." Request url=".$url."\n";
@@ -172,18 +174,18 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
} }
public function testRestCreateUser() { public function testRestCreateUser() {
// attemp to create without mandatory fields : // attemp to create without mandatory fields :
$url = $this->api_url.'/user?api_key='.$this->api_key; $url = $this->api_url.'/user?api_key='.$this->api_key;
$addheaders=array('Content-Type: application/json'); $addheaders=array('Content-Type: application/json');
$bodyobj = array( $bodyobj = array(
"lastname"=>"testRestUser", "lastname"=>"testRestUser",
"password"=>"testRestPassword", "password"=>"testRestPassword",
"email"=>"test@restuser.com" "email"=>"test@restuser.com"
); );
$body = json_encode($bodyobj); $body = json_encode($bodyobj);
print __METHOD__." Request url=".$url."\n"; print __METHOD__." Request url=".$url."\n";
$result=getURLContent($url, 'POST', $body, 1, $addheaders); $result=getURLContent($url, 'POST', $body, 1, $addheaders);
//print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n";
@@ -207,17 +209,17 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; print __METHOD__." Result code for creating user ".var_export($result, true)."\n";
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
$this->assertEquals($result['curl_error_no'],''); $this->assertEquals($result['curl_error_no'],'');
$object=json_decode($result['content'], true); $object=json_decode($result['content'], true);
$this->assertNotNull($object, "Parsing of json result must no be null"); $this->assertNotNull($object, "Parsing of json result must no be null");
$this->assertGreaterThan(0, $object['id'], $object['error']['code'].' '.$object['error']['message']); $this->assertGreaterThan(0, $object['id'], $object['error']['code'].' '.$object['error']['message']);
// attempt to create duplicated user // attempt to create duplicated user
print __METHOD__." Request url=".$url."\n"; print __METHOD__." Request url=".$url."\n";
$result=getURLContent($url, 'POST', $body, 1, $addheaders); $result=getURLContent($url, 'POST', $body, 1, $addheaders);
//print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n";
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
$this->assertEquals($result['curl_error_no'],''); $this->assertEquals($result['curl_error_no'],'');
$object=json_decode($result['content'], true); $object=json_decode($result['content'], true);
$this->assertNotNull($object, "Parsing of json result must no be null"); $this->assertNotNull($object, "Parsing of json result must no be null");
$this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
} }

View File

@@ -72,6 +72,8 @@ class ScriptsTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -72,6 +72,8 @@ class SecurityTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;

View File

@@ -60,7 +60,9 @@ class SocieteTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -72,7 +72,9 @@ class SqlTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -143,16 +145,16 @@ class SqlTest extends PHPUnit_Framework_TestCase
$listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration'); $listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration');
foreach ($listofsqldir as $dir) foreach ($listofsqldir as $dir)
{ {
print 'Process dir '.$dir."\n"; print 'Process dir '.$dir."\n";
$filesarray = scandir($dir); $filesarray = scandir($dir);
foreach($filesarray as $key => $file) foreach($filesarray as $key => $file)
{ {
if (! preg_match('/\.sql$/',$file)) if (! preg_match('/\.sql$/',$file))
continue; continue;
print 'Check sql file '.$file."\n"; print 'Check sql file '.$file."\n";
$filecontent=file_get_contents($dir.'/'.$file); $filecontent=file_get_contents($dir.'/'.$file);
@@ -167,7 +169,7 @@ class SqlTest extends PHPUnit_Framework_TestCase
$result=strpos($filecontent,'ON DELETE CASCADE'); $result=strpos($filecontent,'ON DELETE CASCADE');
print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n"; print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n";
$this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.'); $this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.');
if ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/migration') if ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/migration')
{ {
// Test for migration files only // Test for migration files only
@@ -176,9 +178,9 @@ class SqlTest extends PHPUnit_Framework_TestCase
else else
{ {
if (preg_match('/\.key\.sql$/',$file)) if (preg_match('/\.key\.sql$/',$file))
{ {
// Test for files key files only // Test for files key files only
} }
else else
{ {

View File

@@ -59,7 +59,9 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
@@ -117,7 +119,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
/** /**
* testUserGroupCreate * testUserGroupCreate
* *
* @return void * @return void
*/ */
public function testUserGroupCreate() public function testUserGroupCreate()
@@ -139,7 +141,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
/** /**
* testUserGroupFetch * testUserGroupFetch
* *
* @param int $id Id of group * @param int $id Id of group
* @return void * @return void
* @depends testUserGroupCreate * @depends testUserGroupCreate
@@ -163,7 +165,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
/** /**
* testUserGroupUpdate * testUserGroupUpdate
* *
* @param Object $localobject Group * @param Object $localobject Group
* @return void * @return void
* @depends testUserGroupFetch * @depends testUserGroupFetch
@@ -187,7 +189,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
/** /**
* testUserGroupAddRight * testUserGroupAddRight
* *
* @param Object $localobject Object to show * @param Object $localobject Object to show
* @return void * @return void
* @depends testUserGroupUpdate * @depends testUserGroupUpdate
@@ -210,7 +212,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
/** /**
* testUserGroupDelRight * testUserGroupDelRight
* *
* @param Object $localobject Object * @param Object $localobject Object
* @return void * @return void
* @depends testUserGroupAddRight * @depends testUserGroupAddRight
@@ -233,7 +235,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
/** /**
* testUserGroupOther * testUserGroupOther
* *
* @param Object $localobject Object * @param Object $localobject Object
* @return void * @return void
* @depends testUserGroupDelRight * @depends testUserGroupDelRight
@@ -261,7 +263,7 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
/** /**
* testUserGroupDelete * testUserGroupDelete
* *
* @param int $id Id of object * @param int $id Id of object
* @return void * @return void
* @depends testUserGroupOther * @depends testUserGroupOther

View File

@@ -59,7 +59,9 @@ class UserTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -55,9 +55,9 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
protected $savdb; protected $savdb;
protected $soapclient; protected $soapclient;
protected $socid; protected $socid;
protected $ns = 'http://www.dolibarr.org/ns/'; protected $ns = 'http://www.dolibarr.org/ns/';
/** /**
* Constructor * Constructor
* We save global variables into local variables * We save global variables into local variables
@@ -66,6 +66,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
parent::__construct();
//$this->sharedFixture //$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
@@ -73,8 +75,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
$this->savlangs=$langs; $this->savlangs=$langs;
$this->savdb=$db; $this->savdb=$db;
$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php'; $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_invoice.php';
// Set the WebService URL // Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$this->soapclient = new nusoap_client($WS_DOL_URL); $this->soapclient = new nusoap_client($WS_DOL_URL);
@@ -83,7 +85,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
$this->soapclient->soap_defencoding='UTF-8'; $this->soapclient->soap_defencoding='UTF-8';
$this->soapclient->decodeUTF8(false); $this->soapclient->decodeUTF8(false);
} }
// create third_parties, needed to test an invoice // create third_parties, needed to test an invoice
$societe=new Societe($db); $societe=new Societe($db);
$societe->ref=''; $societe->ref='';
@@ -95,11 +97,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
$societe->date_creation=$now; $societe->date_creation=$now;
$societe->tva_assuj=0; $societe->tva_assuj=0;
$societe->particulier=0; $societe->particulier=0;
$societe->create($user); $societe->create($user);
$this->socid = $societe->id; $this->socid = $societe->id;
print __METHOD__." societe created id=".$societe->id."\n"; print __METHOD__." societe created id=".$societe->id."\n";
print __METHOD__." db->type=".$db->type." user->id=".$user->id; print __METHOD__." db->type=".$db->type." user->id=".$user->id;
@@ -135,9 +137,9 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
$user=$this->savuser; $user=$this->savuser;
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**
@@ -171,7 +173,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
$societe->fetch('', '', 'ref-phpunit'); $societe->fetch('', '', 'ref-phpunit');
print __METHOD__." societe loaded id=".$societe->id."\n"; print __METHOD__." societe loaded id=".$societe->id."\n";
*/ */
$body = array ( $body = array (
"id" => NULL, "id" => NULL,
"ref" => NULL, "ref" => NULL,
@@ -252,13 +254,13 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
return $result; return $result;
} }
/** /**
* testWSInvoicesGetInvoiceByRefExt * testWSInvoicesGetInvoiceByRefExt
* *
* Retrieve an invoice using ref_ext * Retrieve an invoice using ref_ext
* @depends testWSInvoicesCreateInvoice * @depends testWSInvoicesCreateInvoice
* *
* @param array $result Invoice created by create method * @param array $result Invoice created by create method
* @return array Invoice * @return array Invoice
*/ */
@@ -308,13 +310,13 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
return $result; return $result;
} }
/** /**
* testWSInvoicesUpdateInvoiceByRefExt * testWSInvoicesUpdateInvoiceByRefExt
* *
* Update an invoice using ref_ext * Update an invoice using ref_ext
* @depends testWSInvoicesCreateInvoice * @depends testWSInvoicesCreateInvoice
* *
* @param array $result invoice created by create method * @param array $result invoice created by create method
* @return array Invoice * @return array Invoice
*/ */

View File

@@ -61,7 +61,9 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -61,7 +61,9 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -68,7 +68,9 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -53,12 +53,12 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
protected $savlangs; protected $savlangs;
protected $savdb; protected $savdb;
protected $soapclient; protected $soapclient;
private $_WS_DOL_URL; private $_WS_DOL_URL;
private $_ns='http://www.dolibarr.org/ns/'; private $_ns='http://www.dolibarr.org/ns/';
/** /**
* Constructor * Constructor
@@ -68,15 +68,17 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;
$this->savlangs=$langs; $this->savlangs=$langs;
$this->savdb=$db; $this->savdb=$db;
$this->_WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; $this->_WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php';
// Set the WebService URL // Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$this->_WS_DOL_URL."\n"; print __METHOD__." create nusoap_client for URL=".$this->_WS_DOL_URL."\n";
$this->soapclient = new nusoap_client($this->_WS_DOL_URL); $this->soapclient = new nusoap_client($this->_WS_DOL_URL);
@@ -146,10 +148,10 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
$user=$this->savuser; $user=$this->savuser;
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
$WS_METHOD = 'createThirdParty'; $WS_METHOD = 'createThirdParty';
// Call the WebService method and store its result in $result. // Call the WebService method and store its result in $result.
$authentication=array( $authentication=array(
'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
@@ -157,7 +159,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>'');
$body = array ( $body = array (
"id" => NULL, "id" => NULL,
"ref" => "name", "ref" => "name",
@@ -195,7 +197,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
"vat_used" => "", "vat_used" => "",
"vat_number" => "" "vat_number" => ""
); );
// Test URL // Test URL
$result=''; $result='';
$parameters = array('authentication'=>$authentication, 'thirdparty'=>$body); $parameters = array('authentication'=>$authentication, 'thirdparty'=>$body);
@@ -215,20 +217,20 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
print $this->soapclient->response; print $this->soapclient->response;
print "\n"; print "\n";
} }
print __METHOD__." result=".$result['result']['result_code']."\n"; print __METHOD__." result=".$result['result']['result_code']."\n";
$this->assertEquals('OK',$result['result']['result_code']); $this->assertEquals('OK',$result['result']['result_code']);
$this->assertEquals('name',$result['ref']); $this->assertEquals('name',$result['ref']);
return $result; return $result;
} }
/** /**
* testWSThirdpartygetThirdPartyById * testWSThirdpartygetThirdPartyById
* *
* Use id to retrieve thirdparty * Use id to retrieve thirdparty
* @depends testWSThirdpartycreateThirdParty * @depends testWSThirdpartycreateThirdParty
* *
* @param array $result thirdparty created by create method * @param array $result thirdparty created by create method
* @return array thirpdarty updated * @return array thirpdarty updated
*/ */
@@ -278,18 +280,18 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
$this->assertEquals('0', $result['thirdparty']['status']); $this->assertEquals('0', $result['thirdparty']['status']);
$this->assertEquals('1', $result['thirdparty']['client']); $this->assertEquals('1', $result['thirdparty']['client']);
$this->assertEquals('0', $result['thirdparty']['supplier']); $this->assertEquals('0', $result['thirdparty']['supplier']);
return $result; return $result;
} }
/** /**
* testWSThirdpartygetThirdPartyByRefExt * testWSThirdpartygetThirdPartyByRefExt
* *
* Use ref_ext to retrieve thirdparty * Use ref_ext to retrieve thirdparty
* *
* @depends testWSThirdpartycreateThirdParty * @depends testWSThirdpartycreateThirdParty
* *
* @param array $result thirdparty created by create method * @param array $result thirdparty created by create method
* @return array thirdparty * @return array thirdparty
*/ */
@@ -301,9 +303,9 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
$id = $result['id']; $id = $result['id'];
$WS_METHOD = 'getThirdParty'; $WS_METHOD = 'getThirdParty';
// Call the WebService method and store its result in $result. // Call the WebService method and store its result in $result.
$authentication=array( $authentication=array(
'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
@@ -311,7 +313,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>'');
// Test URL // Test URL
$result=''; $result='';
$parameters = array('authentication'=>$authentication, 'id'=>'', 'ref'=>'', 'ref_ext'=>'12'); $parameters = array('authentication'=>$authentication, 'id'=>'', 'ref'=>'', 'ref_ext'=>'12');
@@ -332,7 +334,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
print $this->soapclient->response; print $this->soapclient->response;
print "\n"; print "\n";
} }
print __METHOD__." result=".$result['result']['result_code']."\n"; print __METHOD__." result=".$result['result']['result_code']."\n";
$this->assertEquals('OK',$result['result']['result_code']); $this->assertEquals('OK',$result['result']['result_code']);
$this->assertEquals($id, $result['thirdparty']['id']); $this->assertEquals($id, $result['thirdparty']['id']);
@@ -341,11 +343,11 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
$this->assertEquals('0', $result['thirdparty']['status']); $this->assertEquals('0', $result['thirdparty']['status']);
$this->assertEquals('1', $result['thirdparty']['client']); $this->assertEquals('1', $result['thirdparty']['client']);
$this->assertEquals('0', $result['thirdparty']['supplier']); $this->assertEquals('0', $result['thirdparty']['supplier']);
return $result; return $result;
} }
/** /**
* testWSThirdpartydeleteThirdParty * testWSThirdpartydeleteThirdParty
* *
@@ -362,9 +364,9 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
$id = $result['id']; $id = $result['id'];
$WS_METHOD = 'deleteThirdParty'; $WS_METHOD = 'deleteThirdParty';
// Call the WebService method and store its result in $result. // Call the WebService method and store its result in $result.
$authentication=array( $authentication=array(
'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
@@ -372,7 +374,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>'');
$result=''; $result='';
$parameters = array('authentication'=>$authentication, 'id'=>$id, 'ref'=>'', 'ref_ext'=>''); $parameters = array('authentication'=>$authentication, 'id'=>$id, 'ref'=>'', 'ref_ext'=>'');
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
@@ -393,7 +395,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result['result']['result_code']."\n"; print __METHOD__." result=".$result['result']['result_code']."\n";
$this->assertEquals('OK',$result['result']['result_code']); $this->assertEquals('OK',$result['result']['result_code']);
return $result; return $result;
} }

View File

@@ -61,7 +61,9 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;

View File

@@ -59,7 +59,9 @@ class XCalLibTest extends PHPUnit_Framework_TestCase
*/ */
function __construct() function __construct()
{ {
//$this->sharedFixture parent::__construct();
//$this->sharedFixture
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$this->savconf=$conf; $this->savconf=$conf;
$this->savuser=$user; $this->savuser=$user;