forked from Wavyzz/dolibarr
Compare commits
193 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d26565199 | ||
|
|
2a6d8e77db | ||
|
|
8d2ae73663 | ||
|
|
17d9c15825 | ||
|
|
2b8255590a | ||
|
|
e6503c0d36 | ||
|
|
bac1f95e30 | ||
|
|
214dc2cba0 | ||
|
|
0b49d6316e | ||
|
|
ccd7100b7f | ||
|
|
78c0945fe7 | ||
|
|
ce910171c1 | ||
|
|
a90111cbf3 | ||
|
|
bfd5bb37c5 | ||
|
|
30050b51f0 | ||
|
|
3d58b0aef6 | ||
|
|
acbd00286c | ||
|
|
b50d92e712 | ||
|
|
5d7f182f59 | ||
|
|
8775a51cec | ||
|
|
67a1bf2b59 | ||
|
|
e60d2b0ae5 | ||
|
|
fac946dbb8 | ||
|
|
e531735444 | ||
|
|
8829db7d65 | ||
|
|
4cccaae831 | ||
|
|
984a56adc5 | ||
|
|
dc45776d31 | ||
|
|
c6ef3778b7 | ||
|
|
039bf4aae9 | ||
|
|
47b1f79030 | ||
|
|
1642d7c23b | ||
|
|
8791a9f5f1 | ||
|
|
448acbf7a1 | ||
|
|
b2271bced1 | ||
|
|
f9f95dec42 | ||
|
|
9c12444a03 | ||
|
|
494d4783a7 | ||
|
|
1c15539bb4 | ||
|
|
2c42697cae | ||
|
|
f1bb69eecf | ||
|
|
9a3305abf9 | ||
|
|
278bef8767 | ||
|
|
937f1fd3ee | ||
|
|
891297d165 | ||
|
|
64dc44b796 | ||
|
|
079ed88119 | ||
|
|
0c342284f0 | ||
|
|
5fb55cc9de | ||
|
|
a4c3a4588d | ||
|
|
bef5c2748c | ||
|
|
d0d14ea959 | ||
|
|
5840ed8258 | ||
|
|
93b216e628 | ||
|
|
b69f037dd3 | ||
|
|
abe7d91bb5 | ||
|
|
8b13c36670 | ||
|
|
1d95720644 | ||
|
|
0cf5ee2f28 | ||
|
|
20141ec9bc | ||
|
|
bd734de437 | ||
|
|
4096981378 | ||
|
|
34c19f9cf1 | ||
|
|
ac509d6565 | ||
|
|
d6ea6d1725 | ||
|
|
3d8722ee69 | ||
|
|
dbc017ae45 | ||
|
|
1fbf233f95 | ||
|
|
da41c3ffa7 | ||
|
|
4ea5068966 | ||
|
|
828fe984e8 | ||
|
|
1bb278a587 | ||
|
|
08dc7ade3b | ||
|
|
9709c8bbbf | ||
|
|
79f19f5c66 | ||
|
|
926e3fc6f9 | ||
|
|
399addebfb | ||
|
|
530ae91e82 | ||
|
|
9153400195 | ||
|
|
f5884999a9 | ||
|
|
87fb00c293 | ||
|
|
3ecc82b770 | ||
|
|
e10c89fba8 | ||
|
|
8d3adfd1c9 | ||
|
|
41545e0d60 | ||
|
|
7c9996c840 | ||
|
|
d821df070b | ||
|
|
c28a62e051 | ||
|
|
66cf9e333e | ||
|
|
d8f50f9acd | ||
|
|
4777faf49b | ||
|
|
b5db70342b | ||
|
|
efde12b489 | ||
|
|
e3c2299c67 | ||
|
|
87165cd859 | ||
|
|
65ba409add | ||
|
|
52801b13d9 | ||
|
|
ecfd3a0af5 | ||
|
|
fc8fe394db | ||
|
|
4fe4907b44 | ||
|
|
bdb55895fa | ||
|
|
ff632718fa | ||
|
|
b72794216e | ||
|
|
c3bb4a89e4 | ||
|
|
417b2f566f | ||
|
|
6fd14128ba | ||
|
|
7229b572dc | ||
|
|
7917169961 | ||
|
|
71cef95dda | ||
|
|
9aa6c72a11 | ||
|
|
972a2db3a3 | ||
|
|
9affdc0886 | ||
|
|
35145b7426 | ||
|
|
2b7ef01e42 | ||
|
|
5de88f6af1 | ||
|
|
2b43eb934f | ||
|
|
02698c5abb | ||
|
|
7bce5a354f | ||
|
|
7c772b7608 | ||
|
|
6574ebcbff | ||
|
|
2f73409360 | ||
|
|
36110da4bf | ||
|
|
3078e6fa4b | ||
|
|
d2ef56f3f1 | ||
|
|
4e5105c220 | ||
|
|
666c62af04 | ||
|
|
e07f65721a | ||
|
|
d4c35b7131 | ||
|
|
f440e78fa6 | ||
|
|
acdce83f9c | ||
|
|
aab3b2837a | ||
|
|
dc1bc33343 | ||
|
|
e19743519b | ||
|
|
78b2e9e4bf | ||
|
|
8c4324d912 | ||
|
|
dc9c2f0ed7 | ||
|
|
4fa94e3a25 | ||
|
|
ba76f12a28 | ||
|
|
9c8145eb88 | ||
|
|
696b54c6c3 | ||
|
|
70de814c3c | ||
|
|
f4ada7f18e | ||
|
|
5c2af9b7bd | ||
|
|
d6a4b58a68 | ||
|
|
570c228ee1 | ||
|
|
5dc7c9c6e5 | ||
|
|
aedd813236 | ||
|
|
fcd5e1fb2c | ||
|
|
328937e97a | ||
|
|
fc6febee53 | ||
|
|
416a0892d7 | ||
|
|
1c626c01ee | ||
|
|
a54784588b | ||
|
|
959f4d0ba0 | ||
|
|
0961ce2a2c | ||
|
|
bf7a6380c9 | ||
|
|
ec5bd2a8f8 | ||
|
|
10ced563b3 | ||
|
|
292993c14f | ||
|
|
1360372a3c | ||
|
|
f04a3bf0c8 | ||
|
|
56d6510472 | ||
|
|
45fceaeea5 | ||
|
|
c4ae712bac | ||
|
|
95c2133b07 | ||
|
|
8cfac3b5c3 | ||
|
|
18cf2f8f8b | ||
|
|
8fb70bd0ef | ||
|
|
bc09fb1154 | ||
|
|
9e6429320a | ||
|
|
ea6daeebbb | ||
|
|
b1401d6566 | ||
|
|
c2b503d90f | ||
|
|
42293089a0 | ||
|
|
b06cc18568 | ||
|
|
b85e9938e8 | ||
|
|
216f7dbaee | ||
|
|
d7007bd16b | ||
|
|
ff0b424f74 | ||
|
|
6b7d509e44 | ||
|
|
b43bd371fd | ||
|
|
13f61f2a63 | ||
|
|
9c1ba67169 | ||
|
|
8b959a09f2 | ||
|
|
2ba920a4cb | ||
|
|
7cb4f85f6b | ||
|
|
af070dad94 | ||
|
|
385aca8bf2 | ||
|
|
a9e5668ea4 | ||
|
|
1253b73879 | ||
|
|
aadf52fe59 | ||
|
|
9e67249b98 | ||
|
|
600a10fa16 |
@@ -32,11 +32,33 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once($path."../htdocs/master.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
// Main
|
||||
|
||||
/*
|
||||
* Main
|
||||
*/
|
||||
|
||||
if (empty($argv[1]))
|
||||
{
|
||||
print "Usage: ".$script_file." release=x.y.z\n";
|
||||
exit -1;
|
||||
}
|
||||
parse_str($argv[1]);
|
||||
|
||||
if ($release != DOL_VERSION)
|
||||
{
|
||||
print 'Error: release is not version declared into filefunc.in.php.'."\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
|
||||
$outputfile=dirname(__FILE__).'/../htdocs/install/filelist.xml';
|
||||
$outputdir=dirname(__FILE__).'/../htdocs/install';
|
||||
print 'Delete current files '.$outputdir.'/filelist*.xml'."\n";
|
||||
dol_delete_file($outputdir.'/filelist*.xml',0,1,1);
|
||||
|
||||
$outputfile=$outputdir.'/filelist-'.$release.'.xml';
|
||||
$fp = fopen($outputfile,'w');
|
||||
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
|
||||
fputs($fp, '<checksum_list version="'.$release.'">'."\n");
|
||||
|
||||
@@ -43,13 +43,13 @@ $rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
|
||||
// Security check
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$object = new AccountingAccount($db);
|
||||
|
||||
// Action
|
||||
if ($action == 'add') {
|
||||
if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
{
|
||||
if (! $cancel) {
|
||||
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
@@ -97,7 +97,7 @@ if ($action == 'add') {
|
||||
}
|
||||
header("Location: account.php");
|
||||
exit;
|
||||
} else if ($action == 'edit') {
|
||||
} else if ($action == 'edit' && $user->rights->accounting->chartofaccount) {
|
||||
if (! $cancel) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
@@ -145,7 +145,7 @@ if ($action == 'add') {
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit();
|
||||
}
|
||||
} else if ($action == 'delete') {
|
||||
} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if (! empty($object->id)) {
|
||||
@@ -329,14 +329,14 @@ if ($action == 'create') {
|
||||
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
|
||||
|
||||
// Active
|
||||
print '<tr><td>' . $langs->trans("Activated") . '</td>';
|
||||
print '<tr><td>' . $langs->trans("Status") . '</td>';
|
||||
print '<td colspan="2">';
|
||||
|
||||
if (empty($object->active)) {
|
||||
print $object->getLibStatut(4);
|
||||
/*if (empty($object->active)) {
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
} else {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
}
|
||||
}*/
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -350,13 +350,13 @@ if ($action == 'create') {
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->admin) {
|
||||
if (! empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Modify') . '</a>';
|
||||
}
|
||||
|
||||
if ($user->admin) {
|
||||
if (! empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Delete') . '</a>';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,8 +19,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/list.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \file htdocs/accountancy/bookkeeping/list.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief List operation of book keeping
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -21,7 +22,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/class/accountancyexport.class.php
|
||||
* \file htdocs/accountancy/class/accountancyexport.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Class accountancy export
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -157,7 +160,7 @@ class AccountancyExport
|
||||
*/
|
||||
public function exportNormal($objectLines) {
|
||||
global $conf;
|
||||
|
||||
|
||||
foreach ( $objectLines as $line ) {
|
||||
// Std export
|
||||
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
@@ -182,15 +185,16 @@ class AccountancyExport
|
||||
public function exportCegid($objectLines) {
|
||||
foreach ( $objectLines as $line ) {
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
$separator = ";";
|
||||
|
||||
print $date . $this->separator;
|
||||
print $line->code_journal . $this->separator;
|
||||
print length_accountg($line->numero_compte) . $this->separator;
|
||||
print ' ' . $this->separator;
|
||||
print $line->sens . $this->separator;
|
||||
print price($line->montant) . $this->separator;
|
||||
print dol_trunc($line->label_compte, 32) . $this->separator;
|
||||
print $line->doc_ref . $this->separator;
|
||||
print $date . $separator;
|
||||
print $line->code_journal . $separator;
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print length_accounta($line->code_tiers) . $separator;
|
||||
print $line->sens . $separator;
|
||||
print price($line->montant) . $separator;
|
||||
print $line->label_compte . $separator;
|
||||
print $line->doc_ref;
|
||||
print $this->end_line;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ class AccountingAccount extends CommonObject
|
||||
var $label;
|
||||
var $fk_user_author;
|
||||
var $fk_user_modif;
|
||||
var $active;
|
||||
var $active; // duplicate with status
|
||||
var $status;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -103,6 +104,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->active = $obj->active;
|
||||
$this->status = $obj->active;
|
||||
|
||||
return $this->id;
|
||||
} else {
|
||||
@@ -465,4 +467,61 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le libelle du statut d'un user (actif, inactif)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
function LibStatut($statut,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('users');
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
if ($statut == 1) return $langs->trans('Enabled');
|
||||
if ($statut == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('Enabled');
|
||||
if ($statut == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
||||
|
||||
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
|
||||
|
||||
print '<b>' . $langs->trans("DescVentilCustomer") . '</b>';
|
||||
print $langs->trans("DescVentilCustomer") . '<br><br>';
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
@@ -171,9 +171,9 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
@@ -220,9 +220,9 @@ print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
@@ -264,9 +264,9 @@ if (! empty($conf->margin->enabled)) {
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
@@ -291,9 +291,9 @@ if (! empty($conf->margin->enabled)) {
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
print '<td align="right">' . price(price2num($row[$i])) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@@ -87,6 +87,11 @@ if (! $user->rights->accounting->ventilation->dispatch)
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
@@ -103,13 +108,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$error = 0;
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=" . $account_parent;
|
||||
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
|
||||
|
||||
dol_syslog('accountancy/customer/lines.php::changeaccount sql= ' . $sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@@ -148,10 +153,6 @@ print '<script type="text/javascript">
|
||||
});
|
||||
</script>';
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
@@ -223,7 +224,7 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
$param = "";
|
||||
if ($search_invoice)
|
||||
$param .= "&search_invoice=" . $search_invoice;
|
||||
@@ -242,17 +243,17 @@ if ($result) {
|
||||
if ($search_tvaintra)
|
||||
$param .= "&search_tvaintra=" . $search_tvaintra;
|
||||
|
||||
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords);
|
||||
print '<td align="left"><b>' . $langs->trans("DescVentilDoneCustomer") . '</b></td>';
|
||||
|
||||
|
||||
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
||||
print $formventilation->select_account($account_parent, 'account_parent', 1);
|
||||
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '"/></div>';
|
||||
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Validate") . '"/></div>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
@@ -265,7 +266,7 @@ if ($result) {
|
||||
print_liste_field_titre($langs->trans("IntracommunityVATNumber"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
@@ -279,33 +280,33 @@ if ($result) {
|
||||
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
$facture_static = new Facture($db);
|
||||
$product_static = new Product($db);
|
||||
|
||||
|
||||
$var = True;
|
||||
while ( $objp = $db->fetch_object($result) ) {
|
||||
$var = ! $var;
|
||||
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
|
||||
|
||||
|
||||
print '<tr'. $bc[$var].'>';
|
||||
|
||||
|
||||
// Ref Invoice
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->id = $objp->rowid;
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
|
||||
|
||||
// Ref Product
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->type = $objp->product_type;
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
else
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
@@ -316,7 +317,7 @@ if ($result) {
|
||||
print '<td align="right">' . $objp->country .'</td>';
|
||||
print '<td align="center">' . $objp->tva_intra . '</td>';
|
||||
print '<td align="center"><input type="checkbox" name="changeaccount[]" value="' . $objp->fdid . '"/></td>';
|
||||
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
|
||||
@@ -103,9 +103,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
|
||||
$search_vat = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -424,7 +424,7 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
if ($reflabel == '(CustomerInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Customer');
|
||||
}
|
||||
}
|
||||
if ($reflabel == '(SocialContributionPayment)') {
|
||||
$reflabel = $langs->trans('SocialContribution');
|
||||
}
|
||||
@@ -577,9 +577,13 @@ else {
|
||||
'action' => ''
|
||||
), '', $varlink);
|
||||
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans('Export') . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
}
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -426,12 +426,12 @@ if ($action == 'export_csv') {
|
||||
));
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
}
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2014 Rapha<EFBFBD>l Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -24,9 +24,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/journal/sellsjournal.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page with sells journal
|
||||
* \file htdocs/accountancy/journal/sellsjournal.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page with sells journal
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@@ -444,12 +444,12 @@ if ($action == 'export_csv') {
|
||||
));
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
}
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -140,7 +140,7 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
||||
|
||||
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
|
||||
|
||||
print '<b>' . $langs->trans("DescVentilSupplier") . '</b>';
|
||||
print $langs->trans("DescVentilSupplier") . '<br><br>';
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
@@ -155,9 +155,9 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
@@ -205,9 +205,9 @@ print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("CAHTF") . "' AS label,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
@@ -247,4 +247,4 @@ if ($resql) {
|
||||
print "</table>\n";
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@@ -85,6 +85,11 @@ if (! $user->rights->accounting->ventilation->dispatch)
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
@@ -121,6 +126,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -198,7 +204,7 @@ if ($result) {
|
||||
|
||||
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
||||
print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1);
|
||||
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '" /></div>';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Validate") . '" /></div>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
@@ -420,7 +420,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_ref" value="'.$search_firstname.'" size="6"></td>';
|
||||
print '<input class="flat" type="text" name="search_firstname" value="'.$search_firstname.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
@@ -699,7 +699,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$i=0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'price' || preg_match('/^amount/i',$value) || preg_match('/^localtax/i',$value) || $value == 'taux') {
|
||||
if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||
}
|
||||
else if ($value == 'entity') {
|
||||
@@ -747,7 +747,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
if ($field == 'price' || preg_match('/^amount/i',$field) || preg_match('/^localtax/i',$field) || $field == 'taux') {
|
||||
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||
}
|
||||
else if ($field == 'entity') {
|
||||
@@ -1383,23 +1383,12 @@ if ($id)
|
||||
$valuetoshow = '';
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax1') {
|
||||
else if ($fieldlist[$field]=='taux') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
if ($obj->localtax1 == 0)
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax2') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
if ($obj->localtax2 == 0)
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
|
||||
{
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
$align="right";
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('recuperableonly')))
|
||||
{
|
||||
$align="center";
|
||||
|
||||
@@ -83,147 +83,17 @@ if ($action == 'update' && empty($_POST["cancel"]))
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
if (GETPOST('addfile') || GETPOST('addfilehtml'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
// Actions to send emails
|
||||
$id=0;
|
||||
$actiontypecode='';
|
||||
$trigger_name='';
|
||||
$paramname='id';
|
||||
$mode='emailfortest';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Set tmp user directory
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir = $vardir.'/temp';
|
||||
dol_add_file_process($upload_dir,0,0);
|
||||
if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';
|
||||
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml';
|
||||
|
||||
if ($_POST['addfile']) $action='test';
|
||||
if ($_POST['addfilehtml']) $action='testhtml';
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove file in email form
|
||||
*/
|
||||
if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
|
||||
{
|
||||
// Set tmp user directory
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir = $vardir.'/temp';
|
||||
|
||||
$keytodelete=isset($_POST['removedfile'])?$_POST['removedfile']:$_POST['removedfilehtml'];
|
||||
$keytodelete--;
|
||||
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
if (! empty($_SESSION["listofpaths"])) $listofpaths=explode(';',$_SESSION["listofpaths"]);
|
||||
if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]);
|
||||
if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]);
|
||||
|
||||
if ($keytodelete >= 0)
|
||||
{
|
||||
$pathtodelete=$listofpaths[$keytodelete];
|
||||
$filetodelete=$listofnames[$keytodelete];
|
||||
$result = dol_delete_file($pathtodelete,1);
|
||||
if ($result)
|
||||
{
|
||||
setEventMessages(array($langs->trans("FileWasRemoved"), $filetodelete), null, 'mesgs');
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->remove_attached_files($keytodelete);
|
||||
}
|
||||
}
|
||||
if ($_POST['removedfile'] || $action='send') $action='test';
|
||||
if ($_POST['removedfilehtml'] || $action='sendhtml') $action='testhtml';
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GETPOST('addfilehtml') && ! GETPOST('removedfile') && ! GETPOST('cancel'))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$email_from='';
|
||||
if (! empty($_POST["fromname"])) $email_from=$_POST["fromname"].' ';
|
||||
if (! empty($_POST["frommail"])) $email_from.='<'.$_POST["frommail"].'>';
|
||||
|
||||
$errors_to = $_POST["errorstomail"];
|
||||
$sendto = $_POST["sendto"];
|
||||
$sendtocc = $_POST["sendtocc"];
|
||||
$sendtoccc = $_POST["sendtoccc"];
|
||||
$subject = $_POST['subject'];
|
||||
$body = $_POST['message'];
|
||||
$deliveryreceipt= $_POST["deliveryreceipt"];
|
||||
$trackid = GETPOST('trackid');
|
||||
|
||||
//Check if we have to decode HTML
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401))) {
|
||||
$body=dol_html_entity_decode($body, ENT_COMPAT | ENT_HTML401);
|
||||
}
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$attachedfiles=$formmail->get_attached_files();
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
if (empty($_POST["frommail"]))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom")), null, 'errors');
|
||||
$action='test';
|
||||
$error++;
|
||||
}
|
||||
if (empty($sendto))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTo")), null, 'errors');
|
||||
$action='test';
|
||||
$error++;
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
// Is the message in HTML?
|
||||
$msgishtml=0; // Message is not HTML
|
||||
if ($action == 'sendhtml') $msgishtml=1; // Force message to HTML
|
||||
|
||||
// Pratique les substitutions sur le sujet et message
|
||||
$subject=make_substitutions($subject,$substitutionarrayfortest);
|
||||
$body=make_substitutions($body,$substitutionarrayfortest);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile(
|
||||
$subject,
|
||||
$sendto,
|
||||
$email_from,
|
||||
$body,
|
||||
$filepath,
|
||||
$mimetype,
|
||||
$filename,
|
||||
$sendtocc,
|
||||
$sendtoccc,
|
||||
$deliveryreceipt,
|
||||
$msgishtml,
|
||||
$errors_to,
|
||||
'',
|
||||
$trackid
|
||||
);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
|
||||
if ($result)
|
||||
{
|
||||
setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, null, 'errors');
|
||||
}
|
||||
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -747,7 +617,7 @@ else
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||
$formmail->trackid='test';
|
||||
$formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
|
||||
$formmail->withfromreadonly=0;
|
||||
$formmail->withsubstit=0;
|
||||
$formmail->withfrom=1;
|
||||
@@ -767,7 +637,7 @@ else
|
||||
// Tableau des substitutions
|
||||
$formmail->substit=$substitutionarrayfortest;
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param["action"]=($action == 'testhtml'?"sendhtml":"send");
|
||||
$formmail->param["action"]="send";
|
||||
$formmail->param["models"]="body";
|
||||
$formmail->param["mailid"]=0;
|
||||
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
||||
@@ -778,7 +648,7 @@ else
|
||||
$formmail->clear_attached_files();
|
||||
}
|
||||
|
||||
print $formmail->get_form(($action == 'testhtml'?'addfilehtml':'addfile'),($action == 'testhtml'?'removefilehtml':'removefile'));
|
||||
print $formmail->get_form('addfile','removefile');
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
@@ -121,7 +121,9 @@ $utils = new Utils($db);
|
||||
if ($what == 'mysql')
|
||||
{
|
||||
|
||||
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg
|
||||
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump=dol_sanitizePathName($cmddump);
|
||||
|
||||
if (! empty($dolibarr_main_restrict_os_commands))
|
||||
{
|
||||
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
|
||||
@@ -168,7 +170,8 @@ if ($what == 'mysqlnobin')
|
||||
// POSTGRESQL
|
||||
if ($what == 'postgresql')
|
||||
{
|
||||
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg
|
||||
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump=dol_sanitizePathName($cmddump);
|
||||
|
||||
if (! $errormsg && $cmddump)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ $langs->load("cashdesk");
|
||||
onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
|
||||
onBlur="javascript: document.getElementById('resultats_dhtml').innerHTML = '';"/>
|
||||
</td>
|
||||
<td class="select_design">
|
||||
<td class="select_design maxwidthonsmartphone">
|
||||
<?php /*
|
||||
$selected='';
|
||||
$htmlname='idprod';
|
||||
@@ -60,7 +60,7 @@ $langs->load("cashdesk");
|
||||
*/
|
||||
?>
|
||||
|
||||
<select id="selProduit" name="selProduit" onchange="javascript: setSource('LISTE');">
|
||||
<select id="selProduit" class="maxwidthonsmartphone" name="selProduit" onchange="javascript: setSource('LISTE');">
|
||||
<?php
|
||||
print '<option value="0">'.$top_liste_produits.'</option>'."\n";
|
||||
|
||||
@@ -80,7 +80,7 @@ $langs->load("cashdesk");
|
||||
|
||||
$label = $tab_designations[$i]['label'];
|
||||
|
||||
print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],7).' - '.dol_trunc($label,35,'middle');
|
||||
print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'],16).' - '.dol_trunc($label,35,'middle');
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type']==0) print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel'])?0:$tab_designations[$i]['reel']).')';
|
||||
print '</option>'."\n";
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ $langs->load("main");
|
||||
print '<div class="menu_bloc">';
|
||||
print '<ul class="menu">';
|
||||
// Link to new sell
|
||||
print '<li class="menu_choix1"><a href="affIndex.php?menutpl=facturation&id=NOUV"><span>'.$langs->trans("NewSell").'</span></a></li>';
|
||||
print '<li class="menu_choix1"><a href="affIndex.php?menutpl=facturation&id=NOUV"><span class="hideonsmartphone">'.$langs->trans("NewSell").'</span></a></li>';
|
||||
// Open new tab on backoffice (this is not a disconnect from POS)
|
||||
print '<li class="menu_choix2"><a href=".." target="backoffice"><span>'.$langs->trans("BackOffice").'</span></a></li>';
|
||||
print '<li class="menu_choix2"><a href=".." target="backoffice"><span class="hideonsmartphone">'.$langs->trans("BackOffice").'</span></a></li>';
|
||||
// Disconnect
|
||||
print '<li class="menu_choix0">'.$langs->trans("User").': '.$_SESSION['firstname'].' '.$_SESSION['lastname'];
|
||||
print ' <a href="deconnexion.php">'.img_picto($langs->trans('Logout'), 'logout.png').'</a><br>';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
*
|
||||
@@ -147,7 +147,7 @@ dol_fiche_head('');
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired" width="25%">';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">';
|
||||
print $langs->trans("Ref").'</td>';
|
||||
print '<td><input type="text" size="25" id="label" name ="label" value="'.$object->label.'" />';
|
||||
print '</tr>';
|
||||
|
||||
@@ -61,7 +61,6 @@ $result = restrictedArea($user,'societe',$id,'&societe');
|
||||
|
||||
$action = GETPOST('action');
|
||||
$mode = GETPOST("mode");
|
||||
$modesearch = GETPOST("mode_search");
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@@ -192,41 +191,15 @@ $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
|
||||
/*
|
||||
if ($mode == 'search')
|
||||
{
|
||||
if ($modesearch == 'soc')
|
||||
{
|
||||
// TODO move to DAO class
|
||||
$sql = "SELECT s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$id) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
if (!$user->rights->societe->client->voir && !$id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ( $db->num_rows($resql) == 1)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
|
||||
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ if (! empty($conf->supplier_proposal->enabled)) $supplierproposalstatic=new Supp
|
||||
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
|
||||
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
|
||||
|
||||
llxHeader();
|
||||
llxHeader("",$langs->trans("CommercialArea"));
|
||||
|
||||
print load_fiche_titre($langs->trans("CommercialArea"),'','title_commercial.png');
|
||||
|
||||
@@ -118,7 +118,7 @@ if (count($listofsearchfields))
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td class="noborderbottom" rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button "></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@@ -356,6 +357,7 @@ if ($result)
|
||||
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sall) $param.='&sall='.$sall;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year='.$year;
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
|
||||
@@ -2513,7 +2513,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
// Create contract
|
||||
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED)) {
|
||||
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED || $object->statut == Commande::STATUS_CLOSED)) {
|
||||
$langs->load("contracts");
|
||||
|
||||
if ($user->rights->contrat->creer) {
|
||||
|
||||
@@ -276,7 +276,7 @@ class Commande extends CommonOrder
|
||||
if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))))
|
||||
{
|
||||
$this->error='ErrorPermissionDenied';
|
||||
$this->error='NotEnoughPermissions';
|
||||
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -383,6 +383,7 @@ if ($resql)
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sall) $param.='&sall='.$sall;
|
||||
if ($socid > 0) $param.='&socid='.$socid;
|
||||
if ($viewstatut != '') $param.='&viewstatut='.$viewstatut;
|
||||
if ($orderday) $param.='&orderday='.$orderday;
|
||||
|
||||
@@ -221,8 +221,8 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Numero"),$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"),$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -43,7 +43,6 @@ accessforbidden();
|
||||
$langs->load("companies");
|
||||
|
||||
$mode=GETPOST("mode");
|
||||
$modesearch=GETPOST("mode_search");
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@@ -70,20 +69,15 @@ if ($action == 'note')
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
if ($mode == 'search') {
|
||||
if ($modesearch == 'soc') {
|
||||
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
|
||||
$sql.= " WHERE s.nom LIKE '%".$db->escape(strtolower($socname))."%'";
|
||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||
}
|
||||
|
||||
if ($mode == 'search')
|
||||
{
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
if ( $db->num_rows($resql) == 1) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$socid = $obj->rowid;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
|
||||
$sall = trim(GETPOST('sall'));
|
||||
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
|
||||
|
||||
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
|
||||
@@ -1996,8 +1995,10 @@ if ($action == 'create')
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||
}
|
||||
|
||||
if(!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts();
|
||||
|
||||
if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts();
|
||||
$note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null));
|
||||
$note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null));
|
||||
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
@@ -2078,13 +2079,19 @@ if ($action == 'create')
|
||||
}
|
||||
print '</tr>' . "\n";
|
||||
|
||||
// Predefined invoices
|
||||
// Overwrite value if creation of invoice is from a predefined invoice
|
||||
if (empty($origin) && empty($originid) && GETPOST('fac_rec','int') > 0)
|
||||
{
|
||||
$invoice_predefined = new FactureRec($db);
|
||||
$invoice_predefined->fetch(GETPOST('fac_rec','int'));
|
||||
|
||||
$dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later
|
||||
if (empty($projectid)) $projectid = $invoice_predefined->fk_project;
|
||||
$cond_reglement_id = $invoice_predefined->cond_reglement_id;
|
||||
$mode_reglement_id = $invoice_predefined->mode_reglement_id;
|
||||
$fk_account = $invoice_predefined->fk_account;
|
||||
$note_public = $invoice_predefined->note_public;
|
||||
$note_private = $invoice_predefined->note_private;
|
||||
|
||||
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r';
|
||||
@@ -2190,31 +2197,34 @@ if ($action == 'create')
|
||||
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
|
||||
{
|
||||
// Deposit
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#typedeposit, #valuedeposit").click(function() {
|
||||
jQuery("#radio_deposit").prop("checked", true);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
|
||||
print '<table class="nobordernopadding"><tr><td>';
|
||||
print $desc;
|
||||
print '</td>';
|
||||
if (($origin == 'propal') || ($origin == 'commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div></div>';
|
||||
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#typedeposit, #valuedeposit").click(function() {
|
||||
jQuery("#radio_deposit").prop("checked", true);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
|
||||
print '<table class="nobordernopadding"><tr><td>';
|
||||
print $desc;
|
||||
print '</td>';
|
||||
if (($origin == 'propal') || ($origin == 'commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($socid > 0)
|
||||
@@ -2244,32 +2254,36 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Replacement
|
||||
print '<!-- replacement line --><div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
|
||||
if (! $options) $tmp.=' disabled';
|
||||
$tmp.='> ';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#fac_replacement").change(function() {
|
||||
jQuery("#radio_replacement").prop("checked", true);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' ';
|
||||
$text .= '<select class="flat" name="fac_replacement" id="fac_replacement"';
|
||||
if (! $options)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($options) {
|
||||
$text .= '<option value="-1"> </option>';
|
||||
$text .= $options;
|
||||
} else {
|
||||
$text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>';
|
||||
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
|
||||
{
|
||||
print '<!-- replacement line -->';
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
|
||||
if (! $options) $tmp.=' disabled';
|
||||
$tmp.='> ';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#fac_replacement").change(function() {
|
||||
jQuery("#radio_replacement").prop("checked", true);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' ';
|
||||
$text .= '<select class="flat" name="fac_replacement" id="fac_replacement"';
|
||||
if (! $options)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($options) {
|
||||
$text .= '<option value="-1"> </option>';
|
||||
$text .= $options;
|
||||
} else {
|
||||
$text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>';
|
||||
}
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
}
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2286,48 +2300,51 @@ if ($action == 'create')
|
||||
{
|
||||
if ($socid > 0)
|
||||
{
|
||||
// Credit note
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
|
||||
if (! $optionsav) $tmp.=' disabled';
|
||||
$tmp.= '> ';
|
||||
// Show credit note options only if we checked credit note
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
if (! jQuery("#radio_creditnote").is(":checked"))
|
||||
{
|
||||
jQuery("#credit_note_options").hide();
|
||||
}
|
||||
jQuery("#radio_creditnote").click(function() {
|
||||
jQuery("#credit_note_options").show();
|
||||
});
|
||||
jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() {
|
||||
jQuery("#credit_note_options").hide();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' ';
|
||||
// $text.='<input type="text" value="">';
|
||||
$text .= '<select class="flat" name="fac_avoir" id="fac_avoir"';
|
||||
if (! $optionsav)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($optionsav) {
|
||||
$text .= '<option value="-1"></option>';
|
||||
$text .= $optionsav;
|
||||
} else {
|
||||
$text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>';
|
||||
}
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
|
||||
print '<div id="credit_note_options" class="clearboth">';
|
||||
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||
print '</div>';
|
||||
|
||||
print '</div></div>';
|
||||
// Credit note
|
||||
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
|
||||
if (! $optionsav) $tmp.=' disabled';
|
||||
$tmp.= '> ';
|
||||
// Show credit note options only if we checked credit note
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
if (! jQuery("#radio_creditnote").is(":checked"))
|
||||
{
|
||||
jQuery("#credit_note_options").hide();
|
||||
}
|
||||
jQuery("#radio_creditnote").click(function() {
|
||||
jQuery("#credit_note_options").show();
|
||||
});
|
||||
jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() {
|
||||
jQuery("#credit_note_options").hide();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' ';
|
||||
// $text.='<input type="text" value="">';
|
||||
$text .= '<select class="flat" name="fac_avoir" id="fac_avoir"';
|
||||
if (! $optionsav)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($optionsav) {
|
||||
$text .= '<option value="-1"></option>';
|
||||
$text .= $optionsav;
|
||||
} else {
|
||||
$text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>';
|
||||
}
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
|
||||
print '<div id="credit_note_options" class="clearboth">';
|
||||
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||
print '</div>';
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2390,7 +2407,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
|
||||
print '<tr><td class="nowrap fieldrequired">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
|
||||
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -2458,7 +2475,6 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
$note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null));
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
@@ -2468,7 +2484,6 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
$note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null));
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
|
||||
@@ -3125,10 +3140,10 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($action == 'editinvoicedate') {
|
||||
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date, 'invoicedate');
|
||||
} else {
|
||||
print dol_print_date($object->date, 'daytext');
|
||||
print dol_print_date($object->date, 'day');
|
||||
}
|
||||
} else {
|
||||
print dol_print_date($object->date, 'daytext');
|
||||
print dol_print_date($object->date, 'day');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@@ -3466,7 +3481,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($action == 'editdate_pointoftax') {
|
||||
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_pointoftax, 'date_pointoftax');
|
||||
} else {
|
||||
print dol_print_date($object->date_pointoftax, 'daytext');
|
||||
print dol_print_date($object->date_pointoftax, 'day');
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@@ -3506,7 +3521,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($action == 'editpaymentterm') {
|
||||
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_lim_reglement, 'paymentterm');
|
||||
} else {
|
||||
print dol_print_date($object->date_lim_reglement, 'daytext');
|
||||
print dol_print_date($object->date_lim_reglement, 'day');
|
||||
if ($object->hasDelay()) {
|
||||
print img_warning($langs->trans('Late'));
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ class FactureRec extends CommonInvoice
|
||||
public $table_element_line='facturedet_rec';
|
||||
public $fk_element='fk_facture';
|
||||
|
||||
var $entity;
|
||||
var $number;
|
||||
var $date;
|
||||
var $amount;
|
||||
@@ -241,7 +242,7 @@ class FactureRec extends CommonInvoice
|
||||
*/
|
||||
function fetch($rowid, $ref='', $ref_ext='', $ref_int='')
|
||||
{
|
||||
$sql = 'SELECT f.rowid, f.titre, f.fk_soc, f.amount, f.tva, f.total, f.total_ttc, f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql = 'SELECT f.rowid, f.entity, f.titre, f.fk_soc, f.amount, f.tva, f.total, f.total_ttc, f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql.= ', f.date_lim_reglement as dlr';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet';
|
||||
@@ -269,6 +270,7 @@ class FactureRec extends CommonInvoice
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
$this->titre = $obj->titre;
|
||||
$this->ref = $obj->titre;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
@@ -519,6 +521,7 @@ class FactureRec extends CommonInvoice
|
||||
{
|
||||
// Clean parameters
|
||||
$remise_percent=price2num($remise_percent);
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
$qty=price2num($qty);
|
||||
if (! $qty) $qty=1;
|
||||
if (! $info_bits) $info_bits=0;
|
||||
@@ -579,12 +582,12 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", ".price2num($txtva);
|
||||
$sql.= ", ".(! empty($fk_product)?"'".$fk_product."'":"null");
|
||||
$sql.= ", ".$product_type;
|
||||
$sql.= ", '".price2num($remise_percent)."'";
|
||||
$sql.= ", '".price2num($pu_ht)."'";
|
||||
$sql.= ", ".price2num($remise_percent);
|
||||
$sql.= ", ".price2num($pu_ht);
|
||||
$sql.= ", null";
|
||||
$sql.= ", '".price2num($total_ht)."'";
|
||||
$sql.= ", '".price2num($total_tva)."'";
|
||||
$sql.= ", '".price2num($total_ttc)."'";
|
||||
$sql.= ", ".price2num($total_ht);
|
||||
$sql.= ", ".price2num($total_tva);
|
||||
$sql.= ", ".price2num($total_ttc);
|
||||
$sql.= ", ".$rang;
|
||||
$sql.= ", ".$special_code;
|
||||
$sql.= ", ".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null").")";
|
||||
@@ -721,14 +724,16 @@ class FactureRec extends CommonInvoice
|
||||
}
|
||||
|
||||
/**
|
||||
* Create all recurrents invoices.
|
||||
* A result may also be provided into this->output
|
||||
* Create all recurrents invoices (for all entities if multicompany is used).
|
||||
* A result may also be provided into this->output.
|
||||
*
|
||||
* WARNING: This method change context $conf->entity to be in correct context for each recurring invoice found.
|
||||
*
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
function createRecurringInvoices()
|
||||
{
|
||||
global $langs, $db, $user;
|
||||
global $conf, $langs, $db, $user;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
@@ -743,6 +748,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ' WHERE frequency > 0'; // A recurring invoice is an invoice with a frequency
|
||||
$sql.= " AND (date_when IS NULL OR date_when <= '".$db->idate($today)."')";
|
||||
$sql.= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';
|
||||
$sql.= $db->order('entity', 'ASC');
|
||||
//print $sql;exit;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@@ -754,7 +760,9 @@ class FactureRec extends CommonInvoice
|
||||
if ($num) $this->output.=$langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n";
|
||||
else $this->output.=$langs->trans("NoQualifiedRecurringInvoiceTemplateFound");
|
||||
|
||||
while ($i < $num)
|
||||
$saventity = $conf->entity;
|
||||
|
||||
while ($i < $num) // Loop on each template invoice
|
||||
{
|
||||
$line = $db->fetch_object($resql);
|
||||
|
||||
@@ -763,7 +771,10 @@ class FactureRec extends CommonInvoice
|
||||
$facturerec = new FactureRec($db);
|
||||
$facturerec->fetch($line->rowid);
|
||||
|
||||
dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref);
|
||||
// Set entity context
|
||||
$conf->entity = $facturerec->entity;
|
||||
|
||||
dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref.", entity=".$facturerec->entity);
|
||||
|
||||
$error=0;
|
||||
|
||||
@@ -774,7 +785,7 @@ class FactureRec extends CommonInvoice
|
||||
$facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
|
||||
$facture->socid = $facturerec->socid;
|
||||
|
||||
$invoiceidgenerated = $facture->create($user); // This will also update fields of recurring invoice
|
||||
$invoiceidgenerated = $facture->create($user);
|
||||
if ($invoiceidgenerated <= 0)
|
||||
{
|
||||
$this->errors = $facture->errors;
|
||||
@@ -794,18 +805,20 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
if (! $error && $invoiceidgenerated >= 0)
|
||||
{
|
||||
$db->commit();
|
||||
$db->commit("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref);
|
||||
dol_syslog("createRecurringInvoices Process invoice template ".$facturerec->ref." is finished with a success generation");
|
||||
$nb_create++;
|
||||
$this->output.=$langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$conf->entity = $saventity; // Restore entity context
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
@@ -1060,7 +1073,7 @@ class FactureRec extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET date_when = "'.$this->db->idate($date).'"';
|
||||
$sql.= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "null");
|
||||
if ($increment_nb_gen_done>0) $sql.= ', nb_gen_done = nb_gen_done + 1';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
|
||||
@@ -239,7 +239,8 @@ class Facture extends CommonInvoice
|
||||
if (! $this->cond_reglement_id) $this->cond_reglement_id = 0;
|
||||
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
|
||||
$this->brouillon = 1;
|
||||
|
||||
if (empty($this->entity)) $this->entity = $conf->entity;
|
||||
|
||||
// Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate)
|
||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||
@@ -279,8 +280,9 @@ class Facture extends CommonInvoice
|
||||
$_facrec = new FactureRec($this->db);
|
||||
$result=$_facrec->fetch($this->fac_rec);
|
||||
|
||||
$this->socid = $_facrec->socid;
|
||||
|
||||
$this->socid = $_facrec->socid; // Invoice created on same thirdparty than template
|
||||
$this->entity = $_facrec->entity; // Invoice created in same entity than template
|
||||
|
||||
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
|
||||
$this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project;
|
||||
$this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public;
|
||||
@@ -309,13 +311,15 @@ class Facture extends CommonInvoice
|
||||
|
||||
$forceduedate = $this->calculate_date_lim_reglement();
|
||||
|
||||
// For recurrn invoices, update date and number of last generation of recurring template invoice, before inserting new invoice
|
||||
// For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice
|
||||
if ($_facrec->frequency > 0)
|
||||
{
|
||||
dol_syslog("This is a recurring invoice so we set date_last_gen and next date_when");
|
||||
if (empty($_facrec->date_when)) $_facrec->date_when = $now;
|
||||
$next_date = $_facrec->getNextDate(); // Calculate next date
|
||||
$_facrec->setValueFrom('date_last_gen', $now, '', null, 'date');
|
||||
$result = $_facrec->setValueFrom('date_last_gen', $now, '', null, 'date');
|
||||
//$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); // Not required, +1 already included into setNextDate when second param is 1.
|
||||
$_facrec->setNextDate($next_date,1);
|
||||
$result = $_facrec->setNextDate($next_date,1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +354,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'(PROV)'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$this->entity;
|
||||
$sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null");
|
||||
$sql.= ", '".$this->db->escape($this->type)."'";
|
||||
$sql.= ", '".$socid."'";
|
||||
|
||||
@@ -1002,7 +1002,7 @@ else
|
||||
if ($action == 'ask_deleteline') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
|
||||
}
|
||||
|
||||
|
||||
print $formconfirm;
|
||||
|
||||
$author = new User($db);
|
||||
@@ -1160,7 +1160,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// if "frequency" is empty or = 0, the reccurence is disabled
|
||||
print '<tr><td width="20%">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Frequency');
|
||||
print '</td>';
|
||||
@@ -1263,7 +1263,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Nb of generation already done
|
||||
print '<tr><td width="20%">'.$langs->trans("NbOfGenerationDone").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfGenerationDone").'</td>';
|
||||
print '<td>';
|
||||
print $object->nb_gen_done?$object->nb_gen_done:'0';
|
||||
print '</td>';
|
||||
@@ -1640,7 +1640,7 @@ else
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else print '<tr '.$bc[false].'><td colspan="9">'.$langs->trans("NoneF").'</td></tr>';
|
||||
else print '<tr '.$bc[false].'><td colspan="9" class="opacitymedium">'.$langs->trans("NoneF").'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
|
||||
@@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
|
||||
|
||||
|
||||
@@ -804,6 +804,7 @@ if ($resql)
|
||||
$param='&socid='.$socid;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sall) $param.='&sall='.$sall;
|
||||
if ($day) $param.='&day='.urlencode($day);
|
||||
if ($month) $param.='&month='.urlencode($month);
|
||||
if ($year) $param.='&year=' .urlencode($year);
|
||||
|
||||
@@ -117,7 +117,7 @@ if (count($listofsearchfields))
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="14"></td>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="14"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@@ -277,7 +277,8 @@ $sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'";
|
||||
$sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'";
|
||||
$sql.= " AND localtaxtype=".$localTaxType;
|
||||
$sql.= " GROUP BY dm ASC ORDER BY dm ASC";
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm ASC";
|
||||
|
||||
pt($db, $sql,$langs->trans("Year")." $y");
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/**
|
||||
* \file htdocs/compta/prelevement/class/bonprelevement.class.php
|
||||
* \ingroup prelevement
|
||||
* \brief Fichier de la classe des bons de prelevements
|
||||
* \brief File of withdrawal receipts class
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
@@ -104,11 +104,11 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Add facture to withdrawal
|
||||
* Add invoice to withdrawal
|
||||
*
|
||||
* @param int $facture_id id invoice to add
|
||||
* @param int $client_id id invoice customer
|
||||
* @param string $client_nom name of cliente
|
||||
* @param string $client_nom customer name
|
||||
* @param int $amount amount of invoice
|
||||
* @param string $code_banque code of bank withdrawal
|
||||
* @param string $code_guichet code of bank's office
|
||||
@@ -166,7 +166,7 @@ class BonPrelevement extends CommonObject
|
||||
*
|
||||
* @param int $line_id id line to add
|
||||
* @param int $client_id id invoice customer
|
||||
* @param string $client_nom name of cliente
|
||||
* @param string $client_nom customer name
|
||||
* @param int $amount amount of invoice
|
||||
* @param string $code_banque code of bank withdrawal
|
||||
* @param string $code_guichet code of bank's office
|
||||
@@ -182,7 +182,7 @@ class BonPrelevement extends CommonObject
|
||||
if ($concat == 1)
|
||||
{
|
||||
/*
|
||||
* On aggrege les lignes
|
||||
* We aggregate the lines
|
||||
*/
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
@@ -205,7 +205,7 @@ class BonPrelevement extends CommonObject
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Pas de d'agregation
|
||||
* No aggregate
|
||||
*/
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes (";
|
||||
$sql.= "fk_prelevement_bons";
|
||||
@@ -376,7 +376,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/*
|
||||
* Fin de la procedure
|
||||
* End of procedure
|
||||
*/
|
||||
if ($error == 0)
|
||||
{
|
||||
@@ -478,7 +478,7 @@ class BonPrelevement extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// Update prelevement line
|
||||
// Update withdrawal line
|
||||
// TODO: Translate to ligneprelevement.class.php
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
$sql.= " SET statut = 2";
|
||||
@@ -605,8 +605,8 @@ class BonPrelevement extends CommonObject
|
||||
$arr = array();
|
||||
|
||||
/*
|
||||
* Renvoie toutes les factures presente
|
||||
* dans un bon de prelevement
|
||||
* Returns all invoices presented
|
||||
* within a withdrawal receipt
|
||||
*/
|
||||
$sql = "SELECT fk_facture";
|
||||
if ($amounts) $sql .= ", SUM(pl.amount)";
|
||||
@@ -1565,7 +1565,7 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR ='';
|
||||
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.$row_facnumber.'-'.$Rowing).'</EndToEndId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' </PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
|
||||
@@ -1680,8 +1680,9 @@ class BonPrelevement extends CommonObject
|
||||
* @return string String with SEPA Sender
|
||||
*/
|
||||
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
|
||||
{ // SEPA INITIALISATION
|
||||
global $confs;
|
||||
{
|
||||
// SEPA INITIALISATION
|
||||
global $conf;
|
||||
|
||||
$dateTime_YMD = dol_print_date($ladate, '%Y%m%d');
|
||||
$dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d');
|
||||
|
||||
@@ -415,7 +415,7 @@ if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConcialitedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("categories");
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
|
||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
||||
$modecompta = $conf->global->ACCOUNTING_MODE;
|
||||
|
||||
@@ -365,8 +365,8 @@ if ($id)
|
||||
|
||||
|
||||
/*
|
||||
* Boutons d'actions
|
||||
*/
|
||||
* Action buttons
|
||||
*/
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
if ($object->rappro == 0)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConcialitedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -123,17 +123,9 @@ print $langs->trans("VATReportBuildWithOptionDefinedInModule").'<br>';
|
||||
print '('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td class="notopnoleft" width="50%">';
|
||||
print load_fiche_titre($langs->trans("VATSummary"), '', '');
|
||||
// The report mode is the one defined by defaut in tax module setup
|
||||
//print $modetax;
|
||||
//print '('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')';
|
||||
print '</td><td>';
|
||||
print load_fiche_titre($langs->trans("VATPaid"), '', '');
|
||||
print '</td></tr>';
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
print '<tr><td class="notopnoleft" width="50%" valign="top">';
|
||||
print load_fiche_titre($langs->trans("VATSummary"), '', '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -223,18 +215,12 @@ print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("To
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
/*}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureIsSupportedInInOutModeOnly").'</td></tr>';
|
||||
}*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</td>';
|
||||
print '<td class="notopnoleftnoright" valign="top" width="50%">';
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
print load_fiche_titre($langs->trans("VATPaid"), '', '');
|
||||
|
||||
/*
|
||||
* Payed
|
||||
@@ -250,10 +236,7 @@ $sql.= " GROUP BY dm ORDER BY dm ASC";
|
||||
pt($db, $sql,$langs->trans("Year")." $y");
|
||||
|
||||
|
||||
print "</td></tr></table>";
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div></div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@@ -380,6 +380,7 @@ if ($result)
|
||||
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
|
||||
if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
|
||||
if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier);
|
||||
if ($sall != '') $param.='&sall='.urlencode($sall);
|
||||
if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname);
|
||||
if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname);
|
||||
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
||||
|
||||
@@ -1452,7 +1452,7 @@ else
|
||||
{
|
||||
$total = 0;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre'.($cursorline?' liste_titre_add':'').'">';
|
||||
print '<td>'.$langs->trans("ServiceNb",$cursorline).'</td>';
|
||||
print '<td width="50" align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td width="50" align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
@@ -1567,7 +1567,11 @@ else
|
||||
{
|
||||
print dol_print_date($db->jdate($objp->date_debut));
|
||||
// Warning si date prevu passee et pas en service
|
||||
if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) { print " ".img_warning($langs->trans("Late")); }
|
||||
if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) {
|
||||
$warning_delay=$conf->contrat->services->inactifs->warning_delay / 3600 / 24;
|
||||
$textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
|
||||
print " ".img_warning($textlate);
|
||||
}
|
||||
}
|
||||
else print $langs->trans("Unknown");
|
||||
print ' - ';
|
||||
@@ -1575,7 +1579,11 @@ else
|
||||
if ($objp->date_fin)
|
||||
{
|
||||
print dol_print_date($db->jdate($objp->date_fin));
|
||||
if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) { print " ".img_warning($langs->trans("Late")); }
|
||||
if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) {
|
||||
$warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24;
|
||||
$textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
|
||||
print " ".img_warning($textlate);
|
||||
}
|
||||
}
|
||||
else print $langs->trans("Unknown");
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
@@ -2407,7 +2407,6 @@ class ContratLigne extends CommonObjectLine
|
||||
*/
|
||||
function fetch($id, $ref='')
|
||||
{
|
||||
global $langs,$user;
|
||||
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref)) return -1;
|
||||
@@ -2423,7 +2422,7 @@ class ContratLigne extends CommonObjectLine
|
||||
$sql.= " p.ref as product_ref,";
|
||||
$sql.= " p.label as product_label,";
|
||||
$sql.= " p.description as product_desc,";
|
||||
$sql.= " p.type as product_type,";
|
||||
$sql.= " p.fk_product_type as product_type,";
|
||||
$sql.= " t.description,";
|
||||
$sql.= " t.date_commande,";
|
||||
$sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@@ -210,11 +211,12 @@ if ($resql)
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
$param.='&search_contract='.$search_contract;
|
||||
$param.='&search_name='.$search_name;
|
||||
$param.='&search_ref_supplier='.$search_ref_supplier;
|
||||
$param.='&search_sale=' .$search_sale;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($sall != '') $param.='&sall='.$sall;
|
||||
if ($search_contract != '') $param.='&search_contract='.$search_contract;
|
||||
if ($search_name != '') $param.='&search_name='.$search_name;
|
||||
if ($search_ref_supplier != '') $param.='&search_ref_supplier='.$search_ref_supplier;
|
||||
if ($search_sale != '') $param.='&search_sale=' .$search_sale;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
|
||||
@@ -361,7 +361,12 @@ if ($resql)
|
||||
if (($mode == "" || $mode == -1) || $mode < 5)
|
||||
{
|
||||
print '<td align="center">'.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' ');
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late"));
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5)
|
||||
{
|
||||
$warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24;
|
||||
$textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
|
||||
print img_warning($textlate);
|
||||
}
|
||||
else print ' ';
|
||||
}
|
||||
if (($mode == "" || $mode == -1) || $mode >= 5) print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture));
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
* \brief Code for actions on sending mails from object page
|
||||
*/
|
||||
|
||||
|
||||
// $mysoc must be defined
|
||||
// $id must be defined
|
||||
// $actiontypecode must be defined
|
||||
// $paramname must be defined
|
||||
// $mode must be defined
|
||||
// $object and $uobject may be defined.
|
||||
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
@@ -86,11 +88,11 @@ if (GETPOST('removAll'))
|
||||
{
|
||||
$pathtodelete = $value;
|
||||
$filetodelete = $listofnames[$key];
|
||||
$result = dol_delete_file($pathtodelete,1); // Delete uploded Files
|
||||
|
||||
$result = dol_delete_file($pathtodelete,1); // Delete uploded Files
|
||||
|
||||
$langs->load("other");
|
||||
setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs');
|
||||
|
||||
|
||||
$formmail->remove_attached_files($key); // Update Session
|
||||
}
|
||||
}
|
||||
@@ -107,51 +109,55 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
|
||||
$subject='';$actionmsg='';$actionmsg2='';
|
||||
|
||||
$result=$object->fetch($id);
|
||||
|
||||
$sendtosocid=0;
|
||||
if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe')
|
||||
if (is_object($object))
|
||||
{
|
||||
$result=$object->fetch_thirdparty();
|
||||
$thirdparty=$object->thirdparty;
|
||||
$sendtosocid=$thirdparty->id;
|
||||
$result=$object->fetch($id);
|
||||
|
||||
$sendtosocid=0;
|
||||
if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe')
|
||||
{
|
||||
$result=$object->fetch_thirdparty();
|
||||
$thirdparty=$object->thirdparty;
|
||||
$sendtosocid=$thirdparty->id;
|
||||
}
|
||||
else if ($object->element == 'societe')
|
||||
{
|
||||
$thirdparty=$object;
|
||||
if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
|
||||
elseif($conf->dolimail->enabled)
|
||||
{
|
||||
$dolimail = new Dolimail($db);
|
||||
$possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1");
|
||||
$possibleuser=$dolimail->get_from_user_by_mail($_POST['sendto'],"1"); // suche in llx_societe and socpeople
|
||||
if (!$possibleaccounts && !$possibleuser)
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorFailedToFindSocieteRecord',$_POST['sendto']), null, 'errors');
|
||||
}
|
||||
elseif (count($possibleaccounts)>1)
|
||||
{
|
||||
$sendtosocid=$possibleaccounts[1]['id'];
|
||||
$result=$object->fetch($sendtosocid);
|
||||
|
||||
setEventMessages($langs->trans('ErrorFoundMoreThanOneRecordWithEmail',$_POST['sendto'],$object->name), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
if($possibleaccounts){
|
||||
$sendtosocid=$possibleaccounts[1]['id'];
|
||||
$result=$object->fetch($sendtosocid);
|
||||
}elseif($possibleuser){
|
||||
$sendtosocid=$possibleuser[0]['id'];
|
||||
|
||||
$result=$uobject->fetch($sendtosocid);
|
||||
$object=$uobject;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported');
|
||||
}
|
||||
else if ($object->element == 'societe')
|
||||
{
|
||||
$thirdparty=$object;
|
||||
if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
|
||||
elseif($conf->dolimail->enabled)
|
||||
{
|
||||
$dolimail = new Dolimail($db);
|
||||
$possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1");
|
||||
$possibleuser=$dolimail->get_from_user_by_mail($_POST['sendto'],"1"); // suche in llx_societe and socpeople
|
||||
if (!$possibleaccounts && !$possibleuser)
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorFailedToFindSocieteRecord',$_POST['sendto']), null, 'errors');
|
||||
}
|
||||
elseif (count($possibleaccounts)>1)
|
||||
{
|
||||
$sendtosocid=$possibleaccounts[1]['id'];
|
||||
$result=$object->fetch($sendtosocid);
|
||||
|
||||
setEventMessages($langs->trans('ErrorFoundMoreThanOneRecordWithEmail',$_POST['sendto'],$object->name), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
if($possibleaccounts){
|
||||
$sendtosocid=$possibleaccounts[1]['id'];
|
||||
$result=$object->fetch($sendtosocid);
|
||||
}elseif($possibleuser){
|
||||
$sendtosocid=$possibleuser[0]['id'];
|
||||
|
||||
$result=$uobject->fetch($sendtosocid);
|
||||
$object=$uobject;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported');
|
||||
else $thirdparty = $mysoc;
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@@ -247,35 +253,35 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$mailboxconfig = new IMAP($db);
|
||||
$mailboxconfig->fetch($mbid);
|
||||
if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
|
||||
|
||||
|
||||
$mailboxconfig->folder_id=$mailboxconfig->mailbox_imap_outbox;
|
||||
$mailboxconfig->userfolder_fetch();
|
||||
|
||||
|
||||
if ($mailboxconfig->mailbox_save_sent_mails == 1)
|
||||
{
|
||||
|
||||
|
||||
$folder=str_replace($ref, '', $mailboxconfig->folder_cache_key);
|
||||
if (!$folder) $folder = "Sent"; // Default Sent folder
|
||||
|
||||
|
||||
$mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password);
|
||||
if (FALSE === $mailboxconfig->mbox)
|
||||
if (FALSE === $mailboxconfig->mbox)
|
||||
{
|
||||
$info = FALSE;
|
||||
$err = $langs->trans('Error3_Imap_Connection_Error');
|
||||
setEventMessages($err,$mailboxconfig->element, null, 'errors');
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailboxconfig->mailboxid=$_POST['frommail'];
|
||||
$mailboxconfig->foldername=$folder;
|
||||
$from = $mailfromid[0] . $mailfromid[2];
|
||||
$imap=1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Send mail
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
|
||||
@@ -290,7 +296,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
if ($result)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
||||
// FIXME This must be moved into a trigger for action $trigger_name
|
||||
if (! empty($conf->dolimail->enabled))
|
||||
{
|
||||
@@ -301,13 +307,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$dolimail=new DoliMail($db);
|
||||
$dolimail->id = $mid;
|
||||
$res=$dolimail->set_prop($user, 'answered',1);
|
||||
}
|
||||
}
|
||||
if ($imap==1)
|
||||
{
|
||||
// write mail to IMAP Server
|
||||
$movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile);
|
||||
$movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile);
|
||||
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
|
||||
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +331,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
$error++; $errors=$interface->errors;
|
||||
}
|
||||
// End call of triggers
|
||||
|
||||
@@ -339,8 +345,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
// This avoid sending mail twice if going out and then back to page
|
||||
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
|
||||
setEventMessages($mesg, null, 'mesgs');
|
||||
if($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
|
||||
else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id);
|
||||
if ($conf->dolimail->enabled) header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id.'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
|
||||
else header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,16 +22,19 @@
|
||||
*/
|
||||
|
||||
|
||||
// This script is called with a POST method.
|
||||
// Directory to scan (full path) is inside POST['dir'].
|
||||
// This script is called with a POST method or as an include.
|
||||
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! isset($usedbyinclude) || empty($usedbyinclude))
|
||||
{
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
$res=@include '../../main.inc.php';
|
||||
}
|
||||
|
||||
$res=@include '../../main.inc.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
|
||||
//global $hookmanager;
|
||||
@@ -44,85 +47,85 @@ $arrayresult=array();
|
||||
// Define $searchform
|
||||
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
|
||||
{
|
||||
$arrayresult['searchintothirdparty']=array('text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintothirdparty']=array('img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire)
|
||||
{
|
||||
$arrayresult['searchintocontact']=array('text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintocontact']=array('img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
|
||||
&& empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED))
|
||||
{
|
||||
$arrayresult['searchintoproduct']=array('text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoproduct']=array('img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire)
|
||||
{
|
||||
$arrayresult['searchintoprojects']=array('text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoprojects']=array('img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire)
|
||||
{
|
||||
$arrayresult['searchintotasks']=array('text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintotasks']=array('img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php?search_all='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
|
||||
{
|
||||
$arrayresult['searchintomember']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintomember']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
|
||||
{
|
||||
$arrayresult['searchintouser']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintouser']=array('img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire)
|
||||
{
|
||||
$arrayresult['searchintopropal']=array('text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintopropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire)
|
||||
{
|
||||
$arrayresult['searchintoorder']=array('text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire)
|
||||
{
|
||||
$arrayresult['searchintoinvoice']=array('text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire)
|
||||
{
|
||||
$arrayresult['searchintoshipment']=array('text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoshipment']=array('img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire)
|
||||
{
|
||||
$arrayresult['searchintosupplierpropal']=array('text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintosupplierpropal']=array('img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
$arrayresult['searchintosupplierorder']=array('text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintosupplierorder']=array('img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$arrayresult['searchintosupplierinvoice']=array('text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintosupplierinvoice']=array('img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire)
|
||||
{
|
||||
$arrayresult['searchintocontract']=array('text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintocontract']=array('img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire)
|
||||
{
|
||||
$arrayresult['searchintointervention']=array('text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintointervention']=array('img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
// HR
|
||||
if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
|
||||
{
|
||||
$arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoexpensereport']=array('img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read)
|
||||
{
|
||||
$arrayresult['searchintoleaves']=array('text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
|
||||
$arrayresult['searchintoleaves']=array('img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +147,10 @@ if (empty($reshook))
|
||||
else $arrayresult=$hookmanager->resArray;
|
||||
|
||||
|
||||
print json_encode($arrayresult);
|
||||
// Print output if called by ajax or do nothing (var $arrayresult will be used) if called by an include
|
||||
if (! isset($usedbyinclude) || empty($usedbyinclude))
|
||||
{
|
||||
print json_encode($arrayresult);
|
||||
if (is_object($db)) $db->close();
|
||||
}
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@@ -71,7 +72,8 @@ class box_contracts extends ModeleBoxes
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
$sql.= " ORDER BY c.date_contrat DESC, c.ref DESC ";
|
||||
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_contrat DESC, c.ref DESC ";
|
||||
else $sql.= " ORDER BY c.tms DESC, c.ref DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@@ -68,6 +68,7 @@ class box_services_expired extends ModeleBoxes
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$db->idate($now)."'";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
|
||||
if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
@@ -35,8 +35,8 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
var $error='';
|
||||
protected $db;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -209,7 +209,7 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key],0,$outputlangs,0,0,-1,$conf->currency);
|
||||
}
|
||||
else if($extrafields->attribute_type[$key] == 'select')
|
||||
else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
|
||||
{
|
||||
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
|
||||
}
|
||||
@@ -280,7 +280,7 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
$object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
|
||||
}
|
||||
elseif($extrafields->attribute_type[$key] == 'select')
|
||||
elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
|
||||
{
|
||||
$object->array_options['options_' . $key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_' . $key]];
|
||||
}
|
||||
@@ -389,7 +389,7 @@ abstract class CommonDocGenerator
|
||||
// Add vat by rates
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
|
||||
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
|
||||
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
|
||||
@@ -576,12 +576,12 @@ abstract class CommonDocGenerator
|
||||
//Add value to store price with currency
|
||||
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
|
||||
}
|
||||
else if($extrafields->attribute_type[$key] == 'select')
|
||||
else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
|
||||
{
|
||||
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
|
||||
}
|
||||
else if($extrafields->attribute_type[$key] == 'date')
|
||||
{
|
||||
{
|
||||
if (strlen($object->array_options['options_'.$key])>0)
|
||||
{
|
||||
$object->array_options['options_'.$key] = dol_print_date($object->array_options['options_'.$key],'day'); // using company output language
|
||||
|
||||
@@ -4173,7 +4173,9 @@ abstract class CommonObject
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
if ($value)
|
||||
{
|
||||
$res=$object->fetch(0,$value);
|
||||
if (is_numeric($value)) $res=$object->fetch($value);
|
||||
else $res=$object->fetch('',$value);
|
||||
|
||||
if ($res > 0) $this->array_options[$key]=$object->id;
|
||||
else
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ class GoogleAPI
|
||||
$i=0;
|
||||
|
||||
// Desired address
|
||||
$urladdress = "http://maps.google.com/maps/geo?q=".urlencode($address)."&output=xml&key=".$this->key;
|
||||
$urladdress = "https://maps.google.com/maps/geo?q=".urlencode($address)."&output=xml&key=".$this->key;
|
||||
|
||||
// Retrieve the URL contents
|
||||
$page = file_get_contents($urladdress);
|
||||
|
||||
@@ -1125,7 +1125,7 @@ class Form
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
print '<select class="flat maxwidthonsmartphone" name="'.$htmlname.'">';
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$qualifiedlines=$num;
|
||||
@@ -2060,9 +2060,10 @@ class Form
|
||||
* @param string $filtre For a SQL filter
|
||||
* @param array $ajaxoptions Options for ajax_autocompleter
|
||||
* @param int $hidelabel Hide label (0=no, 1=yes)
|
||||
* @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices
|
||||
* @return void
|
||||
*/
|
||||
function select_produits_fournisseurs($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $ajaxoptions=array(), $hidelabel=0)
|
||||
function select_produits_fournisseurs($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $ajaxoptions=array(), $hidelabel=0, $alsoproductwithnosupplierprice=0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $price_level, $status, $finished;
|
||||
@@ -2084,7 +2085,7 @@ class Form
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
}
|
||||
// mode=2 means suppliers products
|
||||
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished;
|
||||
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
|
||||
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'">';
|
||||
}
|
||||
@@ -2095,7 +2096,7 @@ class Form
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
print '<script type="text/javascript">$("#'.$htmlname.'").change(function() { $("#idprod").val($(this).val());});</script>';
|
||||
}
|
||||
print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0);
|
||||
print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0,0,$alsoproductwithnosupplierprice);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2111,9 +2112,10 @@ class Form
|
||||
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell (not used here, a filter on tobuy is already hard coded in request)
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param int $limit Limit of line number
|
||||
* @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices
|
||||
* @return array Array of keys for json
|
||||
*/
|
||||
function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100)
|
||||
function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100,$alsoproductwithnosupplierprice=0)
|
||||
{
|
||||
global $langs,$conf,$db;
|
||||
|
||||
@@ -2167,7 +2169,7 @@ class Form
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax
|
||||
$out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
$out.='<select class="flat maxwidthonsmartphone" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
if (! $selected) $out.='<option value="0" selected> </option>';
|
||||
else $out.='<option value="0"> </option>';
|
||||
|
||||
@@ -2176,7 +2178,9 @@ class Form
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$outkey=$objp->idprodfournprice;
|
||||
$outkey=$objp->idprodfournprice; // id in table of price
|
||||
if (! $outkey && $alsoproductwithnosupplierprice) $outkey='idprod_'.$objp->rowid; // id of product
|
||||
|
||||
$outref=$objp->ref;
|
||||
$outval='';
|
||||
$outqty=1;
|
||||
@@ -2185,9 +2189,9 @@ class Form
|
||||
$outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration,0,dol_strlen($objp->duration)-1):'';
|
||||
$outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration,-1):'';
|
||||
|
||||
$opt = '<option value="'.$objp->idprodfournprice.'"';
|
||||
$opt = '<option value="'.$outkey.'"';
|
||||
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected';
|
||||
if (empty($objp->idprodfournprice)) $opt.=' disabled';
|
||||
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt.=' disabled';
|
||||
$opt.= '>';
|
||||
|
||||
$objRef = $objp->ref;
|
||||
@@ -2266,18 +2270,25 @@ class Form
|
||||
}
|
||||
if ($objp->supplier_reputation)
|
||||
{
|
||||
//TODO dictionnary
|
||||
$reputations=array(''=>$langs->trans('Standard'),'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
|
||||
//TODO dictionnary
|
||||
$reputations=array(''=>$langs->trans('Standard'),'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
|
||||
|
||||
$opt .= " - ".$reputations[$objp->supplier_reputation];
|
||||
$outval.=" - ".$reputations[$objp->supplier_reputation];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$opt.= $langs->trans("NoPriceDefinedForThisSupplier");
|
||||
$outval.=$langs->transnoentities("NoPriceDefinedForThisSupplier");
|
||||
if (empty($alsoproductwithnosupplierprice)) // No supplier price defined for couple product/supplier
|
||||
{
|
||||
$opt.= $langs->trans("NoPriceDefinedForThisSupplier");
|
||||
$outval.=$langs->transnoentities("NoPriceDefinedForThisSupplier");
|
||||
}
|
||||
else // No supplier price defined for product, even on other suppliers
|
||||
{
|
||||
$opt.= $langs->trans("NoPriceDefinedForThisSupplier");
|
||||
$outval.=$langs->transnoentities("NoPriceDefinedForThisSupplier");
|
||||
}
|
||||
}
|
||||
$opt .= "</option>\n";
|
||||
|
||||
@@ -3252,7 +3263,7 @@ class Form
|
||||
* @param int $width Force width of bow
|
||||
* @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form
|
||||
*/
|
||||
function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500)
|
||||
function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=200, $width=500)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $useglobalvars;
|
||||
|
||||
@@ -269,6 +269,7 @@ class FormMail extends Form
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
|
||||
|
||||
if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]);
|
||||
|
||||
@@ -168,7 +168,7 @@ class Utils
|
||||
|
||||
// Check type parameter
|
||||
if ($type == 'auto') $type = $db->type;
|
||||
if (! in_array($type, array('pgsql', 'mysql', 'mysqli')))
|
||||
if (! in_array($type, array('pgsql', 'mysql', 'mysqli','mysqlnobin')))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->transnoentitiesnoconv("ErrorBadValueForParameter", $type, "Basetype");
|
||||
|
||||
@@ -85,7 +85,7 @@ if (! class_exists('MenuManager'))
|
||||
}
|
||||
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
|
||||
$menumanager->loadMenu('all','all');
|
||||
|
||||
//var_dump($menumanager->tabMenu);exit;
|
||||
$menumanager->showmenu('jmobile');
|
||||
|
||||
print '</body>';
|
||||
|
||||
@@ -100,10 +100,12 @@ function dol_print_cron_urls()
|
||||
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
print '<br>';
|
||||
|
||||
|
||||
$logintouse = 'firstadmin';
|
||||
if ($user->admin) $logintouse = $user->login;
|
||||
|
||||
print '<u>'.$langs->trans("FileToLaunchCronJobs").':</u><br>';
|
||||
|
||||
$file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$user->login.' [cronjobid]';
|
||||
$file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]';
|
||||
print '<textarea rows="'.ROWS_2.'" cols="120">..'.$file."</textarea><br>\n";
|
||||
print '<br>';
|
||||
|
||||
@@ -116,7 +118,7 @@ function dol_print_cron_urls()
|
||||
{
|
||||
print $langs->trans("CronExplainHowToRunUnix");
|
||||
print '<br>';
|
||||
print '<textarea rows="'.ROWS_1.'" style="width:80%">*/5 * * * * pathtoscript/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$user->login.' > '.DOL_DATA_ROOT.'/cron_run_jobs.php.log</textarea><br>';
|
||||
print '<textarea rows="'.ROWS_1.'" style="width:80%">*/5 * * * * pathtoscript/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$logintouse.' > '.DOL_DATA_ROOT.'/cron_run_jobs.php.log</textarea><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -443,10 +443,10 @@ function dol_size($size,$type='')
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @param string $newstr String to replace bad chars with
|
||||
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
|
||||
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
|
||||
* @return string String cleaned (a-zA-Z_)
|
||||
*
|
||||
* @see dol_string_nospecial, dol_string_unaccent
|
||||
* @see dol_string_nospecial, dol_string_unaccent, dol_sanitizePathName
|
||||
*/
|
||||
function dol_sanitizeFileName($str,$newstr='_',$unaccent=1)
|
||||
{
|
||||
@@ -454,6 +454,22 @@ function dol_sanitizeFileName($str,$newstr='_',$unaccent=1)
|
||||
return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean a string to use it as a path name
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @param string $newstr String to replace bad chars with
|
||||
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
|
||||
* @return string String cleaned (a-zA-Z_)
|
||||
*
|
||||
* @see dol_string_nospecial, dol_string_unaccent, dol_sanitizeFileName
|
||||
*/
|
||||
function dol_sanitizePathName($str,$newstr='_',$unaccent=1)
|
||||
{
|
||||
$filesystem_forbidden_chars = array('<','>','?','*','|','"','°');
|
||||
return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean a string from all accent characters to be used as ref, login or by dol_sanitizeFileName
|
||||
*
|
||||
@@ -1097,7 +1113,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false)
|
||||
* "%d %b %Y",
|
||||
* "%d/%m/%Y %H:%M",
|
||||
* "%d/%m/%Y %H:%M:%S",
|
||||
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc"
|
||||
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat"
|
||||
* @param string $tzoutput true or 'gmt' => string is for Greenwich location
|
||||
* false or 'tzserver' => output string is for local PHP server TZ usage
|
||||
* 'tzuser' => output string is for user TZ (current browser TZ with current dst)
|
||||
@@ -5395,7 +5411,7 @@ function printCommonFooter($zone='private')
|
||||
print 'window.console && console.log("';
|
||||
if (! empty($conf->global->MEMCACHED_SERVER)) print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - ';
|
||||
print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off');
|
||||
if ($micro_start_time)
|
||||
if (! empty($micro_start_time)) // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in global variable.
|
||||
{
|
||||
$micro_end_time = microtime(true);
|
||||
print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';
|
||||
|
||||
@@ -106,6 +106,7 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
|
||||
sleep(1);
|
||||
$langs->load('main');
|
||||
$langs->load('other');
|
||||
$langs->load('errors');
|
||||
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla
|
||||
|
||||
if ($showmode == 1)
|
||||
{
|
||||
print '<a class="tmenuimage" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
|
||||
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
|
||||
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||
print '</a>';
|
||||
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
|
||||
|
||||
@@ -177,7 +177,11 @@ class MenuManager
|
||||
// We add sub entry
|
||||
print str_pad('',1).'<li data-role="list-dividerxxx" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print '<a href="'.$relurl.'">';
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") print $langs->trans("Access"); // No translation
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
|
||||
{
|
||||
if ($val['mainmenu'] == 'cashdesk') print $langs->trans("Access");
|
||||
else print $langs->trans("Dashboard");
|
||||
}
|
||||
else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||
print '</a>';
|
||||
print '</li>'."\n";
|
||||
|
||||
@@ -383,7 +383,7 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname,
|
||||
|
||||
if ($showmode == 1)
|
||||
{
|
||||
print '<a class="tmenuimage" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
|
||||
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
|
||||
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||
print '</a>';
|
||||
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
|
||||
@@ -434,7 +434,8 @@ function print_end_menu_array()
|
||||
|
||||
/**
|
||||
* Core function to output left menu eldy
|
||||
*
|
||||
* Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home)
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add)
|
||||
* @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
|
||||
@@ -442,7 +443,7 @@ function print_end_menu_array()
|
||||
* @param Menu $menu Object Menu to return back list of menu entries
|
||||
* @param int $noout Disable output (Initialise &$menu only).
|
||||
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
|
||||
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all)
|
||||
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not efined in session.
|
||||
* @param array $moredata An array with more data to output
|
||||
* @return int nb of menu entries
|
||||
*/
|
||||
@@ -586,7 +587,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users');
|
||||
if ($user->rights->user->user->lire)
|
||||
{
|
||||
if (! empty($leftmenu) && $leftmenu=="users")
|
||||
if (empty($leftmenu) || $leftmenu=="users")
|
||||
{
|
||||
$newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin, '', 'home');
|
||||
@@ -597,6 +598,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/user/group/index.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -838,7 +840,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
$langs->load("orders");
|
||||
if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-3", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
|
||||
if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-3&billed=0", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
|
||||
// if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
|
||||
}
|
||||
|
||||
@@ -941,14 +943,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
|
||||
// Dispatch
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_customer');
|
||||
if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?leftmenu=accountancy_dispatch_customer",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
|
||||
if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/lines.php?leftmenu=accountancy_dispatch_customer",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
|
||||
if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
|
||||
if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
|
||||
|
||||
if (! empty($conf->supplier_invoice->enabled))
|
||||
{
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy",$langs->trans("SuppliersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_supplier');
|
||||
if (preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/list.php?leftmenu=accountancy_dispatch_supplier",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
|
||||
if (preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/lines.php?leftmenu=accountancy_dispatch_supplier",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
|
||||
if (preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
|
||||
if (preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
|
||||
}
|
||||
|
||||
// Journals
|
||||
@@ -972,7 +974,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
while ($i < $numr)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/bankjournal.php?left_menu=accountancy_journal&id_account='.$objp->rowid,$langs->trans("Journal").' - '.dol_trunc($objp->label,10),2,$user->rights->accounting->comptarapport->lire);
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_account='.$objp->rowid,$langs->trans("Journal").' - '.dol_trunc($objp->label,10),2,$user->rights->accounting->comptarapport->lire);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@@ -980,15 +982,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$db->free($resql);
|
||||
|
||||
// Add other journal
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=accountancy_journal",$langs->trans("SellsJournal"),2,$user->rights->accounting->comptarapport->lire);
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=accountancy_journal",$langs->trans("PurchasesJournal"),2,$user->rights->accounting->comptarapport->lire);
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal",$langs->trans("SellsJournal"),2,$user->rights->accounting->comptarapport->lire);
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal",$langs->trans("PurchasesJournal"),2,$user->rights->accounting->comptarapport->lire);
|
||||
}
|
||||
|
||||
// General Ledger
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/list.php",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire);
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire);
|
||||
|
||||
// Balance
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balance.php",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire);
|
||||
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire);
|
||||
|
||||
// Reports
|
||||
$langs->load("compta");
|
||||
|
||||
@@ -105,6 +105,8 @@ class MenuManager
|
||||
$menuArbo = new Menubase($this->db,'eldy');
|
||||
$menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu);
|
||||
$this->tabMenu=$tabMenu;
|
||||
|
||||
//if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; }
|
||||
}
|
||||
|
||||
|
||||
@@ -150,8 +152,9 @@ class MenuManager
|
||||
|
||||
if ($mode == 'jmobile')
|
||||
{
|
||||
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode);
|
||||
|
||||
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); // Fill this->menu that is empty with top menu
|
||||
|
||||
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
|
||||
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
{
|
||||
@@ -169,8 +172,9 @@ class MenuManager
|
||||
$tmpmainmenu=$val['mainmenu'];
|
||||
$tmpleftmenu='all';
|
||||
$submenu=new Menu();
|
||||
print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
|
||||
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
|
||||
print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
|
||||
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu);exit; }
|
||||
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
|
||||
|
||||
$canonrelurl=preg_replace('/\?.*$/','',$relurl);
|
||||
$canonnexturl=preg_replace('/\?.*$/','',$nexturl);
|
||||
@@ -185,11 +189,16 @@ class MenuManager
|
||||
print '<a href="'.$relurl.'"';
|
||||
//print ' data-ajax="false"';
|
||||
print '>';
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") print $langs->trans("Access"); // No translation
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
|
||||
{
|
||||
if ($val['mainmenu'] == 'cashdesk') print $langs->trans("Access");
|
||||
else print $langs->trans("Dashboard");
|
||||
}
|
||||
else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||
print '</a>';
|
||||
print '</li>'."\n";
|
||||
}
|
||||
|
||||
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu']
|
||||
{
|
||||
$showmenu=true;
|
||||
|
||||
@@ -348,7 +348,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
|
||||
|
||||
if ($showmode == 1)
|
||||
{
|
||||
print '<a class="tmenuimage" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
|
||||
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
|
||||
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||
print '</a>';
|
||||
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
|
||||
|
||||
@@ -841,14 +841,12 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$Yoff=25;
|
||||
|
||||
// Add list of linked orders
|
||||
// TODO possibility to use with other document (business module,...)
|
||||
//$object->load_object_linked();
|
||||
|
||||
$origin = $object->origin;
|
||||
$origin_id = $object->origin_id;
|
||||
|
||||
// TODO move to external function
|
||||
if (! empty($conf->$origin->enabled))
|
||||
if (! empty($conf->$origin->enabled)) // commonly $origin='commande'
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
|
||||
@@ -857,6 +855,8 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$result=$linkedobject->fetch($origin_id);
|
||||
if ($result >= 0)
|
||||
{
|
||||
//$linkedobject->fetchObjectLinked() Get all linked object to the $linkedobject (commonly order) into $linkedobject->linkedObjects
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$text=$linkedobject->ref;
|
||||
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@@ -303,6 +303,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category',1).')';
|
||||
$this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories
|
||||
|
||||
|
||||
@@ -1473,7 +1473,8 @@ class pdf_azur extends ModelePDFPropales
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname=($outputlangs->transnoentities("FromContactName")!='FromContactName'?$outputlangs->transnoentities("FromContactName"):$outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
@@ -1293,7 +1293,8 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname=($outputlangs->transnoentities("FromContactName")!='FromContactName'?$outputlangs->transnoentities("FromContactName"):$outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
@@ -67,51 +67,35 @@ $hookmanager->initHooks(array('searchform'));
|
||||
// Define $searchform
|
||||
$searchform = '';
|
||||
|
||||
// TODO Mutualize code here with function left_menu into main.inc.php page
|
||||
if ($conf->use_javascript_ajax && 1 == 2)
|
||||
if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile
|
||||
{
|
||||
if (! is_object($form)) $form=new Form($db);
|
||||
$selected=-1;
|
||||
$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, 'data-role="none"', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"), 0);
|
||||
$searchform.='<br><br>'.$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, 'data-role="none"', '', 0, 1, 'minwidth300', 1, $langs->trans("Search"), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Define $searchform
|
||||
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && $user->rights->societe->lire)
|
||||
$conf->global->MAIN_HTML5_PLACEHOLDER = 1;
|
||||
|
||||
|
||||
$usedbyinclude = 1; // Used into next include
|
||||
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
|
||||
|
||||
$accesskeyalreadyassigned=array();
|
||||
foreach($arrayresult as $key => $val)
|
||||
{
|
||||
$langs->load("companies");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company'));
|
||||
}
|
||||
|
||||
if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("companies");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact'));
|
||||
}
|
||||
|
||||
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
|
||||
)
|
||||
{
|
||||
$langs->load("products");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', $langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp', img_object('','product'));
|
||||
}
|
||||
|
||||
if (! empty($conf->projet->enabled) && $user->rights->projet->lire)
|
||||
{
|
||||
$langs->load("projects");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub'));
|
||||
}
|
||||
|
||||
if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire)
|
||||
{
|
||||
$langs->load("members");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', $langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm', img_object('','user'));
|
||||
}
|
||||
|
||||
if (! empty($conf->user->enabled) && $user->rights->user->user->lire)
|
||||
{
|
||||
$langs->load("users");
|
||||
$searchform.=printSearchForm(DOL_URL_ROOT.'/user/index.php', DOL_URL_ROOT.'/user/index.php', $langs->trans("Users"), 'user', 'sall', 'M', 'searchleftuser', img_object('','user'));
|
||||
$tmp=explode('?', $val['url']);
|
||||
$urlaction=$tmp[0];
|
||||
$keysearch=$tmp[1];
|
||||
$keysearch=preg_replace('/mainmenu=(.*)&/','',$keysearch);
|
||||
$keysearch=preg_replace('/=/','',$keysearch);
|
||||
$accesskey='';
|
||||
if (! $accesskeyalreadyassigned[$val['label'][0]])
|
||||
{
|
||||
$accesskey=$val['label'][0];
|
||||
$accesskeyalreadyassigned[$accesskey]=$accesskey;
|
||||
}
|
||||
$searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('',$val['img'],'', 0, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
|
||||
$usemargins=1;
|
||||
}
|
||||
|
||||
global $forceall, $senderissupplier, $inputalsopricewithtax;
|
||||
global $dateSelector, $forceall, $senderissupplier, $inputalsopricewithtax;
|
||||
if (empty($dateSelector)) $dateSelector=0;
|
||||
if (empty($forceall)) $forceall=0;
|
||||
if (empty($senderissupplier)) $senderissupplier=0;
|
||||
@@ -52,7 +52,7 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
|
||||
<?php $nolinesbefore=(count($this->lines) == 0); ?>
|
||||
<tr class="liste_titre<?php echo ($nolinesbefore?'':' liste_titre_add') ?> nodrag nodrop">
|
||||
<tr class="liste_titre<?php echo (($nolinesbefore || $object->element=='contrat')?'':' liste_titre_add') ?> nodrag nodrop">
|
||||
<td class="linecoldescription" <?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
||||
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
|
||||
</td>
|
||||
@@ -182,12 +182,21 @@ else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$ajaxoptions=array(
|
||||
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
|
||||
'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error'
|
||||
);
|
||||
$form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1);
|
||||
if ($senderissupplier != 2)
|
||||
{
|
||||
$ajaxoptions=array(
|
||||
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
|
||||
'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error'
|
||||
);
|
||||
$alsoproductwithnosupplierprice=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ajaxoptions = array();
|
||||
$alsoproductwithnosupplierprice=1;
|
||||
}
|
||||
$form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice);
|
||||
}
|
||||
echo '</span>';
|
||||
}
|
||||
@@ -225,7 +234,7 @@ else {
|
||||
</td>
|
||||
|
||||
<?php if ($object->element == 'supplier_proposal') { ?>
|
||||
<td class="nobottom linecolresupplier" align="right"><input id="fourn_ref" name="fourn_ref" class="flat" value="" size="12"></td>
|
||||
<td class="nobottom linecolresupplier" align="right"><input id="fourn_ref" name="fourn_ref" class="flat" size="10" value=""></td>
|
||||
<?php } ?>
|
||||
|
||||
<td class="nobottom linecolvat" align="right"><?php
|
||||
|
||||
@@ -99,7 +99,7 @@ $coldisplay=-1; // We remove first td
|
||||
$doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%');
|
||||
$doleditor->Create();
|
||||
} else {
|
||||
print '<textarea id="desc" class="flat" name="desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>';
|
||||
print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
@@ -257,8 +257,14 @@ $coldisplay=-1; // We remove first td
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
jQuery("#price_ht").keyup(function() { jQuery("#price_ttc").val(''); });
|
||||
jQuery("#price_ttc").keyup(function() { jQuery("#price_ht").val(''); });
|
||||
jQuery("#price_ht").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') jQuery("#price_ttc").val('');
|
||||
});
|
||||
jQuery("#price_ttc").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') jQuery("#price_ht").val('');
|
||||
});
|
||||
|
||||
<?php
|
||||
if (! empty($conf->margin->enabled))
|
||||
|
||||
@@ -43,6 +43,7 @@ $action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$cancel=GETPOST('cancel');
|
||||
$backtourl=GETPOST('backtourl','alpha');
|
||||
$securitykey = GETPOST('securitykey','alpha');
|
||||
|
||||
|
||||
/*
|
||||
@@ -100,30 +101,38 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->del
|
||||
// Execute jobs
|
||||
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute)
|
||||
{
|
||||
$now = dol_now(); // Date we start
|
||||
if (! empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey)
|
||||
{
|
||||
setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$now = dol_now(); // Date we start
|
||||
|
||||
$result=$object->run_jobs($user->login);
|
||||
|
||||
$result=$object->run_jobs($user->login);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$res = $object->reprogram_jobs($user->login, $now);
|
||||
if ($res > 0)
|
||||
{
|
||||
if ($object->lastresult > 0) setEventMessages($langs->trans("JobFinished"), null, 'warnings');
|
||||
else setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$res = $object->reprogram_jobs($user->login, $now);
|
||||
if ($res > 0)
|
||||
{
|
||||
if ($object->lastresult > 0) setEventMessages($langs->trans("JobFinished"), null, 'warnings');
|
||||
else setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +293,7 @@ if ($action == 'delete')
|
||||
}
|
||||
|
||||
if ($action == 'execute'){
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id.'&securitykey='.$securitykey,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1);
|
||||
|
||||
$action='';
|
||||
}
|
||||
@@ -316,7 +325,7 @@ if (($action=="create") || ($action=="edit"))
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="30%">';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">';
|
||||
print $langs->trans('CronLabel')."</td>";
|
||||
print "<td><input type=\"text\" size=\"20\" name=\"label\" value=\"".$object->label."\" /> ";
|
||||
print "</td>";
|
||||
@@ -324,7 +333,7 @@ if (($action=="create") || ($action=="edit"))
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr><td>";
|
||||
print '<tr><td class="fieldrequired">';
|
||||
print $langs->trans('CronType')."</td><td>";
|
||||
print $formCron->select_typejob('jobtype',$object->jobtype);
|
||||
print "</td>";
|
||||
@@ -395,7 +404,7 @@ if (($action=="create") || ($action=="edit"))
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr><td>";
|
||||
print '<tr><td class="fieldrequired">';
|
||||
print $langs->trans('CronEvery')."</td>";
|
||||
print "<td>";
|
||||
print "<select name=\"nbfrequency\">";
|
||||
@@ -496,7 +505,7 @@ if (($action=="create") || ($action=="edit"))
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr><td width="30%">';
|
||||
print '<tr><td>';
|
||||
$maxrun='';
|
||||
if (!empty($object->maxrun)) {
|
||||
$maxrun=$object->maxrun;
|
||||
@@ -552,7 +561,7 @@ else
|
||||
// box add_jobs_box
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="30%">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('CronId')."</td>";
|
||||
print "<td>".$form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'id', '', '', 0);
|
||||
print "</td></tr>\n";
|
||||
@@ -614,7 +623,7 @@ else
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr><td>";
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('CronEvery')."</td>";
|
||||
print "<td>";
|
||||
if($object->unitfrequency == "60") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Minutes');
|
||||
@@ -623,7 +632,7 @@ else
|
||||
if($object->unitfrequency == "604800") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Weeks');
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td width="30%">';
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CronDtStart')."</td><td>";
|
||||
if(!empty($object->datestart)) {print dol_print_date($object->datestart,'dayhoursec');}
|
||||
print "</td></tr>";
|
||||
@@ -640,7 +649,8 @@ else
|
||||
|
||||
print "<tr><td>";
|
||||
print $langs->trans('CronMaxRun')."</td>";
|
||||
print "<td>".$object->maxrun;
|
||||
print "<td>";
|
||||
print $object->maxrun>0?$object->maxrun:'';
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>";
|
||||
@@ -666,7 +676,7 @@ else
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="30%">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('CronDtLastLaunch')."</td><td>";
|
||||
if(!empty($object->datelastrun)) {print dol_print_date($object->datelastrun,'dayhoursec');} else {print $langs->trans('CronNone');}
|
||||
print "</td></tr>";
|
||||
@@ -707,7 +717,7 @@ else
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("JobDisabled")).'">'.$langs->trans("CronExecute").'</a>';
|
||||
}
|
||||
else {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=execute&id='.$object->id.'">'.$langs->trans("CronExecute").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=execute&id='.$object->id.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).'">'.$langs->trans("CronExecute").'</a>';
|
||||
}
|
||||
|
||||
if (! $user->rights->cron->create) {
|
||||
|
||||
@@ -191,7 +191,7 @@ class Cronjob extends CommonObject
|
||||
$sql.= " ".(! isset($this->params)?'NULL':"'".$this->db->escape($this->params)."'").",";
|
||||
$sql.= " ".(! isset($this->md5params)?'NULL':"'".$this->db->escape($this->md5params)."'").",";
|
||||
$sql.= " ".(! isset($this->module_name)?'NULL':"'".$this->db->escape($this->module_name)."'").",";
|
||||
$sql.= " ".(! isset($this->priority)?'NULL':"'".$this->priority."'").",";
|
||||
$sql.= " ".(! isset($this->priority)?'0':$this->priority).",";
|
||||
$sql.= " ".(! isset($this->datelastrun) || dol_strlen($this->datelastrun)==0?'NULL':$this->db->idate($this->datelastrun)).",";
|
||||
$sql.= " ".(! isset($this->datenextrun) || dol_strlen($this->datenextrun)==0?'NULL':$this->db->idate($this->datenextrun)).",";
|
||||
$sql.= " ".(! isset($this->dateend) || dol_strlen($this->dateend)==0?'NULL':$this->db->idate($this->dateend)).",";
|
||||
@@ -200,13 +200,13 @@ class Cronjob extends CommonObject
|
||||
$sql.= " ".(! isset($this->datelastresult) || dol_strlen($this->datelastresult)==0?'NULL':$this->db->idate($this->datelastresult)).",";
|
||||
$sql.= " ".(! isset($this->lastoutput)?'NULL':"'".$this->db->escape($this->lastoutput)."'").",";
|
||||
$sql.= " ".(! isset($this->unitfrequency)?'NULL':"'".$this->unitfrequency."'").",";
|
||||
$sql.= " ".(! isset($this->frequency)?'NULL':"'".$this->frequency."'").",";
|
||||
$sql.= " ".(! isset($this->status)?'0':"'".$this->status."'").",";
|
||||
$sql.= " ".(! isset($this->frequency)?'0':$this->frequency).",";
|
||||
$sql.= " ".(! isset($this->status)?'0':$this->status).",";
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " ".(! isset($this->note)?'NULL':"'".$this->db->escape($this->note)."'").",";
|
||||
$sql.= " ".(! isset($this->nbrun)?'0':"'".$this->db->escape($this->nbrun)."'").",";
|
||||
$sql.= " ".(empty($this->maxrun)?'null':"'".$this->db->escape($this->maxrun)."'").",";
|
||||
$sql.= " ".(! isset($this->nbrun)?'0':$this->db->escape($this->nbrun)).",";
|
||||
$sql.= " ".(empty($this->maxrun)?'0':$this->db->escape($this->maxrun)).",";
|
||||
$sql.= " ".(! isset($this->libname)?'NULL':"'".$this->db->escape($this->libname)."'").",";
|
||||
$sql.= " ".(! isset($this->test)?'NULL':"'".$this->db->escape($this->test)."'")."";
|
||||
$sql.= ")";
|
||||
@@ -363,8 +363,12 @@ class Cronjob extends CommonObject
|
||||
function fetch_all($sortorder='DESC', $sortfield='t.rowid', $limit=0, $offset=0, $status=1, $filter='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$this->lines=array();
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.jobtype,";
|
||||
@@ -399,8 +403,10 @@ class Cronjob extends CommonObject
|
||||
if ($status == 2) $sql.= " AND t.status = 2";
|
||||
//Manage filter
|
||||
if (is_array($filter) && count($filter)>0) {
|
||||
foreach($filter as $key => $value) {
|
||||
$sql.= ' AND '.$key.' LIKE \'%'.$value.'%\'';
|
||||
foreach($filter as $key => $value)
|
||||
{
|
||||
if ($key == 't.rowid') $sql.= ' AND '.$key.' = '.$this->db->escape($value);
|
||||
else $sql.= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,8 +433,6 @@ class Cronjob extends CommonObject
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
@@ -439,6 +443,7 @@ class Cronjob extends CommonObject
|
||||
$line->id = $obj->rowid;
|
||||
$line->ref = $obj->rowid;
|
||||
|
||||
$line->entity = $obj->entity;
|
||||
$line->tms = $this->db->jdate($obj->tms);
|
||||
$line->datec = $this->db->jdate($obj->datec);
|
||||
$line->label = $obj->label;
|
||||
@@ -518,7 +523,7 @@ class Cronjob extends CommonObject
|
||||
if (isset($this->status)) $this->status=trim($this->status);
|
||||
if (isset($this->note)) $this->note=trim($this->note);
|
||||
if (isset($this->nbrun)) $this->nbrun=trim($this->nbrun);
|
||||
if (isset($this->maxrun)) $this->maxrun=trim($this->maxrun);
|
||||
if (empty($this->maxrun)) $this->maxrun=0;
|
||||
if (isset($this->libname)) $this->libname = trim($this->libname);
|
||||
if (isset($this->test)) $this->test = trim($this->test);
|
||||
|
||||
@@ -589,7 +594,7 @@ class Cronjob extends CommonObject
|
||||
$sql.= " fk_user_mod=".$user->id.",";
|
||||
$sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").",";
|
||||
$sql.= " nbrun=".((isset($this->nbrun) && $this->nbrun >0)?$this->nbrun:"null").",";
|
||||
$sql.= " maxrun=".((isset($this->maxrun) && $this->maxrun > 0)?$this->maxrun:"null").",";
|
||||
$sql.= " maxrun=".((isset($this->maxrun) && $this->maxrun > 0)?$this->maxrun:"0").",";
|
||||
$sql.= " libname=".(isset($this->libname)?"'".$this->db->escape($this->libname)."'":"null").",";
|
||||
$sql.= " test=".(isset($this->test)?"'".$this->db->escape($this->test)."'":"null");
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
@@ -893,6 +898,7 @@ class Cronjob extends CommonObject
|
||||
|
||||
// Update last run date start (to track running jobs)
|
||||
$this->datelastrun=$now;
|
||||
$this->datelastresult=null;
|
||||
$this->lastoutput='';
|
||||
$this->lastresult='';
|
||||
$this->nbrun=$this->nbrun + 1;
|
||||
@@ -1093,6 +1099,8 @@ class Cronjob extends CommonObject
|
||||
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs now we update job to track it is finished (with success or error)");
|
||||
|
||||
$this->datelastresult=dol_now();
|
||||
$result = $this->update($user); // This include begin/commit
|
||||
if ($result < 0)
|
||||
|
||||
@@ -57,6 +57,7 @@ if ($status == '') $status=-2;
|
||||
|
||||
//Search criteria
|
||||
$search_label=GETPOST("search_label",'alpha');
|
||||
$securitykey = GETPOST('securitykey','alpha');
|
||||
|
||||
if (empty($sortorder)) $sortorder="DESC";
|
||||
if (empty($sortfield)) $sortfield="t.status";
|
||||
@@ -99,35 +100,43 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->del
|
||||
// Execute jobs
|
||||
if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute)
|
||||
{
|
||||
$object = new Cronjob($db);
|
||||
$job = $object->fetch($id);
|
||||
|
||||
$now = dol_now(); // Date we start
|
||||
|
||||
$resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK
|
||||
if ($resrunjob < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Programm next run
|
||||
$res = $object->reprogram_jobs($user->login, $now);
|
||||
if ($res > 0)
|
||||
{
|
||||
if ($resrunjob >= 0) // We add result of reprogram ony if no error message already reported
|
||||
{
|
||||
if ($object->lastresult >= 0) setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("JobFinished"), null, 'errors');
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/cron/list.php?status=-2'); // Make a call to avoid to run twice job when using back
|
||||
exit;
|
||||
if (! empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey)
|
||||
{
|
||||
setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$object = new Cronjob($db);
|
||||
$job = $object->fetch($id);
|
||||
|
||||
$now = dol_now(); // Date we start
|
||||
|
||||
$resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK
|
||||
if ($resrunjob < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Programm next run
|
||||
$res = $object->reprogram_jobs($user->login, $now);
|
||||
if ($res > 0)
|
||||
{
|
||||
if ($resrunjob >= 0) // We add result of reprogram ony if no error message already reported
|
||||
{
|
||||
if ($object->lastresult >= 0) setEventMessages($langs->trans("JobFinished"), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("JobFinished"), null, 'errors');
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/cron/list.php?status=-2'); // Make a call to avoid to run twice job when using back
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +175,7 @@ if ($action == 'delete')
|
||||
|
||||
if ($action == 'execute')
|
||||
{
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status.'&securitykey='.$securitykey,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1);
|
||||
|
||||
}
|
||||
|
||||
@@ -350,7 +359,7 @@ if ($num > 0)
|
||||
}
|
||||
if ($user->rights->cron->execute)
|
||||
{
|
||||
if (!empty($line->status)) print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$line->id."&action=execute".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'),"play")."</a>";
|
||||
if (!empty($line->status)) print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$line->id."&action=execute".(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'),"play")."</a>";
|
||||
else print "<a href=\"#\" title=\"".dol_escape_htmltag($langs->trans('JobDisabled'))."\">".img_picto($langs->trans('JobDisabled'),"play")."</a>";
|
||||
} else {
|
||||
print "<a href=\"#\" title=\"".dol_escape_htmltag($langs->trans('NotEnoughPermissions'))."\">".img_picto($langs->trans('NotEnoughPermissions'),"play")."</a>";
|
||||
|
||||
@@ -49,7 +49,8 @@ $action=GETPOST('action','alpha');
|
||||
$cancel=GETPOST('cancel');
|
||||
$amount=GETPOST('amount');
|
||||
$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
|
||||
$projectid=GETPOST('projectid')?GETPOST('projectid','int'):GETPOST("fk_projet",'int');
|
||||
|
||||
$object = new Don($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
@@ -169,9 +170,10 @@ if ($action == 'add')
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if ($object->create($user) > 0)
|
||||
$res = $object->create($user);
|
||||
if ($res > 0)
|
||||
{
|
||||
header("Location: index.php");
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -365,7 +367,7 @@ if ($action == 'create')
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||
$formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 0, 1, 1);
|
||||
$formproject->select_projects(-1, $projectid,'fk_projet', 0, 0, 1, 1);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ if (count($listofsearchfields))
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="14"></td>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="14"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@@ -365,12 +365,13 @@ class Expedition extends CommonObject
|
||||
* @param int $origin_line_id Id of source line
|
||||
* @param int $qty Quantity
|
||||
* @param array $array_options extrafields array
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int <0 if KO, line_id if OK
|
||||
*/
|
||||
function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$line_id = 0;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet (";
|
||||
$sql.= "fk_expedition";
|
||||
@@ -390,6 +391,8 @@ class Expedition extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error) $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
|
||||
|
||||
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$expeditionline = new ExpeditionLigne($this->db);
|
||||
@@ -403,7 +406,7 @@ class Expedition extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) return 1;
|
||||
if (! $error) return $line_id;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
@@ -432,14 +435,13 @@ class Expedition extends CommonObject
|
||||
// create shipment lines
|
||||
foreach ($stockLocationQty as $stockLocation => $qty)
|
||||
{
|
||||
if ($this->create_line($stockLocation,$line_ext->origin_line_id,$qty,$array_options) < 0)
|
||||
if (($line_id = $this->create_line($stockLocation,$line_ext->origin_line_id,$qty,$array_options)) < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// create shipment batch lines for stockLocation
|
||||
$line_id= $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
|
||||
foreach ($tab as $detbatch)
|
||||
{
|
||||
if ($detbatch->entrepot_id == $stockLocation){
|
||||
@@ -716,7 +718,7 @@ class Expedition extends CommonObject
|
||||
|
||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
|
||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock);
|
||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->errors[]=$mouvS->error;
|
||||
@@ -1913,7 +1915,7 @@ class Expedition extends CommonObject
|
||||
// line with batch detail
|
||||
|
||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock);
|
||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
||||
if ($result < 0) {
|
||||
$this->error = $mouvS->error;
|
||||
$this->errors = $mouvS->errors;
|
||||
@@ -2078,7 +2080,7 @@ class Expedition extends CommonObject
|
||||
// line with batch detail
|
||||
|
||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
|
||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock);
|
||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
||||
if ($result < 0) {
|
||||
$this->error = $mouvS->error;
|
||||
$this->errors = $mouvS->errors;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@@ -82,7 +83,7 @@ $fieldstosearchall = array(
|
||||
's.nom'=>"ThirdParty",
|
||||
'e.note_public'=>'NotePublic',
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
||||
if (empty($user->socid)) $fieldstosearchall["e.note_private"]="NotePrivate";
|
||||
|
||||
$checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
@@ -258,6 +259,7 @@ if ($resql)
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sall) $param.= "&sall=".$sall;
|
||||
if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp;
|
||||
if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv;
|
||||
if ($search_company) $param.= "&search_company=".$search_company;
|
||||
|
||||
@@ -219,6 +219,7 @@ if ($resql)
|
||||
$param="";
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sall) $param.="&sall=".$sall;
|
||||
if ($search_ref) $param.="&search_ref=".$search_ref;
|
||||
if ($search_user) $param.="&search_user=".$search_user;
|
||||
if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht;
|
||||
|
||||
@@ -213,6 +213,7 @@ if ($result)
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sall) $urlparam.="&sall=".$sall;
|
||||
if ($socid) $param.="&socid=".$socid;
|
||||
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
|
||||
if ($search_company) $param.="&search_company=".urlencode($search_company);
|
||||
@@ -274,7 +275,7 @@ if ($result)
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.0');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.1');
|
||||
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
@@ -92,7 +92,7 @@ if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not do
|
||||
$path=$_SERVER["CONTEXT_PREFIX"]; // example '/dolibarr/' when using an apache alias.
|
||||
if (! preg_match('/\/$/', $path)) $path.='/';
|
||||
}
|
||||
else if (preg_match('/index\.php', $_SERVER['PHP_SELF']))
|
||||
else if (preg_match('/index\.php/', $_SERVER['PHP_SELF']))
|
||||
{
|
||||
// When we ask index.php, we MUST BE SURE that $path is '' at the end. This is required to make install process
|
||||
// when using apache alias like '/dolibarr/' that point to htdocs.
|
||||
@@ -113,11 +113,11 @@ if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not do
|
||||
if (empty($TDir[$i]) || $TDir[$i] == 'htdocs') break;
|
||||
if ($TDir[$i] == 'dolibarr') break;
|
||||
if (substr($TDir[$i], -4, 4) == '.php') continue;
|
||||
|
||||
|
||||
$path .= '../';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
header("Location: ".$path."install/index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,9 @@ if ($object->id > 0)
|
||||
|
||||
dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
@@ -298,22 +300,22 @@ if ($object->id > 0)
|
||||
$langs->load("products");
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("ProductsAndServices").'</td><td align="right">';
|
||||
print '<td colspan="3">'.$langs->trans("ProductsAndServices").'</td><td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/fourn/product/list.php?fourn_id='.$object->id.'">'.$langs->trans("All").' <span class="badge">'.$object->nbOfProductRefs().'</span>';
|
||||
print '</a></td></tr>';
|
||||
|
||||
//Query from product/liste.php
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, pfp.tms,';
|
||||
$sql.= ' p.fk_product_type, p.entity';
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.fk_product_type, p.entity,';
|
||||
$sql.= ' pfp.tms, pfp.ref_fourn as supplier_ref, pfp.price, pfp.quantity, pfp.unitprice';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp';
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product";
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
||||
$sql.= ' AND pfp.fk_soc = '.$object->id;
|
||||
$sql .= $db->order('pfp.tms', 'desc');
|
||||
$sql.= $db->plimit($MAXLIST);
|
||||
|
||||
$query = $db->query($sql);
|
||||
|
||||
if (! $query) dol_print_error($db);
|
||||
|
||||
$return = array();
|
||||
|
||||
if ($db->num_rows($query)) {
|
||||
@@ -334,10 +336,25 @@ if ($object->id > 0)
|
||||
print '<td class="nowrap">';
|
||||
print $productstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<td>';
|
||||
print $objp->supplier_ref;
|
||||
print '</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print dol_trunc(dol_htmlentities($objp->label), 30);
|
||||
print '</td>';
|
||||
print '<td align="right" class="nowrap">'.dol_print_date($objp->tms).'</td>';
|
||||
//print '<td align="right" class="nowrap">'.dol_print_date($objp->tms, 'day').'</td>';
|
||||
print '<td align="right">';
|
||||
//print (isset($objp->unitprice) ? price($objp->unitprice) : '');
|
||||
if (isset($objp->price))
|
||||
{
|
||||
print price($objp->price);
|
||||
if ($objp->quantity > 1)
|
||||
{
|
||||
print ' / ';
|
||||
print $objp->quantity;
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
@@ -452,7 +469,6 @@ if ($object->id > 0)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
|
||||
$sql.= " WHERE p.fk_soc =".$object->id;
|
||||
$sql.= " AND p.entity =".$conf->entity;
|
||||
$sql.= " ORDER BY p.date_commande DESC";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -65,7 +65,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
// -> 9=Refused -> (reopen) 1=Validated
|
||||
// Note: billed or not is on another field "billed"
|
||||
var $statuts; // List of status
|
||||
|
||||
|
||||
var $socid;
|
||||
var $fourn_id;
|
||||
var $date;
|
||||
@@ -126,7 +126,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
var $multicurrency_total_ht;
|
||||
var $multicurrency_total_tva;
|
||||
var $multicurrency_total_ttc;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -255,7 +255,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
|
||||
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
$this->db->free($resql);
|
||||
@@ -271,6 +271,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
$this->fetchObjectLinked();
|
||||
|
||||
$this->lines=array();
|
||||
|
||||
$sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description,";
|
||||
$sql.= " l.qty,";
|
||||
$sql.= " l.tva_tx, l.remise_percent, l.subprice,";
|
||||
@@ -330,7 +332,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$line->date_start = $this->db->jdate($objp->date_start);
|
||||
$line->date_end = $this->db->jdate($objp->date_end);
|
||||
$line->fk_unit = $objp->fk_unit;
|
||||
|
||||
|
||||
// Multicurrency
|
||||
$line->fk_multicurrency = $objp->fk_multicurrency;
|
||||
$line->multicurrency_code = $objp->multicurrency_code;
|
||||
@@ -338,7 +340,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$line->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||
|
||||
|
||||
$this->special_code = $objp->special_code;
|
||||
$this->fk_parent_line = $objp->fk_parent_line;
|
||||
|
||||
@@ -513,7 +515,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$billedtext='';
|
||||
//if ($statut==5 && $this->billed == 1) $statut = 8;
|
||||
if ($billed == 1) $billedtext=$langs->trans("Billed");
|
||||
|
||||
|
||||
// List of language codes for status
|
||||
$statutshort[0] = 'StatusOrderDraftShort';
|
||||
$statutshort[1] = 'StatusOrderValidatedShort';
|
||||
@@ -617,7 +619,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
* Returns the following order reference not used depending on the numbering model activated
|
||||
* defined within COMMANDE_SUPPLIER_ADDON_NUMBER
|
||||
*
|
||||
* @param Societe $soc company object
|
||||
* @param Company $soc company object
|
||||
* @return string free reference for the invoice
|
||||
*/
|
||||
function getNextNumRef($soc)
|
||||
@@ -677,7 +679,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
function classifyBilled(User $user)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1';
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ';
|
||||
if ($this->db->query($sql))
|
||||
@@ -689,11 +691,11 @@ class CommandeFournisseur extends CommonOrder
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->billed=1;
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@@ -706,7 +708,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
|
||||
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@@ -1006,7 +1008,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->statut = 3;
|
||||
$this->methode_commande_id = $methode;
|
||||
$this->date_commande = $this->db->idate($date);
|
||||
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_SUPPLIER_SUBMIT',$user);
|
||||
if ($result < 0) $error++;
|
||||
@@ -1018,7 +1020,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
@@ -1067,7 +1069,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->fk_multicurrency = 0;
|
||||
$this->multicurrency_tx = 1;
|
||||
}
|
||||
|
||||
|
||||
// We set order into draft status
|
||||
$this->brouillon = 1;
|
||||
|
||||
@@ -1100,7 +1102,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$this->socid;
|
||||
$sql.= ", ".($this->fk_project > 0 ? $this->fk_project : "null");
|
||||
$sql.= ", ".($this->fk_project > 0 ? $this->fk_project : "null");
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null");
|
||||
$sql.= ", ".$user->id;
|
||||
@@ -1291,7 +1293,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
* @param float $txtva Taux tva
|
||||
* @param float $txlocaltax1 Localtax1 tax
|
||||
* @param float $txlocaltax2 Localtax2 tax
|
||||
* @param int $fk_product Id produit
|
||||
* @param int $fk_product Id product
|
||||
* @param int $fk_prod_fourn_price Id supplier price
|
||||
* @param string $fourn_ref Supplier reference
|
||||
* @param float $remise_percent Remise
|
||||
@@ -1416,7 +1418,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
|
||||
|
||||
$localtax1_type=$localtaxes_type[0];
|
||||
$localtax2_type=$localtaxes_type[2];
|
||||
|
||||
@@ -1944,7 +1946,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$result=$this->call_trigger('ORDER_SUPPLIER_RECEIVE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
@@ -2198,7 +2200,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
|
||||
|
||||
$localtax1_type=$localtaxes_type[0];
|
||||
$localtax2_type=$localtaxes_type[2];
|
||||
|
||||
@@ -2226,13 +2228,13 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql.= ",total_ttc='".price2num($total_ttc)."'";
|
||||
$sql.= ",product_type=".$type;
|
||||
$sql.= ($fk_unit ? ",fk_unit='".$this->db->escape($fk_unit)."'":", fk_unit=null");
|
||||
|
||||
|
||||
// Multicurrency
|
||||
$sql.= " , multicurrency_subprice=".price2num($subprice * $this->multicurrency_tx)."";
|
||||
$sql.= " , multicurrency_total_ht=".price2num($multicurrency_total_ht)."";
|
||||
$sql.= " , multicurrency_total_tva=".price2num($multicurrency_total_tva)."";
|
||||
$sql.= " , multicurrency_total_ttc=".price2num($multicurrency_total_ttc)."";
|
||||
|
||||
|
||||
$sql.= " WHERE rowid = ".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
|
||||
@@ -2401,7 +2403,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author) $this->user_creation_id = $obj->fk_user_author;
|
||||
if ($obj->fk_user_author) $this->user_creation_id = $obj->fk_user_author;
|
||||
if ($obj->fk_user_valid) $this->user_validation_id = $obj->fk_user_valid;
|
||||
if ($obj->fk_user_modif) $this->user_modification_id =$obj->fk_user_modif;
|
||||
if ($obj->fk_user_approve) $this->user_approve_id = $obj->fk_user_approve;
|
||||
@@ -2420,7 +2422,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge indicateurs this->nb de tableau de bord
|
||||
*
|
||||
@@ -2656,15 +2658,15 @@ class CommandeFournisseur extends CommonOrder
|
||||
public function hasDelay()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
if (empty($this->date_delivery) && ! empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility
|
||||
|
||||
|
||||
$now = dol_now();
|
||||
$date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery;
|
||||
|
||||
|
||||
return ($this->statut > 0 && $this->statut < 4) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the customer delayed info
|
||||
*
|
||||
@@ -2673,15 +2675,15 @@ class CommandeFournisseur extends CommonOrder
|
||||
public function showDelay()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
|
||||
if (empty($this->date_delivery) && ! empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility
|
||||
|
||||
|
||||
if (empty($this->date_delivery)) $text=$langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day');
|
||||
else $text=$text=$langs->trans("DeliveryDate").' '.dol_print_date($this->date_delivery, 'day');
|
||||
$text.=' '.($conf->commande->fournisseur->warning_delay>0?'+':'-').' '.round(abs($conf->commande->fournisseur->warning_delay)/3600/24,1).' '.$langs->trans("days").' < '.$langs->trans("Today");
|
||||
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -272,9 +272,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a line into product
|
||||
*/
|
||||
// Add a product line
|
||||
if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$langs->load('errors');
|
||||
@@ -426,8 +424,8 @@ if (empty($reshook))
|
||||
$tva_tx = price2num($tva_tx); // When vat is text input field
|
||||
|
||||
// Local Taxes
|
||||
$localtax1_tx= get_localtax($tva_tx, 1,$mysoc,$object->thirdparty);
|
||||
$localtax2_tx= get_localtax($tva_tx, 2,$mysoc,$object->thirdparty);
|
||||
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
|
||||
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
|
||||
|
||||
if (GETPOST('price_ht')!=='')
|
||||
{
|
||||
@@ -2080,184 +2078,6 @@ elseif (! empty($object->id))
|
||||
|
||||
$num = count($object->lines);
|
||||
|
||||
/*
|
||||
$i = 0; $total = 0;
|
||||
if ($num)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Label').'</td>';
|
||||
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
|
||||
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
|
||||
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
|
||||
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
|
||||
print '<td width="48" colspan="3"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$line = $object->lines[$i];
|
||||
$var=!$var;
|
||||
|
||||
// Show product and description
|
||||
$type=(! empty($line->product_type)?$line->product_type:(! empty($line->fk_product_type)?$line->fk_product_type:0));
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
$date_start='';
|
||||
$date_end='';
|
||||
if (! empty($line->date_start))
|
||||
{
|
||||
$date_start=$line->date_start;
|
||||
$type=1;
|
||||
}
|
||||
if (! empty($line->date_end))
|
||||
{
|
||||
$date_end=$line->date_end;
|
||||
$type=1;
|
||||
}
|
||||
|
||||
// Edit line
|
||||
if ($action != 'editline' || $_GET['rowid'] != $line->id)
|
||||
{
|
||||
print '<tr id="row-'.$line->id.'" '.$bc[$var].'>';
|
||||
|
||||
// Show product and description
|
||||
print '<td>';
|
||||
if ($line->fk_product > 0)
|
||||
{
|
||||
print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
$product_static=new ProductFournisseur($db);
|
||||
$product_static->fetch($line->fk_product);
|
||||
$text=$product_static->getNomUrl(1,'supplier');
|
||||
$text.= ' - '.$product_static->libelle;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
|
||||
print $form->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($date_start,$date_end);
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) print ($line->description && $line->description!=$product_static->libelle)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
||||
}
|
||||
|
||||
// Description - Editor wysiwyg
|
||||
if (! $line->fk_product)
|
||||
{
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
print $text.' '.nl2br($line->description);
|
||||
|
||||
// Show range
|
||||
print_date_range($date_start,$date_end);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right" class="nowrap">'.vatrate($line->tva_tx).'%</td>';
|
||||
|
||||
print '<td align="right" class="nowrap">'.price($line->subprice)."</td>\n";
|
||||
|
||||
print '<td align="right" class="nowrap">'.$line->qty.'</td>';
|
||||
|
||||
if ($line->remise_percent > 0)
|
||||
{
|
||||
print '<td align="right" class="nowrap">'.dol_print_reduction($line->remise_percent,$langs)."</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
print '<td align="right" class="nowrap">'.price($line->total_ht).'</td>';
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters=array('line'=>$line,'num'=>$num,'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$object,$action);
|
||||
}
|
||||
|
||||
if ($object->statut == 0 && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
print '<td align="center" width="16"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editline&rowid='.$line->id.'#'.$line->id.'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
$actiondelete='delete_product_line';
|
||||
print '<td align="center" width="16"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action='.$actiondelete.'&lineid='.$line->id.'">';
|
||||
print img_delete();
|
||||
print '</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td><td> </td>';
|
||||
}
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
// Edit line
|
||||
if ($action == 'editline' && $user->rights->fournisseur->commande->creer && ($_GET["rowid"] == $line->id))
|
||||
{
|
||||
print "\n";
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
|
||||
print '<input type="hidden" name="elrowid" value="'.$_GET['rowid'].'">';
|
||||
|
||||
print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne
|
||||
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $line->fk_product > 0)
|
||||
{
|
||||
$product_static=new ProductFournisseur($db);
|
||||
$product_static->fetch($line->fk_product);
|
||||
$text=$product_static->getNomUrl(1,'supplier');
|
||||
$text.= ' - '.$product_static->libelle;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
|
||||
print $form->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($date_start,$date_end);
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$forceall=1; // For suppliers, we always show all types
|
||||
print $form->select_type_of_lines($line->product_type,'type',1,0,$forceall);
|
||||
if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|
||||
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
|
||||
}
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
|
||||
}
|
||||
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
$doleditor=new DolEditor('eldesc',$line->description,'',200,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
|
||||
$doleditor->Create();
|
||||
|
||||
print '<br>';
|
||||
print $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||
print $form->select_date($date_start,'date_start'.$date_pf,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,'',1,0,1);
|
||||
print ' '.$langs->trans('to').' ';
|
||||
print $form->select_date($date_end,'date_end'.$date_pf,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,'',1,0,1);
|
||||
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->load_tva('tva_tx',$line->tva_tx,$object->thirdparty,$mysoc);
|
||||
print '</td>';
|
||||
print '<td align="right"><input size="5" type="text" name="pu" value="'.price($line->subprice).'"></td>';
|
||||
print '<td align="right"><input size="2" type="text" name="qty" value="'.$line->qty.'"></td>';
|
||||
print '<td align="right" class="nowrap"><input size="1" type="text" name="remise_percent" value="'.$line->remise_percent.'"><span class="hideonsmartphone">%</span></td>';
|
||||
print '<td align="center" colspan="4"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
|
||||
print '</tr>' . "\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
*/
|
||||
// Form to add new line
|
||||
if ($object->statut == 0 && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/fourn/commande/index.php
|
||||
* \ingroup commande fournisseur
|
||||
* \brief Home page of supplier's orders area
|
||||
* \file htdocs/fourn/commande/index.php
|
||||
* \ingroup commande fournisseur
|
||||
* \brief Home page of supplier's orders area
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@@ -50,8 +50,7 @@ $formfile = new FormFile($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("SuppliersOrdersArea"));
|
||||
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<tr valign="top"><td class="notopnoleft" width="30%">';
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
/*
|
||||
@@ -84,72 +83,72 @@ $sql.= " GROUP BY cf.fk_statut";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
$var=True;
|
||||
|
||||
$total=0;
|
||||
$totalinprocess=0;
|
||||
$dataseries=array();
|
||||
$vals=array();
|
||||
// 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially
|
||||
// -> 7=Canceled/Never received -> (reopen) 3=Process runing
|
||||
// -> 6=Canceled -> (reopen) 2=Approved
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row)
|
||||
{
|
||||
if ($row[1]!=7 && $row[1]!=6 && $row[1]!=5)
|
||||
{
|
||||
$vals[$row[1]]=$row[0];
|
||||
$totalinprocess+=$row[0];
|
||||
}
|
||||
$total+=$row[0];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
$total=0;
|
||||
$totalinprocess=0;
|
||||
$dataseries=array();
|
||||
$vals=array();
|
||||
// 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially
|
||||
// -> 7=Canceled/Never received -> (reopen) 3=Process runing
|
||||
// -> 6=Canceled -> (reopen) 2=Approved
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row)
|
||||
{
|
||||
if ($row[1]!=7 && $row[1]!=6 && $row[1]!=5)
|
||||
{
|
||||
$vals[$row[1]]=$row[0];
|
||||
$totalinprocess+=$row[0];
|
||||
}
|
||||
$total+=$row[0];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'</td></tr>';
|
||||
print "</tr>\n";
|
||||
foreach (array(0,1,2,3,4,5,6) as $statut)
|
||||
{
|
||||
$dataseries[]=array('label'=>$commandestatic->LibStatut($statut,1),'data'=>(isset($vals[$statut])?(int) $vals[$statut]:0));
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$commandestatic->LibStatut($statut,0).'</td>';
|
||||
print '<td align="right"><a href="list.php?statut='.$statut.'">'.(isset($vals[$statut])?$vals[$statut]:0).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<tr class="impair"><td align="center" colspan="2">';
|
||||
$data=array('series'=>$dataseries);
|
||||
dol_print_graph('stats',300,180,$data,1,'pie',1,'',0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
//if ($totalinprocess != $total)
|
||||
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.$total.'</td></tr>';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'</td></tr>';
|
||||
print "</tr>\n";
|
||||
foreach (array(0,1,2,3,4,5,6) as $statut)
|
||||
{
|
||||
$dataseries[]=array('label'=>$commandestatic->LibStatut($statut,1),'data'=>(isset($vals[$statut])?(int) $vals[$statut]:0));
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$commandestatic->LibStatut($statut,0).'</td>';
|
||||
print '<td align="right"><a href="list.php?statut='.$statut.'">'.(isset($vals[$statut])?$vals[$statut]:0).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<tr class="impair"><td align="center" colspan="2">';
|
||||
$data=array('series'=>$dataseries);
|
||||
dol_print_graph('stats',300,180,$data,1,'pie',1,'',0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
//if ($totalinprocess != $total)
|
||||
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.$total.'</td></tr>';
|
||||
|
||||
print "</table><br>";
|
||||
print "</table><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Legends / Status
|
||||
*
|
||||
* Motivo: Mostrar todos os Status e dar a possibilidade de filtrar apenas um deles
|
||||
* Reason: Show all Status and give the possibility to filter only one
|
||||
* Motivo: Mostrar todos os Status e dar a possibilidade de filtrar apenas um deles
|
||||
* Reason: Show all Status and give the possibility to filter only one
|
||||
*/
|
||||
|
||||
$sql = "SELECT count(cf.rowid), fk_statut";
|
||||
@@ -165,34 +164,34 @@ $sql.= " GROUP BY cf.fk_statut";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Nb").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Nb").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$var=!$var;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$langs->trans($commandestatic->statuts[$row[1]]).'</td>';
|
||||
print '<td align="right"><a href="list.php?statut='.$row[1].'">'.$row[0].' '.$commandestatic->LibStatut($row[1],3).'</a></td>';
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$langs->trans($commandestatic->statuts[$row[1]]).'</td>';
|
||||
print '<td align="right"><a href="list.php?statut='.$row[1].'">'.$row[0].' '.$commandestatic->LibStatut($row[1],3).'</a></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
@@ -202,41 +201,41 @@ else
|
||||
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_statut = 0";
|
||||
if (! empty($socid)) $sql.= " AND c.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_statut = 0";
|
||||
if (! empty($socid)) $sql.= " AND c.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("DraftOrders").'</td></tr>';
|
||||
$langs->load("orders");
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">';
|
||||
print "<a href=\"card.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."</a></td>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).'</a></td></tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("DraftOrders").'</td></tr>';
|
||||
$langs->load("orders");
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">';
|
||||
print "<a href=\"card.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."</a></td>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).'</a></td></tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -258,40 +257,40 @@ $sql.= " AND subperms = 'approuver'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("UserWithApproveOrderGrant").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("UserWithApproveOrderGrant").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>';
|
||||
$userstatic->id=$obj->rowid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->email=$obj->email;
|
||||
print $userstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>';
|
||||
$userstatic->id=$obj->rowid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->email=$obj->email;
|
||||
print $userstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print '</td><td width="70%" valign="top" class="notopnoleftnoright">';
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
/*
|
||||
@@ -314,52 +313,52 @@ $sql.= $db->plimit($max, 0);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("LastModifiedOrders",$max).'</td></tr>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("LastModifiedOrders",$max).'</td></tr>';
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="20%" class="nowrap">';
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="20%" class="nowrap">';
|
||||
|
||||
$commandestatic->id=$obj->rowid;
|
||||
$commandestatic->ref=$obj->ref;
|
||||
$commandestatic->id=$obj->rowid;
|
||||
$commandestatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="96" class="nobordernopadding nowrap">';
|
||||
print $commandestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="96" class="nobordernopadding nowrap">';
|
||||
print $commandestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" class="nobordernopadding nowrap">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
print '<td width="16" class="nobordernopadding nowrap">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
print '</td>';
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->tms),'day').'</td>';
|
||||
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,5).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->tms),'day').'</td>';
|
||||
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,5).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
@@ -433,7 +432,7 @@ print "</table><br>";
|
||||
}
|
||||
*/
|
||||
|
||||
print '</td></tr></table>';
|
||||
print '</div></div></div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@@ -129,8 +130,8 @@ if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate";
|
||||
$checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'cf.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplier"), 'checked'=>1, 'enabled'=>$conf->global->SUPPLIER_ORDER_HIDE_REF_SUPPLIER),
|
||||
'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'enabled'=>$conf->global->PROJECT_SHOW_REF_INTO_LISTS),
|
||||
'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplier"), 'checked'=>1, 'enabled'=>1),
|
||||
'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1),
|
||||
'u.login'=>array('label'=>$langs->trans("AuthorRequest"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
||||
@@ -399,6 +400,7 @@ if ($resql)
|
||||
if ($socid > 0) $param.='&socid='.$socid;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sall) $param.="&search_all=".$sall;
|
||||
if ($orderday) $param.='&orderday='.$orderday;
|
||||
if ($ordermonth) $param.='&ordermonth='.$ordermonth;
|
||||
if ($orderyear) $param.='&orderyear='.$orderyear;
|
||||
|
||||
@@ -58,7 +58,6 @@ if ($user->societe_id > 0)
|
||||
}
|
||||
|
||||
$mode=GETPOST("mode");
|
||||
$modesearch=GETPOST("mode_search");
|
||||
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
|
||||
@@ -215,27 +214,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
|
||||
$option='';
|
||||
}
|
||||
|
||||
if ($mode == 'search')
|
||||
{
|
||||
if ($modesearch == 'soc')
|
||||
{
|
||||
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
|
||||
$sql.= " WHERE s.nom LIKE '%".$db->escape($socname)."%'";
|
||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||
}
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ( $db->num_rows($resql) == 1)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$socid = $obj->rowid;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Mass actions. Controls on number of lines checked
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/**
|
||||
* \file htdocs/fourn/product/list.php
|
||||
* \ingroup produit
|
||||
* \brief Page liste des produits ou services
|
||||
* \brief Page to list supplier products and services
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
@@ -296,7 +296,7 @@ print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],'','','','',$
|
||||
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -315,14 +315,14 @@ print '</td>';
|
||||
// UTILISATEUR
|
||||
if ($user->rights->holiday->write_all)
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
|
||||
print $form->select_dolusers($search_employe,"search_employe",1,"",0,'','',0,32,0,'',0,'','maxwidth200');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
//print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
|
||||
print $form->select_dolusers($user->id,"search_employe",1,"",1,'','',0,32,0,'',0,'','maxwidth200');
|
||||
print '</td>';
|
||||
}
|
||||
@@ -330,7 +330,7 @@ else
|
||||
// APPROVER
|
||||
if($user->rights->holiday->write_all)
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
|
||||
|
||||
$validator = new UserGroup($db);
|
||||
$excludefilter=$user->admin?'':'u.rowid <> '.$user->id;
|
||||
@@ -365,7 +365,7 @@ $formother->select_year($year_end,'year_end',1, $min_year, $max_year);
|
||||
print '</td>';
|
||||
|
||||
// STATUT
|
||||
print '<td class="liste_titre" width="70px;" align="center">';
|
||||
print '<td class="liste_titre maxwidthonsmartphone maxwidth200" align="right">';
|
||||
$holiday->selectStatutCP($search_statut);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@@ -110,7 +110,8 @@ if ($result)
|
||||
|
||||
$establishmentstatic->id=$obj->rowid;
|
||||
$establishmentstatic->name=$obj->name;
|
||||
|
||||
$establishmentstatic->status=$obj->status;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$establishmentstatic->getNomUrl(1).'</td>';
|
||||
@@ -119,7 +120,7 @@ if ($result)
|
||||
print '<td align="left">'.$obj->town.'</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print $establishmenttmp->getLibStatus(5);
|
||||
print $establishmentstatic->getLibStatus(5);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ class Establishment extends CommonObject
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
$this->statuts_short = array(0 => 'Opened', 1 => 'Closed');
|
||||
$this->statuts = array(0 => 'Opened', 1 => 'Closed');
|
||||
$this->statuts_short = array(0 => 'Closed', 1 => 'Opened');
|
||||
$this->statuts = array(0 => 'Closed', 1 => 'Opened');
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ class Establishment extends CommonObject
|
||||
$sql .= ", address = '".$this->address."'";
|
||||
$sql .= ", zip = '".$this->zip."'";
|
||||
$sql .= ", town = '".$this->town."'";
|
||||
|
||||
$sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null');
|
||||
$sql .= ", status = '".$this->status."'";
|
||||
$sql .= ", fk_user_mod = " . $user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
@@ -273,23 +273,23 @@ class Establishment extends CommonObject
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]);
|
||||
if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut8').' '.$langs->trans($this->statuts_short[$status]);
|
||||
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts_short[$status]);
|
||||
if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]);
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4');
|
||||
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut8');
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5');
|
||||
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]);
|
||||
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut8').' '.$langs->trans($this->statuts[$status]);
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts[$status]);
|
||||
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]);
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4');
|
||||
if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut8');
|
||||
if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5');
|
||||
if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,14 +40,18 @@ $id = GETPOST('id','int');
|
||||
|
||||
// List of status
|
||||
static $tmpstatus2label=array(
|
||||
'0'=>'OpenEtablishment',
|
||||
'1'=>'CloseEtablishment'
|
||||
'0'=>'CloseEtablishment',
|
||||
'1'=>'OpenEtablishment'
|
||||
);
|
||||
$status2label=array('');
|
||||
foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val);
|
||||
|
||||
$object = new Establishment($db);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@@ -128,12 +132,13 @@ else if ($action == 'update')
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
if (empty($error))
|
||||
{
|
||||
$object->name = GETPOST('name', 'alpha');
|
||||
$object->address = GETPOST('address', 'alpha');
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->country_id = $_POST["country_id"];
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->fk_user_mod = $user->id;
|
||||
|
||||
$result = $object->update($user);
|
||||
@@ -373,7 +378,8 @@ else if ($id)
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatus(4).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||
print $object->getLibStatus(4).'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ if (count($listofsearchfields))
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@@ -482,7 +482,7 @@ class CommentParser
|
||||
$r['name'] = substr($data, 1);
|
||||
}
|
||||
}
|
||||
if (isset($r['type']) && Text::endsWith($r['type'], '[]')) {
|
||||
if (isset($r['type']) && is_string($r['type']) && Text::endsWith($r['type'], '[]')) {
|
||||
$r[static::$embeddedDataName]['type'] = substr($r['type'], 0, -2);
|
||||
$r['type'] = 'array';
|
||||
}
|
||||
|
||||
2
htdocs/install/.gitignore
vendored
2
htdocs/install/.gitignore
vendored
@@ -1 +1 @@
|
||||
/filelist.xml
|
||||
/filelist*.xml
|
||||
|
||||
@@ -561,22 +561,12 @@ function jscheckparam()
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>');
|
||||
}
|
||||
else if (document.forminstall.db_create_database.checked == true && (document.forminstall.db_user_root.value == ''))
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>');
|
||||
}
|
||||
// If create user asked
|
||||
else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == ''))
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>');
|
||||
}
|
||||
else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == ''))
|
||||
{
|
||||
ok=false;
|
||||
alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>');
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@@ -724,7 +724,7 @@ INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (3,'PROPO' ,'Proposal', 30, 40,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (4,'NEGO' ,'Negotiation', 40, 60,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (5,'PENDING','Pending', 50, 50,0);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WIN' ,'Won', 60, 100,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WON' ,'Won', 60, 100,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (7,'LOST' ,'Lost', 70, 0,1);
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', '
|
||||
-- DROP TABLE llx_product_lot;
|
||||
CREATE TABLE llx_product_lot (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer,
|
||||
entity integer DEFAULT 1,
|
||||
fk_product integer NOT NULL, -- Id of product
|
||||
batch varchar(30) DEFAULT NULL, -- Lot or serial number
|
||||
eatby date DEFAULT NULL, -- Eatby date
|
||||
@@ -61,6 +61,10 @@ CREATE TABLE llx_product_lot (
|
||||
|
||||
ALTER TABLE llx_product_lot ADD UNIQUE INDEX uk_product_lot(fk_product, batch);
|
||||
|
||||
-- VPGSQL8.2 ALTER TABLE llx_product_lot ALTER COLUMN entity SET DEFAULT 1;
|
||||
ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1;
|
||||
UPDATE llx_product_lot SET entity = 1 WHERE entity IS NULL;
|
||||
|
||||
DROP TABLE llx_stock_serial;
|
||||
|
||||
ALTER TABLE llx_product ADD COLUMN note_public text;
|
||||
@@ -537,3 +541,8 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178,
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17804', 'Sociedad Civil', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, '17805', 'Sociedad Anónima', 1);
|
||||
|
||||
|
||||
-- VMYSQL4.1 ALTER TABLE llx_establishment CHANGE COLUMN fk_user_mod fk_user_mod integer NULL;
|
||||
-- VPGSQL8.2 ALTER TABLE llx_establishment ALTER COLUMN fk_user_mod DROP NOT NULL;
|
||||
|
||||
ALTER TABLE llx_multicurrency_rate ADD COLUMN entity integer DEFAULT 1;
|
||||
@@ -33,7 +33,7 @@ CREATE TABLE llx_establishment (
|
||||
profid3 varchar(20),
|
||||
phone varchar(20),
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_mod integer NOT NULL,
|
||||
fk_user_mod integer,
|
||||
datec datetime NOT NULL,
|
||||
tms timestamp NOT NULL,
|
||||
status tinyint DEFAULT 1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user