Merge remote branch 'upstream/develop' into fccard

Conflicts:
	htdocs/commande/card.php
This commit is contained in:
frederic34 2015-11-11 17:23:37 +01:00
commit cd738ef483
125 changed files with 1991 additions and 1481 deletions

View File

@ -133,12 +133,19 @@ Voici un liste de fonctionnalites pas encore gérées par Dolibarr:
- Dolibarr ne fait pas le café (pas encore).
## RESEAUX SOCIAUX
## ACTUALITES ET RESEAUX SOCIAUX
Suivez le projet Dolibarr project sur
Suivez le projet Dolibarr project sur les réseaux francophones
Facebook: <https://www.facebook.com/dolibarr.fr>
- Facebook: <https://www.facebook.com/dolibarr.fr>
- Google+: <https://plus.google.com/+DolibarrFrance>
- Twitter: <http://www.twitter.com/dolibarr_france>
Google+: <https://plus.google.com/+DolibarrFrance>
ou sur les réseaux anglophones
Twitter: <http://www.twitter.com/dolibarr_france>
- [Facebook](https://www.facebook.com/dolibarr)
- [Google+](https://plus.google.com/+DolibarrOrg)
- [Twitter](http://www.twitter.com/dolibarr)
- [LinkedIn](https://www.linkedin.com/company/association-dolibarr)
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
- [GitHub](https://github.com/Dolibarr/dolibarr)

View File

@ -1,6 +1,6 @@
# DOLIBARR ERP & CRM
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dd/dolibarr.svg)
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg)
Dolibarr ERP & CRM is a modern software to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
@ -16,9 +16,9 @@ You can use it as a standalone application or as a web application to be able to
Dolibarr is released under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version (GPL-3+).
See the [COPYING](COPYING) file for a full copy of the license.
See the [COPYING](https://github.com/Dolibarr/dolibarr/blob/develop/COPYING) file for a full copy of the license.
Other licenses apply for some included dependencies. See [COPYRIGHT](COPYRIGHT) for a full list.
Other licenses apply for some included dependencies. See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) for a full list.
## INSTALLING
@ -65,9 +65,9 @@ You can use a Web server and a supported database (MySQL recommended) to install
*Note: migration process can safely be done multiple times.*
## NEWS
## WHAT'S NEW
See the [ChangeLog](ChangeLog) file.
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
## FEATURES
@ -153,9 +153,9 @@ Administrator, user, developer and translator's documentations are available alo
Dolibarr is the work of many contributors over the years and uses some fine libraries.
See [COPYRIGHT](COPYRIGHT) file.
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
## SOCIAL NETWORKS
## NEWS AND SOCIAL NETWORKS
Follow Dolibarr project on:

View File

@ -239,7 +239,7 @@ http://packages.qa.debian.org/t/tcpdf.html
##### Create/Maintain dolibarr package
To update dolibarr debian package when upstream version has changed
To update dolibarr debian package when upstream (official version of external project) has changed:
* You can git clone debian git repo
> git clone git.debian.org:/git/collab-maint/dolibarr.git [dolibarr-debian]
@ -284,10 +284,10 @@ Then check/modify also the user/date signature:
- Name and email must match value into debian/control file (Entry added here is used by next step).
To update dolibarr debian package when only files into debian has changed
To update dolibarr debian package when only files into debian has changed, or if you include manually backport:
* Change files and commit.
* Add a tag debian/x.y.z+dfsgw-2 (increase the last 1 into 2)
* Add a tag debian/x.y.z+dfsgw-2 (increase the last 1 into 2, 3...)
Once files has been prepared, it's time to test:

66
composer.lock generated
View File

@ -4,7 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "f441e6348ae7862942693cab10810418",
"hash": "d88b5c84a9ea1af354d867ba2e2ab251",
"content-hash": "85e60ec7f8ab593387c7bd10d8db860d",
"packages": [
{
"name": "ccampbell/chromephp",
@ -126,6 +127,64 @@
"homepage": "https://github.com/firephp/firephp-core",
"time": "2013-04-23 15:28:20"
},
{
"name": "mike42/escpos-php",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/mike42/escpos-php.git",
"reference": "0564ff94de45564221eca99c4cd5ab24492894c2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/0564ff94de45564221eca99c4cd5ab24492894c2",
"reference": "0564ff94de45564221eca99c4cd5ab24492894c2",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "4.5.*"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roni Saha",
"email": "roni.cse@gmail.com"
},
{
"name": "Michael Billington",
"email": "michael.billington@gmail.com"
},
{
"name": "Gergely Radics",
"email": "gerifield@ustream.tv"
},
{
"name": "Warren Doyle",
"email": "w.doyle@fuelled.co"
},
{
"name": "vharo",
"email": "vharo@geepok.com"
}
],
"description": "Thermal receipt printer library, for use with ESC/POS compatible printers",
"homepage": "https://github.com/mike42/escpos-php",
"keywords": [
"ESC-POS",
"driver",
"escpos",
"print",
"receipt"
],
"time": "2015-11-02 10:50:46"
},
{
"name": "mobiledetect/mobiledetectlib",
"version": "2.8.3",
@ -424,13 +483,16 @@
"pdf417",
"qrcode"
],
"abandoned": "tecnickcom/tcpdf",
"time": "2015-01-28 18:51:40"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"mike42/escpos-php": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {

View File

@ -19,8 +19,8 @@
*/
/**
* \file dev/intdata/generate-facture.php
* \brief Script de generation de donnees aleatoires pour les factures
* \file dev/intdata/generate-invoice.php
* \brief Script example to inject random customer invoices (for load tests)
*/
// Test si mode batch

View File

@ -20,8 +20,8 @@
*/
/**
* \file dev/initdata/generate-commande.php
* \brief Script de generation de donnees aleatoires pour les commandes
* \file dev/initdata/generate-order.php
* \brief Script example to inject random orders (for load tests)
*/
// Test si mode batch

View File

@ -20,8 +20,8 @@
*/
/**
* \file dev/initdata/generate-produit.php
* \brief Script de generation de donnees aleatoires pour les produits
* \file dev/initdata/generate-product.php
* \brief Script example to inject random products (for load tests)
*/
// Test si mode batch

View File

@ -20,8 +20,8 @@
*/
/**
* \file dev/initdata/generate-propale.php
* \brief Script de generation de donnees aleatoires pour les propales
* \file dev/initdata/generate-proposal.php
* \brief Script example to inject random proposals (for load tests)
*/
// Test si mode batch

View File

@ -20,8 +20,8 @@
*/
/**
* \file dev/initdata/generate-societe.php
* \brief Script de generation de donnees aleatoires pour les societes
* \file dev/initdata/generate-thirdparty.php
* \brief Script example to inject random thirdparties (for load tests)
*/
// Test si mode batch

View File

@ -15,6 +15,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*
* Get a distant dump file and load it into a mysql database
*/
$sapi_type = php_sapi_name();
@ -32,9 +34,10 @@ $error=0;
$sourceserver=isset($argv[1])?$argv[1]:''; // user@server:/src/file
$password=isset($argv[2])?$argv[2]:'';
$database=isset($argv[3])?$argv[3]:'';
$loginbase=isset($argv[4])?$argv[4]:'';
$passwordbase=isset($argv[5])?$argv[5]:'';
$dataserver=isset($argv[3])?$argv[3]:'';
$database=isset($argv[4])?$argv[4]:'';
$loginbase=isset($argv[5])?$argv[5]:'';
$passwordbase=isset($argv[6])?$argv[6]:'';
// Include Dolibarr environment
$res=0;
@ -64,7 +67,7 @@ if (preg_match('/^(.*)@(.*):(.*)$/',$sourceserver,$reg))
}
if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile) || empty($password) || empty($database) || empty($loginbase) || empty($passwordbase))
{
print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh database loginbase passbase\n";
print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh databaseserver databasename loginbase passbase\n";
print "Return code: 0 if success, <>0 if error\n";
print "Warning, this script may take a long time.\n";
exit(-1);
@ -108,14 +111,14 @@ if ($connection)
print 'Get file '.$sourcefile.' into '.$targetdir.$targetfile."\n";
ssh2_scp_recv($connection, $sourcefile, $targetdir.$targetfile);
$fullcommand="cat ".$targetdir.$targetfile." | mysql -u".$loginbase." -p".$passwordbase." -D ".$database;
$fullcommand="cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
if (preg_match('/\.bz2$/',$targetfile))
{
$fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -u".$loginbase." -p".$passwordbase." -D ".$database;
$fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
}
if (preg_match('/\.gz$/',$targetfile))
{
$fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -u".$loginbase." -p".$passwordbase." -D ".$database;
$fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
}
print "Load dump with ".$fullcommand."\n";
$output=array();

View File

@ -619,17 +619,28 @@ foreach ($skeletonfiles as $skeletonfile => $outfile)
$targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print '<td>'.\$obj->field1.'</td>';",'/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print '<td>'.\$obj->field2.'</td>';",'/').'/', '', $targetcontent);
// LIST_OF_TD_LABEL_FIELDS_CREATE and EDIT - List of td for card view
// LIST_OF_TD_LABEL_FIELDS_CREATE - List of td for card view
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field".$prop['field']."\").'</td><td><input class=\"flat\" type=\"text\" name=\"".$prop['field']."\" value=\"'.\$".$prop['field'].".'\"></td></tr>';\n";
$varprop.="print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field".$prop['field']."\").'</td><td><input class=\"flat\" type=\"text\" name=\"".$prop['field']."\" value=\"'.GETPOST('".$prop['field']."').'\"></td></tr>';\n";
}
}
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_CREATE/', $varprop, $targetcontent);
// LIST_OF_TD_LABEL_FIELDS_EDIT - List of td for card view
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field".$prop['field']."\").'</td><td><input class=\"flat\" type=\"text\" name=\"".$prop['field']."\" value=\"'.\$object->".$prop['field'].".'\"></td></tr>';\n";
}
}
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_EDIT/', $varprop, $targetcontent);
// LIST_OF_TD_LABEL_FIELDS_VIEW - List of td for card view

View File

@ -281,12 +281,17 @@ if (($id || $ref) && $action == 'edit')
// Part to show record
if ($id && (empty($action) || $action == 'view'))
if ($id && (empty($action) || $action == 'view' || $action == 'delete'))
{
print load_fiche_titre($langs->trans("MyModule"));
dol_fiche_head();
if ($action == 'delete') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
print '<table class="border centpercent">'."\n";
// print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input class="flat" type="text" size="36" name="label" value="'.$label.'"></td></tr>';
// LIST_OF_TD_LABEL_FIELDS_VIEW
@ -310,14 +315,7 @@ if ($id && (empty($action) || $action == 'view'))
if ($user->rights->mymodule->delete)
{
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile
{
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
}
else
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
}
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
}
}
print '</div>'."\n";

View File

@ -96,6 +96,23 @@ if (($id > 0 || ! empty($ref)) && $action != 'add')
if ($result < 0) dol_print_error($db);
}
// Definition of fields for list
$arrayfields=array(
't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1),
't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1),
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
//'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
@ -267,22 +284,6 @@ if ($resql)
print '</div>';
}
$arrayfields=array(
't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1),
't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1),
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
//'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields

View File

@ -162,7 +162,7 @@ foreach($dirbarcode as $reldir)
{
$filebis=$reg[1];
// Chargement de la classe de codage
// Loading encoding class
require_once $newdir.$file;
$classname = "mod".ucfirst($filebis);
$module = new $classname($db);

View File

@ -510,7 +510,7 @@ if ($id == 10)
}
// Actions ajout ou modification d'une entree dans un dictionnaire de donnee
// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd') || GETPOST('actionmodify'))
{
$listfield=explode(',',$tabfield[$id]);
@ -581,7 +581,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
}
}
if ($id == 3 && ! is_numeric($_POST["code"]))
{
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric",$langs->transnoentities("Code")), null, 'errors');
}
// Clean some parameters
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0

View File

@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir)
$classname = preg_replace('/\-.*$/','',$classname);
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
{
// Chargement de la classe de numerotation
// Charging the numbering class
require_once $dir.$filebis;
$module = new $classname($db);

View File

@ -27,6 +27,13 @@ require '../main.inc.php';
// required Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$langs->load("admin");
$langs->load("oauth");
@ -36,6 +43,8 @@ if (!$user->admin)
$action = GETPOST('action', 'alpha');
// Supported OAUTH
$supportedoauth2array=array('OAUTH_GOOGLE_NAME');
// API access parameters OAUTH
$list = array (
array(
@ -297,11 +306,7 @@ print '<input type="hidden" name="action" value="update">';
dol_fiche_head(array(), '', '', 0, 'technic');
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
print $langs->trans("ListOfSupportedOauthProviders").'<br><br>';
print '<table class="noborder" width="100%">';
@ -309,12 +314,16 @@ $var = true;
foreach ($list as $key)
{
$supported=0;
if (in_array($key[0], $supportedoauth2array)) $supported=1;
if (! $supported) continue; // show only supported
print '<tr class="liste_titre">';
// Api Name
$label = $langs->trans($key[0]);
print '<td colspan="2">'.$label.'</td></tr>';
if (in_array($key[0], array('OAUTH_GOOGLE_NAME')))
if ($supported)
{
$redirect_uri=$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php';
$var = !$var;

View File

@ -130,7 +130,7 @@ foreach ($dirmodels as $reldir)
$classname = preg_replace('/\-.*$/','',$classname);
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
{
// Chargement de la classe de numerotation
// Charging the numbering class
require_once $dir.$filebis;
$module = new $classname($db);

View File

@ -221,7 +221,7 @@ if (is_resource($handle))
{
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg))
{
// Chargement de la classe de numerotation
// Charging the numbering class
$classname = $reg[1];
require_once $dir.'/'.$file;

View File

@ -101,12 +101,12 @@ if ($action == 'update' && $user->rights->categorie->creer)
}
else
{
setEventMessage($categorie->error, 'errors');
setEventMessages($categorie->error, $categorie->errors, 'errors');
}
}
else
{
setEventMessage($categorie->error, 'errors');
setEventMessages($categorie->error, $categorie->errors, 'errors');
}
}

View File

@ -95,7 +95,7 @@ $cancel != $langs->trans("Cancel") &&
else
{
$action = 'add';
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -128,7 +128,7 @@ $cancel != $langs->trans("Cancel") &&
else
{
$action = 'edit';
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}

View File

@ -122,7 +122,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -137,13 +137,13 @@ if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory'
$result=$object->add_type($newobject,$elementtype);
if ($result >= 0)
{
setEventMessage($langs->trans("WasAddedSuccessfully",$newobject->ref));
setEventMessages($langs->trans("WasAddedSuccessfully",$newobject->ref), null, 'mesgs');
}
else
{
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings');
setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
}
else
{

View File

@ -62,7 +62,7 @@ if ($action == 'builddoc')
$result=$cat->write_file(GETPOST('id','int'));
if ($result < 0)
{
setEventMessage($cat->error, 'errors');
setEventMessages($cat->error, $cat->errors, 'errors');
}
}

View File

@ -106,7 +106,7 @@ if ($action == 'add' || $action == 'update')
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='create';
}
}
@ -147,7 +147,7 @@ if ($action == 'add' || $action == 'update')
else
{
$reload = 0;
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action= "edit";
}
}

View File

@ -105,7 +105,7 @@ if (empty($reshook))
$result=$object->fetch($id);
$object->code_compta=$_POST["customeraccountancycode"];
$result=$object->update($object->id,$user,1,1,0);
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// conditions de reglement
@ -113,7 +113,7 @@ if (empty($reshook))
{
$object->fetch($id);
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// mode de reglement
@ -121,7 +121,7 @@ if (empty($reshook))
{
$object->fetch($id);
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// assujetissement a la TVA
@ -130,7 +130,7 @@ if (empty($reshook))
$object->fetch($id);
$object->tva_assuj=$_POST['assujtva_value'];
$result=$object->update($object->id);
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// set prospect level
@ -139,7 +139,7 @@ if (empty($reshook))
$object->fetch($id);
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
$result=$object->set_prospect_level($user);
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// set communication status
@ -148,7 +148,7 @@ if (empty($reshook))
$object->fetch($id);
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
$result=$object->set_commnucation_level($user);
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// update outstandng limit
@ -157,7 +157,7 @@ if (empty($reshook))
$object->fetch($id);
$object->outstanding_limit=GETPOST('outstanding_limit');
$result=$object->set_OutstandingBill($user);
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
}

View File

@ -117,7 +117,7 @@ if (empty($reshook))
{
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
{
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
}
else
{
@ -129,7 +129,7 @@ if (empty($reshook))
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
$action='';
@ -141,14 +141,14 @@ if (empty($reshook))
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{
// As security measure, we don't allow send from the GUI
setEventMessage($langs->trans("MailingNeedCommand"), 'warnings');
setEventMessage('<textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', 'warnings');
setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings');
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
setEventMessages('<textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings');
$action='';
}
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
{
setEventMessage($langs->trans("NotEnoughPermissions"), 'warnings');
setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings');
$action='';
}
else
@ -351,27 +351,27 @@ if (empty($reshook))
}
else
{
setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"));
setEventMessages($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"), null, 'mesgs');
}
// Loop finished, set global statut of mail
if ($nbko > 0)
{
$statut=2; // Status 'sent partially' (because at least one error)
if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
else setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
}
else
{
if ($nbok >= $num)
{
$statut=3; // Send to everybody
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
}
else
{
$statut=2; // Status 'sent partially' (because not send to everybody)
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
}
}
@ -443,11 +443,11 @@ if (empty($reshook))
$result=$mailfile->sendfile();
if ($result)
{
setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)));
setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, 'errors');
setEventMessages($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, null, 'errors');
}
$action='';
@ -488,7 +488,7 @@ if (empty($reshook))
$mesgs[] = $object->error;
}
setEventMessage($mesgs, 'errors');
setEventMessages($mesg, $mesgs, 'errors');
$action="create";
}
@ -518,7 +518,7 @@ if (empty($reshook))
$mesg = $object->error;
}
setEventMessage($mesg, 'errors');
setEventMessages($mesg, $mesgs, 'errors');
$action="";
}
@ -582,7 +582,7 @@ if (empty($reshook))
$mesgs[] =$object->error;
}
setEventMessage($mesgs, 'errors');
setEventMessages($mesg, $mesgs, 'errors');
$action="edit";
}
else
@ -597,7 +597,7 @@ if (empty($reshook))
if ($object->id > 0)
{
$object->valid($user);
setEventMessage($langs->trans("MailingSuccessfullyValidated"));
setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
@ -628,7 +628,7 @@ if (empty($reshook))
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
}
}
@ -764,18 +764,18 @@ else
// You ensure that every user is using its own SMTP server.
$linktoadminemailbefore='<a href="'.DOL_URL_ROOT.'/admin/mails.php">';
$linktoadminemailend='</a>';
setEventMessage($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), 'warnings');
setEventMessage($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), 'warnings');
if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessage($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), 'warnings');
setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings');
setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings');
if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
$_GET["action"]='';
}
else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message
setEventMessage($langs->trans("MailingNeedCommand"), 'warnings');
setEventMessage('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', 'warnings');
setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings');
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
setEventMessages('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings');
$_GET["action"]='';
}
else

View File

@ -80,7 +80,7 @@ if ($action == 'add')
//print $dir."\n<br>";
dol_syslog("Scan directory ".$dir." for modules");
// Chargement de la classe
// Loading Class
$file = $dir."/".$module.".modules.php";
$classname = "mailing_".$module;
@ -100,24 +100,24 @@ if ($action == 'add')
}
if ($result > 0)
{
setEventMessage($langs->trans("XTargetsAdded",$result),'mesgs');
setEventMessages($langs->trans("XTargetsAdded",$result), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
if ($result == 0)
{
setEventMessage($langs->trans("WarningNoEMailsAdded"),'warnings');
setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings');
}
if ($result < 0)
{
setEventMessage($langs->trans("Error").($obj->error?' '.$obj->error:''),'errors');
setEventMessages($langs->trans("Error").($obj->error?' '.$obj->error:''), null, 'errors');
}
}
if (GETPOST('clearlist'))
{
// Chargement de la classe
// Loading Class
$obj = new MailingTargets($db);
$obj->clear_target($id);
@ -267,7 +267,7 @@ if ($object->fetch($id) >= 0)
// Loop on each submodule
foreach($modulenames as $modulename)
{
// Chargement de la classe
// Loading Class
$file = $dir.$modulename.".modules.php";
$classname = "mailing_".$modulename;
require_once $file;

View File

@ -83,7 +83,7 @@ if (is_resource($handle))
$modulename=$reg[1];
if ($modulename == 'example') continue;
// Chargement de la classe
// Loading Class
$file = $dir."/".$modulename.".modules.php";
$classname = "mailing_".$modulename;
require_once $file;

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2010-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
@ -131,7 +131,7 @@ if (empty($reshook))
{
if (! GETPOST('socid', 3))
{
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
}
else
{
@ -141,7 +141,7 @@ if (empty($reshook))
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
exit();
} else {
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}
@ -157,7 +157,7 @@ if (empty($reshook))
exit();
} else {
$langs->load("errors");
setEventMessage($langs->trans($object->error), 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -211,8 +211,8 @@ if (empty($reshook))
}
} else {
$langs->load("errors");
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
else setEventMessage($langs->trans($object->error), 'errors');
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
else setEventMessages($langs->trans($object->error), null, 'errors');
}
}
@ -318,7 +318,7 @@ if (empty($reshook))
$id = $object->create_from($user);
} else {
setEventMessage($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), 'errors');
setEventMessages($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), null, 'errors');
}
} else {
$object->ref = GETPOST('ref');
@ -507,7 +507,7 @@ if (empty($reshook))
if ($result < 0)
{
$error++;
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors');
}
}
@ -671,7 +671,7 @@ if (empty($reshook))
if ($object->id > 0) {
$result = $object->insert_discount($_POST["remise_id"]);
if ($result < 0) {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -875,7 +875,7 @@ if (empty($reshook))
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
setEventMessage($mesg, 'errors');
setEventMessages($mesg, null, 'errors');
} else {
// Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit);
@ -929,13 +929,13 @@ if (empty($reshook))
} else {
$db->rollback();
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
}
// Mise a jour d'une ligne dans la propale
// Update a line within proposal
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save'))
{
// Define info_bits
@ -991,7 +991,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors');
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error ++;
}
} else {
@ -1040,7 +1040,7 @@ if (empty($reshook))
} else {
$db->rollback();
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -1137,9 +1137,9 @@ if (empty($reshook))
} else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} else {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -1636,13 +1636,13 @@ if ($action == 'create')
else if ($action == 'validate') {
$error = 0;
// on verifie si l'objet est en numerotation provisoire
// We verifie whether the object is provisionally numbering
$ref = substr($object->ref, 1, 4);
if ($ref == 'PROV') {
$numref = $object->getNextNumRef($soc);
if (empty($numref)) {
$error ++;
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
$numref = $object->ref;

View File

@ -375,13 +375,15 @@ class Propal extends CommonObject
* @param int $date_end End date of the line
* @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param string $origin 'order', ...
* @param int $origin_id Id of origin object
* @return int >0 if OK, <0 if KO
*
* @see add_product
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null)
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0)
{
global $mysoc;
global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -499,6 +501,9 @@ class Propal extends CommonObject
$this->line->fk_fournprice = $fk_fournprice;
$this->line->pa_ht = $pa_ht;
$this->line->origin_id = $origin_id;
$this->line->origin = $origin;
// Mise en option de la ligne
if (empty($qty) && empty($special_code)) $this->line->special_code=3;
@ -570,7 +575,8 @@ class Propal extends CommonObject
{
global $mysoc;
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$a_ht, type=$type, date_start=$date_start, date_end=$date_end");
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
@ -894,7 +900,9 @@ class Propal extends CommonObject
$this->lines[$i]->date_start,
$this->lines[$i]->date_end,
$this->lines[$i]->array_options,
$this->lines[$i]->fk_unit
$this->lines[$i]->fk_unit,
$this->element,
$this->lines[$i]->id
);
if ($result < 0)
@ -1384,7 +1392,10 @@ class Propal extends CommonObject
*/
function update_extrafields($user)
{
global $conf, $hookmanager;
$action='update';
$error = 0;
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
@ -2717,7 +2728,7 @@ class Propal extends CommonObject
*/
function getNomUrl($withpicto=0,$option='', $get_params='')
{
global $langs;
global $langs, $conf;
$result='';
$label = '<u>' . $langs->trans("ShowPropal") . '</u>';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
@ -54,12 +54,12 @@ if ($id > 0 || ! empty($ref))
if ($ret == 0)
{
$langs->load("errors");
setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
$error++;
}
else if ($ret < 0)
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
@ -75,7 +75,7 @@ else
/*
* Ajout d'un nouveau contact
* Add a new contact
*/
if ($action == 'addcontact' && $user->rights->propale->creer)
@ -96,16 +96,16 @@ if ($action == 'addcontact' && $user->rights->propale->creer)
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
// Bascule du statut d'un contact
// Toggle the status of a contact
else if ($action == 'swapstatut' && $user->rights->propale->creer)
{
if ($object->id > 0)
@ -114,7 +114,7 @@ else if ($action == 'swapstatut' && $user->rights->propale->creer)
}
}
// Efface un contact
// Deletes a contact
else if ($action == 'deletecontact' && $user->rights->propale->creer)
{
$result = $object->delete_contact($lineid);

View File

@ -65,17 +65,17 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
if (! $res > 0)
{
$error++;
setEventMessage($langs->trans("ErrorFailedToLoadDiscount"), 'errors');
setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors');
}
if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc)
{
$error++;
setEventMessage($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), 'errors');
setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors');
}
if (! $error && $discount->fk_facture_line)
{
$error++;
setEventMessage($langs->trans("ErrorCantSplitAUsedDiscount"), 'errors');
setEventMessages($langs->trans("ErrorCantSplitAUsedDiscount"), null, 'errors');
}
if (! $error)
{
@ -166,13 +166,13 @@ if ($action == 'setremise')
else
{
$error++;
setEventMessage($soc->error, 'errors');
setEventMessages($soc->error, $soc->errors, 'errors');
}
}
}
else
{
setEventMessage($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), 'errors');
setEventMessages($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), null, 'errors');
}
}
@ -194,7 +194,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes')
}
else
{
setEventMessage($discount->error, 'errors');
setEventMessages($discount->error, $discount->errors, 'errors');
$db->rollback();
}
}
@ -216,7 +216,7 @@ if ($socid > 0)
$object->fetch($socid);
/*
* Affichage onglets
* Display tabs
*/
$head = societe_prepare_head($object);
@ -300,7 +300,7 @@ if ($socid > 0)
}
/*
* Liste remises fixes restant en cours (= liees a acune facture ni ligne de facture)
* Liste remises fixes restant en cours (= liees a aucune facture ni ligne de facture)
*/
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql.= " rc.datec as dc, rc.description,";

View File

@ -5,10 +5,10 @@
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
@ -123,7 +123,7 @@ if (empty($reshook))
{
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
}
else
{
@ -140,7 +140,7 @@ if (empty($reshook))
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$object = $orig;
$action='';
}
@ -176,7 +176,7 @@ if (empty($reshook))
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -224,7 +224,7 @@ if (empty($reshook))
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
if ($datecommande == '') {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), 'errors');
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
$action = 'create';
$error++;
}
@ -373,11 +373,11 @@ if (empty($reshook))
if ($reshook < 0)
$error++;
} else {
setEventMessage($srcobject->error, 'errors');
setEventMessages($srcobject->error, $srcobject->errors, 'errors');
$error++;
}
} else {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else {
@ -413,7 +413,7 @@ if (empty($reshook))
{
$result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external');
if ($result < 0) {
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors');
$error++;
}
}
@ -431,7 +431,7 @@ if (empty($reshook))
} else {
$db->rollback();
$action = 'create';
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -441,7 +441,7 @@ if (empty($reshook))
$ret=$object->classifyBilled();
if ($ret < 0) {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -594,11 +594,11 @@ if (empty($reshook))
}
if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) {
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
@ -607,11 +607,11 @@ if (empty($reshook))
$error++;
}
if ($qty == '') {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
$error++;
}
@ -672,7 +672,7 @@ if (empty($reshook))
}
else
{
setEventMessage($prodcustprice->error,'errors');
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
}
@ -756,7 +756,7 @@ if (empty($reshook))
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
setEventMessage($mesg, 'errors');
setEventMessages($mesg, null, 'errors');
} else {
// Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit);
@ -810,7 +810,7 @@ if (empty($reshook))
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
} else {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -874,7 +874,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors');
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}
} else {
@ -922,7 +922,7 @@ if (empty($reshook))
unset($_POST['fournprice']);
unset($_POST['buying_price']);
} else {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -955,7 +955,7 @@ if (empty($reshook))
if (! $idwarehouse || $idwarehouse == -1)
{
$error++;
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action='';
}
}
@ -1008,7 +1008,7 @@ if (empty($reshook))
if (! $idwarehouse || $idwarehouse == -1)
{
$error++;
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action='';
}
}
@ -1040,7 +1040,7 @@ if (empty($reshook))
else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
$result = $object->cloture($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors(), 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -1067,7 +1067,7 @@ if (empty($reshook))
if (! $idwarehouse || $idwarehouse == -1)
{
$error++;
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), 'errors');
setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$action='';
}
}
@ -1076,7 +1076,7 @@ if (empty($reshook))
$result = $object->cancel($idwarehouse);
if ($result < 0) {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -1123,9 +1123,9 @@ if (empty($reshook))
$file = $upload_dir . '/' . GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret)
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action = '';
}
}
@ -1189,9 +1189,9 @@ if (empty($reshook))
} else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} else {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

View File

@ -777,7 +777,9 @@ class Commande extends CommonOrder
$this->lines[$i]->pa_ht,
$this->lines[$i]->label,
$this->lines[$i]->array_options,
$this->lines[$i]->fk_unit
$this->lines[$i]->fk_unit,
$this->element,
$this->lines[$i]->id
);
if ($result < 0)
{
@ -2322,6 +2324,7 @@ class Commande extends CommonOrder
function classifyBilled()
{
global $conf, $user, $langs;
$error = 0;
$this->db->begin();
@ -2636,6 +2639,7 @@ class Commande extends CommonOrder
global $hookmanager, $conf;
$action='create';
$error = 0;
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
@ -2872,7 +2876,7 @@ class Commande extends CommonOrder
*/
function LibStatut($statut,$billed,$mode)
{
global $langs;
global $langs, $conf;
//print 'x'.$statut.'-'.$billed;
if ($mode == 0)
{

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
@ -69,11 +69,11 @@ if ($action == 'addcontact' && $user->rights->commande->creer)
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

View File

@ -74,7 +74,7 @@ if ($action == 'create')
if (is_array($selected) == false)
{
$error++;
setEventMessage($langs->trans('Error_OrderNotChecked'), 'errors');
setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors');
}
else
{
@ -251,7 +251,7 @@ if (($action == 'create' || $action == 'add') && !$error)
}
else
{
setEventMessage($discount->error, 'errors');
setEventMessages($discount->error, $discount->errors, 'errors');
$error++;
break;
}
@ -320,7 +320,7 @@ if (($action == 'create' || $action == 'add') && !$error)
}
else
{
setEventMessage($objectsrc->error, 'errors');
setEventMessages($objectsrc->error, $objectsrc->errors, 'errors');
$error++;
}
$ii++;
@ -328,7 +328,7 @@ if (($action == 'create' || $action == 'add') && !$error)
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
@ -348,7 +348,7 @@ if (($action == 'create' || $action == 'add') && !$error)
$action='create';
$_GET["origin"]=$_POST["origin"];
$_GET["originid"]=$_POST["originid"];
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}

View File

@ -152,13 +152,13 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user);
if ($insertid > 0)
{
setEventMessage($langs->trans("RecordSaved"));
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id."&action=addline");
exit;
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
@ -378,19 +378,6 @@ if ($id > 0 || ! empty($ref))
{
print '<div class="tabsAction">';
if ($object->type != 2 && $object->rappro)
{
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
}
if ($action != 'addline')
{
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
@ -409,6 +396,20 @@ if ($id > 0 || ! empty($ref))
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
if ($object->type != 2 && $object->rappro)
{
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
}
print '</div>';
}

View File

@ -291,7 +291,7 @@ if ($result < 0)
{
$langs->load("errors");
$error++;
setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors');
setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors');
}
else
{

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -102,19 +102,19 @@ if ($_POST["action"] == 'add')
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
{
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), 'error');
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
$action='create'; // Force chargement page en mode creation
$error++;
}
if (empty($account->ref))
{
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), 'errors');
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
$action='create'; // Force chargement page en mode creation
$error++;
}
if (empty($account->label))
{
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), 'errors');
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
$action='create'; // Force chargement page en mode creation
$error++;
}
@ -130,7 +130,7 @@ if ($_POST["action"] == 'add')
$_GET["id"]=$id; // Force chargement page en mode visu
}
else {
setEventMessage($account->error,'errors');
setEventMessages($account->error, $account->errors, 'errors');
$action='create'; // Force chargement page en mode creation
}
}
@ -177,19 +177,19 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
{
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), 'error');
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error');
$action='edit'; // Force chargement page en mode creation
$error++;
}
if (empty($account->ref))
{
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), 'errors');
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors');
$action='edit'; // Force chargement page en mode creation
$error++;
}
if (empty($account->label))
{
setEventMessage($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), 'errors');
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
$action='edit'; // Force chargement page en mode creation
$error++;
}
@ -206,7 +206,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
}
else
{
setEventMessage($account->error, 'errors');
setEventMessages($account->error, $account->errors, 'errors');
$action='edit'; // Force chargement page edition
}
}

View File

@ -998,7 +998,12 @@ class Account extends CommonObject
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
$linkend='</a>';
}
else if ($mode == 'receipts')
{
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id.$linkclose;
$linkend='</a>';
}
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
$result.=$link.$this->label.$linkend;
return $result;

View File

@ -133,9 +133,9 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') {
$ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) {
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
} else {
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);

View File

@ -81,7 +81,7 @@ if ($result < 0)
{
$langs->load("errors");
$error++;
setEventMessage($langs->trans("ErrorFailedToCreateDir"), 'errors');
setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors');
}
else
{
@ -113,7 +113,7 @@ else
if ($mode == 'standard')
{
// Chargement du tableau $amounts
// Loading table $amounts
$amounts = array();
$monthnext = $month+1;
@ -153,7 +153,7 @@ else
dol_print_error($db);
}
// Calcul de $solde avant le debut du graphe
// Calculation of $solde before the start of the graph
$solde = 0;
$sql = "SELECT SUM(b.amount)";
@ -265,7 +265,7 @@ else
if ($mode == 'standard')
{
// Chargement du tableau $amounts
// Loading table $amounts
$amounts = array();
$sql = "SELECT date_format(b.datev,'%Y%m%d')";
$sql.= ", SUM(b.amount)";
@ -296,7 +296,7 @@ else
dol_print_error($db);
}
// Calcul de $solde avant le debut du graphe
// Calculation of $solde before the start of the graph
$solde = 0;
$sql = "SELECT SUM(b.amount)";
@ -403,7 +403,7 @@ else
if ($mode == 'showalltime')
{
// Chargement du tableau $amounts
// Loading table $amounts
$amounts = array();
$sql = "SELECT date_format(b.datev,'%Y%m%d')";

View File

@ -113,7 +113,7 @@ foreach ($accounts as $key=>$type)
{
$result=$acc->load_board($user,$acc->id);
if ($result<0) {
setEventMessage($acc->error, 'errors');
setEventMessages($acc->error, $acc->errors, 'errors');
} else {
print $result->nbtodo;
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
@ -229,7 +229,7 @@ foreach ($accounts as $key=>$type)
{
$result=$acc->load_board($user,$acc->id);
if ($result<0) {
setEventMessage($acc->error, 'errors');
setEventMessages($acc->error, $acc->errors, 'errors');
} else {
print $result->nbtodo;
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@ -104,7 +104,7 @@ if ($user->rights->banque->modifier && $action == "update")
if ($ac->courant == 2 && $_POST['value'] != 'LIQ')
{
setEventMessage($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), 'errors');
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
$error++;
}
@ -146,7 +146,7 @@ if ($user->rights->banque->modifier && $action == "update")
$result = $db->query($sql);
if ($result)
{
setEventMessage($langs->trans("RecordSaved"));
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$db->commit();
}
else
@ -184,7 +184,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
$result = $db->query($sql);
if ($result)
{
setEventMessage($langs->trans("RecordSaved"));
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$db->commit();
}
else
@ -205,7 +205,7 @@ $form = new Form($db);
llxHeader();
// On initialise la liste des categories
// The list of categories is initialized
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " ORDER BY label";
@ -587,7 +587,7 @@ if ($result)
if ($user->rights->banque->consolidate)
{
print '<td colspan="3">';
print '<input type="checkbox" name="reconciled" class="flat" '.(isset($_POST["reconciled"])?($_POST["reconciled"]?' checked':''):($objp->rappro?' checked':'')).'">';
print '<input type="checkbox" name="reconciled" class="flat" '.(isset($_POST["reconciled"])?($_POST["reconciled"]?' checked="checked"':''):($objp->rappro?' checked="checked"':'')).'">';
print '</td>';
}
else

View File

@ -71,7 +71,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
$result=$bankline->update_conciliation($user,$_POST["cat"]);
if ($result < 0)
{
setEventMessage($bankline->error, 'errors');
setEventMessages($bankline->error, $bankline->errors, 'errors');
$error++;
break;
}
@ -83,7 +83,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
{
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorPleaseTypeBankTransactionReportName"), 'errors');
setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors');
}
if (! $error)
@ -186,7 +186,7 @@ if ($resql)
print '<br>';
// Show last bank receipts
$nbmax=5;
$nbmax=15; // We accept to show last 15 receipts (so we can have more than one year)
$liste="";
$sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank";
$sql.= " WHERE fk_account=".$acct->id." AND num_releve IS NOT NULL";
@ -226,7 +226,7 @@ if ($resql)
print '<input type="hidden" name="account" value="'.$acct->id.'">';
print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
print '<input class="flat" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):$last_releve).'" size="10">';
print '<input class="flat" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
print '<br>';
if ($options)
{

View File

@ -157,6 +157,7 @@ if (empty($num))
}
print '</div>';
print '<br><br>';
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$object->id, $sortfield, $sortorder,'',$numrows);
@ -282,10 +283,15 @@ else
$found=true;
}
$mesprevnext ="<a href=\"releve.php?rel=prev&amp;num=$num&amp;ve=$ve&amp;account=$object->id\">".img_previous()."</a> &nbsp;";
$mesprevnext.= $langs->trans("AccountStatement")." $num";
$mesprevnext.=" &nbsp; <a href=\"releve.php?rel=next&amp;num=$num&amp;ve=$ve&amp;account=$object->id\">".img_next()."</a>";
print load_fiche_titre($langs->trans("AccountStatement").' '.$num.', '.$langs->trans("BankAccount").' : '.$object->getNomUrl(0),$mesprevnext, 'title_bank.png');
$mesprevnext='';
$mesprevnext.='<div class="pagination"><ul>';
$mesprevnext.='<li class="pagination"><a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?rel=prev&amp;num='.$num.'&amp;ve='.$ve.'&amp;account='.$object->id.'"><</a></li>';
//$mesprevnext.=' &nbsp; ';
$mesprevnext.='<li class="pagination"><span class="inactive">'.$langs->trans("AccountStatement")." ".$num.'</span></li>';
//$mesprevnext.=' &nbsp; ';
$mesprevnext.='<li class="pagination"><a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?rel=next&amp;num='.$num.'&amp;ve='.$ve.'&amp;account='.$object->id.'">></a></li>';
$mesprevnext.='</ul></div>';
print load_fiche_titre($langs->trans("AccountStatement").' '.$num.', '.$langs->trans("BankAccount").' : '.$object->getNomUrl(0, 'receipts'), $mesprevnext, 'title_bank.png');
print '<br>';
print "<form method=\"post\" action=\"releve.php\">";

View File

@ -113,18 +113,18 @@ if ($action == 'add')
if (! $error)
{
$mesgs = $langs->trans("TransferFromToDone","<a href=\"account.php?account=".$accountfrom->id."\">".$accountfrom->label."</a>","<a href=\"account.php?account=".$accountto->id."\">".$accountto->label."</a>",$amount,$langs->transnoentities("Currency".$conf->currency));
setEventMessage($mesgs);
setEventMessages($mesgs, null, 'mesgs');
$db->commit();
}
else
{
setEventMessage($accountfrom->error.' '.$accountto->error, 'errors');
setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors');
$db->rollback();
}
}
else
{
setEventMessage($langs->trans("ErrorFromToAccountsMustDiffers"), 'errors');
setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers"), null, 'errors');
}
}
}
@ -132,7 +132,7 @@ if ($action == 'add')
/*
* Affichage
* View
*/
llxHeader();

View File

@ -63,6 +63,7 @@ class Facture extends CommonInvoice
var $author;
var $fk_user_author;
var $fk_user_valid;
var $date; // Date invoice
var $date_creation; // Creation date
var $date_validation; // Validation date
var $datem;
@ -385,6 +386,8 @@ class Facture extends CommonInvoice
{
$newinvoiceline=$this->lines[$i];
$newinvoiceline->fk_facture=$this->id;
$newinvoiceline->origin = $this->element;
$newinvoiceline->origin_id = $this->lines[$i]->id;
if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
{
// Reset fk_parent_line for no child products and special product
@ -441,8 +444,8 @@ class Facture extends CommonInvoice
$this->lines[$i]->product_type,
$this->lines[$i]->rang,
$this->lines[$i]->special_code,
'',
0,
$this->element,
$this->lines[$i]->id,
$fk_parent_line,
$this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht,
@ -873,7 +876,7 @@ class Facture extends CommonInvoice
*/
function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='')
{
global $langs;
global $langs, $conf;
$result='';

View File

@ -415,7 +415,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
$datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment);
$form->select_date($datepayment,'','','',0,"add_paiement",1,1);
$form->select_date($datepayment,'','','',0,"add_paiement",1,1,0,0,'','',$facture->date);
print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>';

View File

@ -122,6 +122,34 @@ $fieldstosearchall = array(
's.nom'=>"ThirdParty",
);
// Definition of fields for list
$arrayfields=array(
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'p.firstname'=>array('label'=>$langs->trans("Firsname"), 'checked'=>1),
'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1),
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
'p.phone'=>array('label'=>$langs->trans("PhonePro"), 'checked'=>1),
'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1),
'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1),
'p.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
/*
* Actions
@ -386,35 +414,10 @@ if ($result)
print '</div>';
}
$arrayfields=array(
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'p.firstname'=>array('label'=>$langs->trans("Firsname"), 'checked'=>1),
'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1),
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
'p.phone'=>array('label'=>$langs->trans("PhonePro"), 'checked'=>1),
'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1),
'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1),
'p.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
// Ligne des titres
print '<tr class="liste_titre">';

View File

@ -258,7 +258,7 @@ class ExtraFields
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
{
if(is_array($param) and count($param) > 0)
if(is_array($param) && count($param) > 0)
{
$params = $this->db->escape(serialize($param));
}

View File

@ -1546,7 +1546,7 @@ class Form
print img_picto($langs->trans("Search"), 'search');
}
}
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' autofocus />';
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
if ($hidelabel == 3) {
print img_picto($langs->trans("Search"), 'search');
}
@ -1663,7 +1663,7 @@ class Form
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
$num = $this->db->num_rows($result);
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'" autofocus>';
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
$out.='<option value="0" selected>&nbsp;</option>';
$i = 0;
@ -4057,10 +4057,11 @@ class Form
* @param int $disabled Disable input fields
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field.
* @param datetime $adddateof Add a link "Date of invoice" using the following date.
* @return mixed Nothing or string if nooutput is 1
* @see form_date
*/
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='')
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='')
{
global $conf,$langs;
@ -4318,6 +4319,13 @@ class Form
}
}
// Add a "Plus one hour" link
if ($conf->use_javascript_ajax && $adddateof)
{
$tmparray=dol_getdate($adddateof);
$retstring.=' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\''.dol_print_date($adddateof,'day').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$langs->trans("DateInvoice").'</a>';
}
if (! empty($nooutput)) return $retstring;
print $retstring;
@ -4513,22 +4521,26 @@ class Form
* @param string $morecss Add more class to css styles
* @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected.
* @param string $placeholder String to use as placeholder
* @return string HTML select string.
* @param string $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string
*/
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='')
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
{
global $langs;
global $delayedhtmlcontent;
$out = '';
$tmpplugin='select2';
$out.='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
$out='<input type="text" class="'.$htmlname.($morecss?' '.$morecss:'').'" '.($moreparam?$moreparam.' ':'').'name="'.$htmlname.'">';
// TODO Use an internal dolibarr component instead of select2
$outdelayed='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
<script type="text/javascript">
$(document).ready(function () {
'.($callurlonselect ? 'var saveRemoteData = [];':'').'
'.($callurlonselect ? 'var saveRemoteData = [];':'').'
$(".'.$htmlname.'").select2({
$(".'.$htmlname.'").select2({
ajax: {
dir: "ltr",
url: "'.$url.'",
@ -4584,12 +4596,17 @@ class Form
});
});' : '' ) . '
});
</script>';
});
</script>';
$out.='<input type="text" class="'.$htmlname.($morecss?' '.$morecss:'').'" '.($moreparam?$moreparam.' ':'').'name="'.$htmlname.'">';
if ($acceptdelayedhtml)
{
$delayedhtmlcontent.=$outdelayed;
}
else
{
$out.=$outdelayed;
}
return $out;
}
@ -5157,7 +5174,7 @@ class Form
* To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria.
*
* @param object $object Object to show
* @param string $paramid Name of parameter to use to name the id into the URL link
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
* @param string $morehtml More html content to output just before the nav bar
* @param int $shownav Show Condition (navigation is shown if value is 1)
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
@ -5192,7 +5209,7 @@ class Form
$ret.='<div class="inline-block floatleft valignmiddle refid'.(($shownav && ($previous_ref || $next_ref))?' refidpadding':'').'">';
// For thirdparty and contact, the ref is he id, so we show something else
// For thirdparty and contact, the ref is the id, so we show something else
if ($object->element == 'societe')
{
$ret.=dol_htmlentities($object->name);
@ -5360,7 +5377,7 @@ class Form
else
{
$nophoto='/public/theme/common/nophoto.png';
if (in_array($modulepart,array('userphoto','contact'))) // For module thar are "physical" users
if (in_array($modulepart,array('userphoto','contact'))) // For module that are "physical" users
{
$nophoto='/public/theme/common/user_anonymous.png';
if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png';

View File

@ -52,16 +52,13 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
// Remove product id before select another product
// use keyup instead change to avoid loosing the product id
$("input#search_'.$htmlname.'").keydown(function() {
//console.log(\'purge_id_after_keydown\');
$("#'.$htmlname.'").val("");
});
$("input#search_'.$htmlname.'").change(function() {
//console.log(\'change\');
$("#'.$htmlname.'").trigger("change");
});
// Check when keyup
$("input#search_'.$htmlname.'").keyup(function() {
//console.log(\'keyup\');
if ($(this).val().length == 0)
{
$("#search_'.$htmlname.'").val("");
@ -127,7 +124,6 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
dataType: "json",
minLength: '.$minLength.',
select: function( event, ui ) { // Function ran when new value is selected into javascript combo
//console.log(\'set value of id with \'+ui.item.id);
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
// Disable an element
if (options.option_disabled) {
@ -171,8 +167,6 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
}
});
}
console.log("ajax_autocompleter new value selected, we trigger change");
$("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified
}
,delay: 500
}).data("ui-autocomplete")._renderItem = function( ul, item ) {

View File

@ -106,7 +106,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
$ref_prodserv = "";
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
{
if ($prodser->isservice())
if ($prodser->isService())
{
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
}

View File

@ -854,7 +854,7 @@ function dol_get_fiche_end($notab=0)
* Show tab footer of a card
*
* @param object $object Object to show
* @param string $paramid Name of parameter to use to name the id into the URL link
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
* @param string $morehtml More html content to output just before the nav bar
* @param int $shownav Show Condition (navigation is shown if value is 1)
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
@ -870,28 +870,67 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
{
global $conf, $form, $user, $langs;
//$showlogo=$object->logo;
$showlogo=1;
$maxvisiblephotos=1;
$showimage=1;
$showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0);
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
$modulepart='societe';
$modulepart='unknown';
if ($object->element == 'societe') $modulepart='societe';
if ($object->element == 'contact') $modulepart='contact';
if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
print '<div class="arearef heightref valignmiddle" width="100%">';
if ($showlogo) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showphoto($modulepart,$object,0,0,0,'photoref').'</div>';
if ($object->element == 'product')
{
$width=80; $cssclass='photoref';
$showimage=$object->is_photo_available($conf->product->multidir_output[$object->entity]);
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
if ($conf->browser->phone) $maxvisiblephotos=1;
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos($conf->product->multidir_output[$object->entity],1,-$maxvisiblephotos,0,0,0,$width,0).'</div>';
else
{
$nophoto='/public/theme/common/nophoto.png';
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
}
}
else
{
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showphoto($modulepart,$object,0,0,0,'photoref','',1,0,$maxvisiblephotos).'</div>';
}
if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlright.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
} else {
}
elseif ($object->element == 'product')
{
//$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Sell").') ';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlright.=ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
$morehtmlright.=$object->getLibStatut(2,0);
}
$morehtmlright.=' &nbsp; ';
//$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Buy").') ';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlright.=ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
$morehtmlright.=$object->getLibStatut(2,1);
}
}
else {
$morehtmlright.=$object->getLibStatut(2);
}
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>';
$morehtmlref.='<div class="refidno">';
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
$morehtmlref.='</div>';
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member')))
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>'; // For product
if ($object->element != 'product')
{
$morehtmlref.='<div class="refidno">';
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
$morehtmlref.='</div>';
}
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product')))
{
$morehtmlref.='<div style="clear: both;"></div><div class="refidno">';
$morehtmlref.=$langs->trans("TechnicalID").': '.$object->id;
@ -5154,6 +5193,10 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
{
global $db,$langs;
if ($mode == 0)
{
$value=preg_replace('/\*/','%',$value); // Replace * with %
}
if ($mode == 1)
{
$value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
@ -5225,17 +5268,17 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
/**
* Return the filename of file to get the thumbs
*
* @param string $file Original filename
* @param string $file Original filename (full or relative path)
* @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini')
* @param string $extImgTarget Force image format for thumbs. Use '' to keep same extension than original image.
* @return string New file name
* @param string $extImgTarget Force image extension for thumbs. Use '' to keep same extension than original image.
* @return string New file name (full or relative path, including the thumbs/)
*/
function getImageFileNameForSize($file, $extName, $extImgTarget='')
{
$dirName = dirname($file);
if ($dirName == '.') $dirName='';
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // We remove extension, whatever is its case
$fileName = basename($fileName);
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpg$/i',$file)?'.jpg':'');
@ -5249,5 +5292,5 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
$subdir='';
if ($extName) $subdir = 'thumbs/';
return $dirName.$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
return ($dirName?$dirName.'/':'').$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
}

View File

@ -101,7 +101,7 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
curl_setopt($ch, CURLOPT_POST, 0); // GET
}
//if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
//if USE_PROXY constant set at begin of this method.
if ($USE_PROXY)
{
dol_syslog("getURLContent set proxy to ".$PROXY_HOST. ":" . $PROXY_PORT." - ".$PROXY_USER. ":" . $PROXY_PASS);

View File

@ -512,7 +512,9 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse
$fileName = basename($fileName);
$imgThumbName = $dirthumb.'/'.getImageFileNameForSize($file, $extName, $extImgTarget); // Chemin complet du fichier de la vignette
//$imgThumbName = $dirthumb.'/'.getImageFileNameForSize(basename($file), $extName, $extImgTarget); // Full path of thumb file
$imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file
// Check if permission are ok
//$fp = fopen($imgThumbName, "w");

View File

@ -1166,7 +1166,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
$ref_prodserv = "";
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
{
if ($prodser->isservice())
if ($prodser->isService())
{
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
}

View File

@ -98,7 +98,7 @@ function product_prepare_head($object)
$head[$h][2] = 'referers';
$h++;
if ($object->isproduct() || ($object->isservice() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option)
if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option)
{
if (! empty($conf->stock->enabled) && $user->rights->stock->lire)
{

View File

@ -98,12 +98,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?leftmenu=product&amp;type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?type=0', 'Stocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?type=0', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/popuprop.php?leftmenu=stats&amp;type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stats/card.php?id=all&amp;leftmenu=stats&amp;type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 6, __ENTITY__);
-- Product - Services
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?leftmenu=service&amp;type=1', 'Services', 0, 'products', '$user->rights->service->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2901__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/card.php?leftmenu=service&amp;action=create&amp;type=1', 'NewService', 1, 'products', '$user->rights->service->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2902__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/list.php?leftmenu=service&amp;type=1', 'List', 1, 'products', '$user->rights->service->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2903__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/popuprop.php?leftmenu=stats&amp;type=1', 'Statistics', 1, 'main', '$user->rights->service->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2903__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/stats/card.php?id=all&amp;leftmenu=stats&amp;type=1', 'Statistics', 1, 'main', '$user->rights->service->lire', '', 2, 5, __ENTITY__);
-- Product - Stocks
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/stock/index.php?leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__);

View File

@ -1088,7 +1088,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
if (! empty($conf->propal->enabled))
{
$newmenu->add("/product/popuprop.php?leftmenu=stats&amp;type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire);
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire);
}
}
@ -1100,7 +1100,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/product/list.php?leftmenu=service&amp;type=1", $langs->trans("List"), 1, $user->rights->service->lire);
if (! empty($conf->propal->enabled))
{
$newmenu->add("/product/popuprop.php?leftmenu=stats&amp;type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire && $user->rights->propale->lire);
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire && $user->rights->propale->lire);
}
}

View File

@ -64,7 +64,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
{
$moduleid=$reg[1];
// Chargement de la classe
// Loading Class
$file = $dir."/export_".$moduleid.".modules.php";
$classname = "Export".ucfirst($moduleid);

View File

@ -84,7 +84,7 @@ class ModeleImports
{
$moduleid=$reg[1];
// Chargement de la classe
// Loading Class
$file = $dir."/import_".$moduleid.".modules.php";
$classname = "Import".ucfirst($moduleid);

View File

@ -51,7 +51,7 @@ class modOauth extends DolibarrModules
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Enable OAuth authentication";
$this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version
$this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
$this->special = 1;

View File

@ -30,14 +30,25 @@ use OAuth\Common\Consumer\Credentials;
use OAuth\Common\Token\TokenInterface;
use OAuth\OAuth2\Service\Google;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$action = GETPOST('action', 'alpha');
$backtourl = GETPOST('backtourl', 'alpha');
/**
* Create a new instance of the URI class with the current URI, stripping the query string
*/
$uriFactory = new \OAuth\Common\Http\Uri\UriFactory();
$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER);
$currentUri->setQuery('');
//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER);
//$currentUri->setQuery('');
$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php');
/**
* Load the credential for the service
@ -45,8 +56,15 @@ $currentUri->setQuery('');
/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */
$serviceFactory = new \OAuth\ServiceFactory();
$httpClient = new \OAuth\Common\Http\Client\CurlClient();
// TODO Set options for proxy and timeout
// $params=array('CURLXXX'=>value, ...)
//$httpClient->setCurlParameters($params);
$serviceFactory->setHttpClient($httpClient);
// Dolibarr storage
$storage = new DoliStorage($db, $conf);
// Setup the credentials for the requests
$credentials = new Credentials(
$conf->global->OAUTH_GOOGLE_ID,
@ -54,6 +72,7 @@ $credentials = new Credentials(
$currentUri->getAbsoluteUri()
);
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
/** @var $apiService Service */
// TODO remove hardcoded array
@ -61,80 +80,71 @@ $apiService = $serviceFactory->createService('Google', $credentials, $storage, a
// access type needed for google refresh token
$apiService->setAccessType('offline');
if ($action == 'delete') {
// delete token
llxHeader('',$langs->trans("OAuthSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup');
dol_fiche_head();
$langs->load("oauth");
/*
* Actions
*/
if ($action == 'delete')
{
$storage->clearToken('Google');
dol_fiche_end();
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
header('Location: ' . $backtourl);
exit();
}
if (! empty($_GET['code'])) // We are coming from Google oauth page
{
//llxHeader('',$langs->trans("OAuthSetup"));
} elseif (! empty($_GET['code'])) {
llxHeader('',$langs->trans("OAuthSetup"));
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
//print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup');
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup');
dol_fiche_head();
//dol_fiche_head();
// retrieve the CSRF state parameter
$state = isset($_GET['state']) ? $_GET['state'] : null;
print '<table>';
// looking for a token already stored in db
//try {
// $token = $storage->retrieveAccessToken('Google');
// $old_token=1;
//} catch (Exception $e) {
// $old_token=0;
//}
//if ($old_token==1) {
// print '<tr><td>'.$langs->trans('OldTokenStored').'</td><td></td></tr>';
// print '<tr><td><pre>'.print_r($token,true).'</pre></td></tr>';
//}
//$refreshtoken = $token->getRefreshToken();
//print '<table>';
// This was a callback request from service, get the token
try {
$apiService->requestAccessToken($_GET['code'], $state);
//var_dump($_GET['code']);
//var_dump($state);
//var_dump($apiService); // OAuth\OAuth2\Service\Google
$token = $apiService->requestAccessToken($_GET['code'], $state);
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs');
} catch (Exception $e) {
print $e->getMessage();
}
//print '<pre>'.print_r($apiService,true).'</pre>';
// retrieve new token in db
try {
$token = $storage->retrieveAccessToken('Google');
$new_token=1;
} catch (Exception $e) {
$new_token=0;
}
$newrefreshtoken = $token->getRefreshToken();
if (empty($newrefreshtoken) && ! empty($refreshtoken)) {
$token->setRefreshToken($refreshtoken);
$storage->storeAccessToken('Google', $token);
}
if ($new_token==1) {
print '<tr><td>'.$langs->trans('NewTokenStored').'</td><td></td></tr>';
print '<tr><td><pre>'.print_r($token,true).'</pre></td></tr>';
}
//print '<td><pre>'.print_r($token,true).'</pre></td>';
//$apiService->refreshAccessToken($token);
//print '<pre>'.print_r($apiService,true).'</pre>';
//$token = $storage->retrieveAccessToken('Google');
//print '<td><pre>'.print_r($token,true).'</pre></td>';
print '<td><a href="https://security.google.com/settings/security/permissions" target="_blank">Applications associées à votre compte</a></td>';
print '</table>';
dol_fiche_end();
} else {
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
header('Location: ' . $backtourl);
exit();
}
else
{
$_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
$url = $apiService->getAuthorizationUri();
// we go on google authorization page
header('Location: ' . $url);
exit();
}
llxFooter();
/*
* View
*/
// No view at all, just actions
$db->close();

View File

@ -87,6 +87,8 @@ class printing_printgcp extends PrintingDriver
$this->errors[] = $e->getMessage();
$token_ok = false;
}
//var_dump($this->errors);exit;
$expire = false;
// Is token expired or will token expire in the next 30 seconds
if ($token_ok) {
@ -116,12 +118,12 @@ class printing_printgcp extends PrintingDriver
$refreshtoken = $token->getRefreshToken();
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_REFRESH', 'info'=>((! empty($refreshtoken))?'Yes':'No'), 'type'=>'info');
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_EXPIRED', 'info'=>($expire?'Yes':'No'), 'type'=>'info');
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_EXPIRE_AT', 'info'=>(date("Y-m-d H:i:s", $token->getEndOfLife())), 'type'=>'info');
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_EXPIRE_AT', 'info'=>(dol_print_date($token->getEndOfLife(), "dayhour")), 'type'=>'info');
}
if (!$storage->hasAccessToken('Google')) {
$this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php', 'type'=>'authlink');
$this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink');
} else {
$this->conf[] = array('varname'=>'PRINTGCP_DELETE_TOKEN', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?action=delete', 'type'=>'delete');
$this->conf[] = array('varname'=>'PRINTGCP_DELETE_TOKEN', 'link'=>$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'delete');
}
} else {
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthNotConfigured', 'type'=>'info');

View File

@ -94,8 +94,8 @@ class pdf_beluga extends ModelePDFProjects
$this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+25;
$this->posxsociety=$this->marge_gauche+45;
$this->posxamountht=$this->marge_gauche+115;
$this->posxamountttc=$this->marge_gauche+140;
$this->posxamountht=$this->marge_gauche+110;
$this->posxamountttc=$this->marge_gauche+135;
$this->posxstatut=$this->marge_gauche+165;
}
@ -231,14 +231,16 @@ class pdf_beluga extends ModelePDFProjects
'class'=>'Propal',
'table'=>'propal',
'datefieldname'=>'datep',
'test'=>$conf->propal->enabled && $user->rights->propale->lire),
'test'=>$conf->propal->enabled && $user->rights->propale->lire,
'lang'=>'propal'),
'order'=>array(
'name'=>"CustomersOrders",
'title'=>"ListOrdersAssociatedProject",
'class'=>'Commande',
'table'=>'commande',
'datefieldname'=>'date_commande',
'test'=>$conf->commande->enabled && $user->rights->commande->lire),
'test'=>$conf->commande->enabled && $user->rights->commande->lire,
'lang'=>'order'),
'invoice'=>array(
'name'=>"CustomersInvoices",
'title'=>"ListInvoicesAssociatedProject",
@ -246,21 +248,24 @@ class pdf_beluga extends ModelePDFProjects
'margin'=>'add',
'table'=>'facture',
'datefieldname'=>'datef',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'test'=>$conf->facture->enabled && $user->rights->facture->lire,
'lang'=>'bills'),
'invoice_predefined'=>array(
'name'=>"PredefinedInvoices",
'title'=>"ListPredefinedInvoicesAssociatedProject",
'class'=>'FactureRec',
'table'=>'facture_rec',
'datefieldname'=>'datec',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'test'=>$conf->facture->enabled && $user->rights->facture->lire,
'lang'=>'bills'),
'order_supplier'=>array(
'name'=>"SuppliersOrders",
'title'=>"ListSupplierOrdersAssociatedProject",
'class'=>'CommandeFournisseur',
'table'=>'commande_fournisseur',
'datefieldname'=>'date_commande',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire),
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire,
'lang'=>'orders'),
'invoice_supplier'=>array(
'name'=>"BillsSuppliers",
'title'=>"ListSupplierInvoicesAssociatedProject",
@ -268,14 +273,16 @@ class pdf_beluga extends ModelePDFProjects
'margin'=>'minus',
'table'=>'facture_fourn',
'datefieldname'=>'datef',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire),
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire,
'lang'=>'bills'),
'contract'=>array(
'name'=>"Contracts",
'title'=>"ListContractAssociatedProject",
'class'=>'Contrat',
'table'=>'contrat',
'datefieldname'=>'date_contrat',
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire,
'lang'=>'contract'),
'intervention'=>array(
'name'=>"Interventions",
'title'=>"ListFichinterAssociatedProject",
@ -283,7 +290,8 @@ class pdf_beluga extends ModelePDFProjects
'table'=>'fichinter',
'datefieldname'=>'date_valid',
'disableamount'=>1,
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire,
'lang'=>'interventions'),
'trip'=>array(
'name'=>"TripsAndExpenses",
'title'=>"ListTripAssociatedProject",
@ -292,7 +300,18 @@ class pdf_beluga extends ModelePDFProjects
'datefieldname'=>'dated',
'margin'=>'minus',
'disableamount'=>1,
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire,
'lang'=>'trip'),
'expensereport'=>array(
'name'=>"ExpensesReports",
'title'=>"ListTripAssociatedProject",
'class'=>'ExpenseReport',
'table'=>'expensereport',
'datefieldname'=>'dated',
'margin'=>'minus',
'disableamount'=>1,
'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire,
'lang'=>'trip'),
'agenda'=>array(
'name'=>"Agenda",
'title'=>"ListActionsAssociatedProject",
@ -300,7 +319,8 @@ class pdf_beluga extends ModelePDFProjects
'table'=>'actioncomm',
'datefieldname'=>'datep',
'disableamount'=>1,
'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire)
'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->read,
'lang'=>'agenda')
);
@ -311,12 +331,17 @@ class pdf_beluga extends ModelePDFProjects
$tablename=$value['table'];
$datefieldname=$value['datefieldname'];
$qualified=$value['test'];
$langstoload=$value['lang'];
$langs->load($langstoload);
if ($qualified)
{
//var_dump("$key, $tablename, $datefieldname, $dates, $datee");
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
//var_dump($elementarray);
$num = count($elementarray);
if ($num > 0)
if ($num >= 0)
{
$nexY = $pdf->GetY() + 5;
$curY = $nexY;
@ -334,9 +359,9 @@ class pdf_beluga extends ModelePDFProjects
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $outputlangs->transnoentities("ThirdParty"), 1, 'L');
if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities("AmountHT"), 1, 'R');
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities("AmountHTShort"), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, $outputlangs->transnoentities("AmountTTC"), 1, 'R');
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, $outputlangs->transnoentities("AmountTTCShort"), 1, 'R');
} else {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
@ -434,8 +459,6 @@ class pdf_beluga extends ModelePDFProjects
}
}
/*
* Pied de page
*/

View File

@ -5,6 +5,7 @@
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@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
@ -315,14 +316,39 @@ else {
<?php
if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
{
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
else $colspan = 9;
if($this->situation_cycle_ref) $colspan++;
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
if (in_array($object->element,array('propal','askpricesupplier','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
$colspan = 6;
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$colspan++;
}
if ($this->situation_cycle_ref) {
$colspan++;
}
// We add 1 if col total ttc
if (!empty($inputalsopricewithtax)) {
$colspan++;
}
if ($conf->global->PRODUCT_USE_UNITS) {
$colspan++;
}
if (count($object->lines)) {
//There will be an edit and a delete button
$colspan += 2;
// With this, there is a column move button ONLY if lines > 1
if (in_array($object->element, array(
'propal',
'askpricesupplier',
'facture',
'invoice',
'commande',
'order',
'order_supplier',
'invoice_supplier'
))) {
$colspan++;
}
}
if (! empty($usemargins))
{
@ -497,7 +523,6 @@ jQuery(document).ready(function() {
/* When changing predefined product, we reload list of supplier prices */
$("#idprod, #idprodfournprice").change(function()
{
console.log("change #idprod, #idprodfournprice, conf->global->MARGIN_TYPE=<?php echo $conf->global->MARGIN_TYPE ?>");
setforpredef();
jQuery('#trlinefordates').show();

View File

@ -107,7 +107,7 @@ class Export
if ($enabled)
{
// Chargement de la classe
// Loading Class
$file = $dir.$modulename.".class.php";
$classname = $modulename;
require_once $file;

View File

@ -273,7 +273,7 @@ if ($resql)
if ($search_all)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall));
print $langs->transnoentities("FilterOnInto", $search_all, join(', ',$fieldstosearchall));
}
print '<table class="liste" width="100%">';

View File

@ -257,7 +257,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture);
$sql = 'SELECT s.nom as name, s.rowid as socid,';
$sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total';
$sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total, fk_mode_reglement, fk_account';
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f';
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -292,11 +292,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print $supplierstatic->getNomUrl(1,'supplier');
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
$form->select_date($dateinvoice,'','','','',"addpaiement",1,1);
$form->select_date($dateinvoice,'','','','',"addpaiement",1,1,0,0,'','',$object->date);
print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('PaymentMode').'</td><td>';
$form->select_types_paiements(empty($_POST['paiementid'])?'':$_POST['paiementid'],'paiementid');
$form->select_types_paiements(empty($_POST['paiementid'])?$obj->fk_mode_reglement:$_POST['paiementid'],'paiementid');
print '</td>';
print '<td rowspan="3" valign="top">';
print '<textarea name="comment" wrap="soft" cols="60" rows="'.ROWS_3.'">'.(empty($_POST['comment'])?'':$_POST['comment']).'</textarea></td></tr>';
@ -304,7 +304,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if (! empty($conf->banque->enabled))
{
print '<tr><td class="fieldrequired">'.$langs->trans('Account').'</td><td>';
$form->select_comptes(empty($accountid)?'':$accountid,'accountid',0,'',2);
$form->select_comptes(empty($accountid)?$obj->fk_account:$accountid,'accountid',0,'',2);
print '</td></tr>';
}
else

View File

@ -33,9 +33,13 @@ if (! $user->admin)
$error=0;
$action = GETPOST('action', 'alpha');
$object = new Establishment($db);
// List of statut
static $tmpstatus2label=array(
'0'=>'OpenEtablishment',
'1'=>'CloseEtablishment'
);
$status2label=array('');
foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val);
/*
* Actions
@ -44,10 +48,24 @@ $object = new Establishment($db);
/*
* View
*/
$page_name = "Establishments";
llxHeader('', $langs->trans($page_name));
llxHeader('', $langs->trans("Establishments"));
$sortorder = GETPOST("sortorder");
$sortfield = GETPOST("sortfield");
if (!$sortorder) $sortorder="DESC";
if (!$sortfield) $sortfield="e.rowid";
if ($page == -1) {
$page = 0 ;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
$form = new Form($db);
$establishmenttmp=new Establishment($db);
dol_htmloutput_mesg($mesg);
@ -62,43 +80,50 @@ dol_fiche_head($head, 'establishments', $langs->trans("HRM"), 0, "user");
$sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status";
$sql.= " FROM ".MAIN_DB_PREFIX."establishment as e";
$sql.= " WHERE e.entity = ".$conf->entity;
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql);
if ($result)
{
$var=false;
$num = $db->num_rows($result);
$i = 0;
$num = $db->num_rows($result);
$i = 0;
// Load attribute_label
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Ref").'</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Address").'</td>';
print '<td>'.$langs->trans("Zipcode").'</td>';
print '<td>'.$langs->trans("Town").'</td>';
print '<td align="right">'.$langs->trans("Status").'</td>';
print '</tr>';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"e.name","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Address"),$_SERVER["PHP_SELF"],"e.address","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Zipcode"),$_SERVER["PHP_SELF"],"e.zip","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"e.town","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"e.status","","",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
if ($num)
$var=true;
if ($num > 0)
{
$establishmentstatic=new Establishment($db);
while ($i < $num && $i < $max)
{
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
$fiscalyearstatic->id=$obj->rowid;
print '<tr '.$bc[$var].'>';
print '<td><a href="admin_establishment_card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowEstablishment"),"building").' '.$obj->rowid.'</a></td>';
print '<td align="left">'.$obj->name.'</td>';
$establishmentstatic->id=$obj->rowid;
$establishmentstatic->name=$obj->name;
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$establishmentstatic->getNomUrl(1).'</td>';
print '<td align="left">'.$obj->address.'</td>';
print '<td align="left">'.$obj->zip.'</td>';
print '<td align="left">'.$obj->town.'</td>';
print '<td align="right">'.$establishmentstatic->LibStatut($obj->status,5).'</td>';
print '</tr>';
$var=!$var;
print '<td align="right">';
print $establishmenttmp->getLibStatus(5);
print '</td>';
print "</tr>\n";
$i++;
}

View File

@ -67,26 +67,41 @@ class Employee extends CommonObject
* @param int $id Id of record to load
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
function fetch($id='')
{
$sql = "SELECT rowid, firstname, lastname, status, fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."user";
global $conf, $user;
$sql = "SELECT e.rowid, e.firstname, e.lastname, e.gender, e.email, e.statut, e.entity, e.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."user as e";
$sql.= " WHERE rowid = ".$id;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
if ( $result )
if ($result)
{
$obj = $this->db->fetch_object($result);
if ($obj)
{
$this->id = $obj->rowid;
$this->lastname = $obj->lastname;
$this->firstname = $obj->firstname;
$this->gender = $obj->gender;
$this->address = $obj->address;
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->statut = $obj->statut;
$this->photo = $obj->photo;
$this->id = $obj->rowid;
$this->name = $obj->name;
$this->address = $obj->address;
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->status = $obj->status;
$this->db->free($result);
}
else
{
$this->error="EMPLOYEENOTFOUND";
dol_syslog(get_class($this)."::fetch user not found", LOG_DEBUG);
return 1;
$this->db->free($result);
return 0;
}
}
else
{

View File

@ -34,6 +34,7 @@ class Establishment extends CommonObject
public $fk_element = 'fk_establishment';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id;
var $rowid;
var $name;
@ -43,6 +44,8 @@ class Establishment extends CommonObject
var $status; // 0=open, 1=closed
var $entity;
var $country_id;
var $statuts=array();
var $statuts_short=array();
@ -69,12 +72,18 @@ class Establishment extends CommonObject
*/
function create($user)
{
global $conf;
global $conf, $langs;
$error = 0;
$ret = 0;
$now=dol_now();
// Clean parameters
$this->address=($this->address>0?$this->address:$this->address);
$this->zip=($this->zip>0?$this->zip:$this->zip);
$this->town=($this->town>0?$this->town:$this->town);
$this->country_id=($this->country_id>0?$this->country_id:$this->country_id);
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."establishment (";
@ -83,22 +92,22 @@ class Establishment extends CommonObject
$sql.= ", zip";
$sql.= ", town";
$sql.= ", status";
$sql.= ", fk_country";
$sql.= ", entity";
$sql.= ", datec";
$sql.= ", fk_user_author";
$sql.= ") VALUES (";
$sql.= " '".$this->name."'";
$sql.= ", '".$this->address."'";
$sql.= ", '".$this->zip."'";
$sql.= ", '".$this->town."'";
$sql.= " '".$this->db->escape($this->name)."'";
$sql.= ", '".$this->db->escape($this->address)."'";
$sql.= ", '".$this->db->escape($this->zip)."'";
$sql.= ", '".$this->db->escape($this->town)."'";
$sql.= ", ".$this->country_id;
$sql.= ", ".$this->status;
$sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ". $user->id;
$sql.= ")";
$this->db->begin();
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) {
@ -148,6 +157,7 @@ class Establishment extends CommonObject
$sql .= ", address = '".$this->address."'";
$sql .= ", zip = '".$this->zip."'";
$sql .= ", town = '".$this->town."'";
$sql .= ", status = '".$this->status."'";
$sql .= ", fk_user_mod = " . $user->id;
$sql .= " WHERE rowid = ".$this->id;
@ -172,9 +182,11 @@ class Establishment extends CommonObject
*/
function fetch($id)
{
$sql = "SELECT rowid, name, address, zip, town, status";
$sql.= " FROM ".MAIN_DB_PREFIX."establishment";
$sql.= " WHERE rowid = ".$id;
$sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id,";
$sql.= ' c.code as country_code, c.label as country';
$sql.= " FROM ".MAIN_DB_PREFIX."establishment as e";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON e.fk_country = c.rowid';
$sql.= " WHERE e.rowid = ".$id;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
@ -189,6 +201,10 @@ class Establishment extends CommonObject
$this->town = $obj->town;
$this->status = $obj->status;
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_code;
$this->country = $obj->country;
return 1;
}
else
@ -257,23 +273,23 @@ class Establishment extends CommonObject
}
if ($mode == 2)
{
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'status4').' '.$langs->trans($this->statuts_short[$status]);
if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'status8').' '.$langs->trans($this->statuts_short[$status]);
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 ($mode == 3)
{
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status4');
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status8');
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 ($mode == 4)
{
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status4').' '.$langs->trans($this->statuts[$status]);
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status8').' '.$langs->trans($this->statuts[$status]);
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 ($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]),'status4');
if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'status8');
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');
}
}
@ -298,20 +314,22 @@ class Establishment extends CommonObject
{
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->date_creation = $this->db->jdate($obj->datec);
if ($obj->fk_user_author)
{
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif)
if ($obj->fk_user_mod)
{
$muser = new User($this->db);
$muser->fetch($obj->fk_user_mod);
$this->user_modification = $muser;
$this->date_modification = $this->db->jdate($obj->tms);
}
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms);
}
$this->db->free($result);
}
@ -321,4 +339,46 @@ class Establishment extends CommonObject
}
}
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string String with URL
*/
function getNomUrl($withpicto=0)
{
global $langs;
$result='';
$link = '<a href="'.DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$this->id.'">';
$linkend='</a>';
$picto='building';
$label=$langs->trans("Show").': '.$this->name;
if ($withpicto) $result.=($link.img_object($label,$picto).$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.$this->name.$linkend;
return $result;
}
/**
* Return account country code
*
* @return string country code
*/
function getCountryCode()
{
global $mysoc;
// We return country code of bank account
if (! empty($this->country_code)) return $this->country_code;
// We return country code of managed company
if (! empty($mysoc->country_code)) return $mysoc->country_code;
return '';
}
}

View File

@ -169,8 +169,8 @@ if ($result)
$employeestatic->email=$obj->email;
$employeestatic->gender=$obj->gender;
$employeestatic->societe_id=$obj->fk_soc;
$employeestatic->firstname='';
$employeestatic->lastname=$obj->login;
$userstatic->firstname=$obj->firstname;
$userstatic->lastname=$obj->lastname;
$li=$employeestatic->getNomUrl(1,'',0,0,24,1);

View File

@ -81,34 +81,27 @@ else if ($action == 'add')
if (empty($error))
{
$tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0);
if (! empty($tmparray['id']))
{
$object->country_id =$tmparray['id'];
$object->country_code =$tmparray['code'];
$object->country_label=$tmparray['label'];
}
$object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha');
$object->fk_pays = $object->country_id;
$object->country_id = $_POST["country_id"];
$object->status = GETPOST('status','int');
$object->fk_user_author = $user->id;
$object->datec = dol_now();
$id = $object->create($user);
if ($id > 0)
{
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit;
}
else
{
setEventMessage($object->error, 'errors');
$action='create';
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
{
@ -131,12 +124,7 @@ else if ($action == 'update')
$name = GETPOST('name', 'alpha');
if (empty($name)) {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('NameProperty')), 'errors');
$error ++;
}
$typeid = GETPOST('typeid', 'int');
if (empty($typeid)) {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('TypeProperty')), 'errors');
setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('Name')), 'errors');
$error ++;
}
@ -145,25 +133,23 @@ else if ($action == 'update')
$object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha');
$object->fk_pays = GETPOST('country_id', 'int');
$object->rowid = GETPOST('id');
$object->country_id = $_POST["country_id"];
$object->fk_user_mod = $user->id;
$id = $object->update();
$result = $object->update();
if ($id > 0)
if ($result > 0)
{
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $_POST['id']);
exit;
}
else
{
setEventMessage($object->error, 'errors');
$action='create';
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
} else {
header("Location: card.php?id=" . $id);
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $_POST['id']);
exit;
}
}
@ -193,11 +179,11 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Name
print '<tr><td class="fieldrequired"><label for="name">'.$langs->trans("Name").'</label></td><td><input name="name" id="name" size="32" value="' . GETPOST("name") . '"></td></tr>';
print '<tr><td>'. fieldLabel('Name','name',1).'</td><td><input name="name" id="name" size="32" value="' . GETPOST("name") . '"></td></tr>';
// Address
print '<tr>';
print '<td><label for="address">' . $langs->trans("Address") . '</label></td>';
print '<td>'.fieldLabel('Address','address',0).'</td>';
print '<td>';
print '<input name="address" id="address" size="32" value="' . $object->address . '">';
print '</td>';
@ -205,7 +191,7 @@ if ($action == 'create')
// Zipcode
print '<tr>';
print '<td><label for="zipcode">' . $langs->trans('Zip') . '</label></td>';
print '<td>'.fieldLabel('Zip','zipcode',0).'</td>';
print '<td>';
print $formcompany->select_ziptown(GETPOST('zipcode', 'alpha'), 'zipcode', array (
'town',
@ -216,7 +202,7 @@ if ($action == 'create')
// Town
print '<tr>';
print '<td><label for="town">' . $langs->trans('Town') . '</label></td>';
print '<td>'.fieldLabel('Town','town',0).'</td>';
print '<td>';
print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array (
'zipcode',
@ -227,7 +213,7 @@ if ($action == 'create')
// Country
print '<tr>';
print '<td><label for="selectcountry_id">' . $langs->trans("Country") . '</label></td>';
print '<td>'.fieldLabel('Country','selectcountry_id',0).'</td>';
print '<td class="maxwidthonsmartphone">';
print $form->select_country($mysoc->country_id,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
@ -236,7 +222,7 @@ if ($action == 'create')
// Status
print '<tr>';
print '<td class="fieldrequired"><label for="status">'.$langs->trans("Status").'</label></td>';
print '<td>'.fieldLabel('Status','status',1).'</td>';
print '<td>';
print $form->selectarray('status',$status2label,GETPOST('status'));
print '</td></tr>';
@ -273,46 +259,43 @@ else if ($id)
// Ref
print "<tr>";
print '<td width="20%">'.$langs->trans("Ref").'</td><td>';
print $object->rowid;
print '<td width="25%">'.$langs->trans("Ref").'</td><td>';
print $object->id;
print '</td></tr>';
// Name
print '<tr><td class="fieldrequired"><label for="name">'.$langs->trans("Name").'</label></td><td>';
print '<tr><td>'.fieldLabel('Name','name',1).'</td><td>';
print '<input name="name" id="name" class="flat" size="32" value="'.$object->name.'">';
print '</td></tr>';
// Address
print '<tr>';
print '<td><label for="address">' . $langs->trans("Address") . '</label></td>';
print '<tr><td>'.fieldLabel('Address','address',0).'</td>';
print '<td>';
print '<input name="address" id="address" size="32" value="' . $object->address . '">';
print '</td>';
print '</tr>';
print '</td></tr>';
// Zipcode / Town
print '<tr><td><label for="zipcode">' . $langs->trans('Zip') . '</label></td><td>';
print '<tr><td>'.fieldLabel('Zip','zipcode',0).'</td><td>';
print $formcompany->select_ziptown($object->zip, 'zipcode', array (
'town',
'selectcountry_id'
), 6) . '</tr>';
print '<tr><td><label for="town">' . $langs->trans('Town') . '</label></td><td>';
print '<tr><td>'.fieldLabel('Town','town',0).'</td><td>';
print $formcompany->select_ziptown($object->town, 'town', array (
'zipcode',
'selectcountry_id'
)) . '</td></tr>';
// Country
print '<tr>';
print '<td><label for="selectcountry_id">' . $langs->trans("Country") . '</label></td>';
print '<tr><td>'.fieldLabel('Country','selectcountry_id',0).'</td>';
print '<td class="maxwidthonsmartphone">';
print $form->select_country($object->fk_pays,'country_id');
print $form->select_country($object->fk_country,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td>';
print '</tr>';
// Status
print '<tr><td><label for="status">'.$langs->trans("Status").'</label></td><td>';
print '<tr><td>'.fieldLabel('Status','status',1).'</td><td>';
print $form->selectarray('status',$status2label,$object->status);
print '</td></tr>';
@ -347,7 +330,7 @@ else if ($id)
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td width="50%">';
print $object->rowid;
print $object->id;
print '</td><td width="25%">';
print $linkback;
print '</td></tr>';
@ -379,7 +362,14 @@ else if ($id)
// Country
print '<tr>';
print '<td>'.$langs->trans("Country").'</td>';
print '<td colspan="2">'.getCountry($object->fk_pays,1).'</td>';
print '<td colspan="2">';
if ($object->country_id > 0)
{
$img=picto_from_langcode($object->country_code);
print $img?$img.' ':'';
print getCountry($object->getCountryCode(),0,$db);
}
print '</td>';
print '</tr>';
// Status

View File

@ -22,6 +22,7 @@
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
$langs->load("admin");

View File

@ -86,6 +86,10 @@ class DoliStorage implements TokenStorageInterface
*/
public function storeAccessToken($service, TokenInterface $token)
{
//var_dump("storeAccessToken");
//var_dump($token);
dol_syslog("storeAccessToken");
$serializedToken = serialize($token);
$this->tokens[$service] = $token;
@ -95,6 +99,10 @@ class DoliStorage implements TokenStorageInterface
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."oauth_token";
$sql.= " WHERE service='".$service."' AND entity=1";
$resql = $this->db->query($sql);
if (! $resql)
{
dol_print_error($this->db);
}
$obj = $this->db->fetch_array($resql);
if ($obj) {
// update
@ -108,7 +116,8 @@ class DoliStorage implements TokenStorageInterface
$sql.= " VALUES ('".$service."', '".$this->db->escape($serializedToken)."', 1)";
$resql = $this->db->query($sql);
}
//print $sql;
// allow chaining
return $this;
}
@ -122,8 +131,13 @@ class DoliStorage implements TokenStorageInterface
$sql = "SELECT token FROM ".MAIN_DB_PREFIX."oauth_token";
$sql.= " WHERE service='".$service."'";
$resql = $this->db->query($sql);
if (! $resql)
{
dol_print_error($this->db);
}
$result = $this->db->fetch_array($resql);
$token = unserialize($result[token]);
$token = unserialize($result['token']);
$this->tokens[$service] = $token;
return is_array($this->tokens)
@ -194,6 +208,10 @@ class DoliStorage implements TokenStorageInterface
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."oauth_state";
$sql.= " WHERE service='".$service."' AND entity=1";
$resql = $this->db->query($sql);
if (! $resql)
{
dol_print_error($this->db);
}
$obj = $this->db->fetch_array($resql);
if ($obj) {
// update

View File

@ -18,6 +18,11 @@
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
-- Was done into a 3.8 fix, so we must do it also in 3.9
ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL DEFAULT 0 after country;
-- Fix bad data
update llx_opensurvey_sondage set format = 'D' where format = 'D+';
update llx_opensurvey_sondage set format = 'A' where format = 'A+';
@ -51,16 +56,17 @@ create table llx_overwrite_trans
transvalue text
)ENGINE=innodb;
ALTER TABLE llx_payment_salary ADD COLUMN datec datetime after tms;
ALTER TABLE llx_payment_salary ADD COLUMN datec datetime AFTER tms;
ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user_creat fk_user_author integer;
ALTER TABLE llx_adherent ADD COLUMN pass_crypted varchar(128) after pass;
ALTER TABLE llx_adherent ADD COLUMN pass_crypted varchar(128) AFTER pass;
ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL AFTER rowid;
ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL DEFAULT '' AFTER rowid;
ALTER TABLE llx_socpeople ADD COLUMN photo varchar(255) AFTER skype;
ALTER TABLE llx_user_param MODIFY COLUMN value text NOT NULL;
ALTER TABLE llx_user_param MODIFY COLUMN param varchar(255) NOT NULL DEFAULT '';
ALTER TABLE llx_user_param MODIFY COLUMN value text NOT NULL DEFAULT '';
ALTER TABLE llx_expedition ADD COLUMN import_key varchar(14);
ALTER TABLE llx_expedition ADD COLUMN extraparams varchar(255);
@ -71,7 +77,7 @@ ALTER TABLE llx_prelevement_lignes MODIFY COLUMN code_banque varchar(128);
ALTER TABLE llx_societe_rib MODIFY COLUMN code_banque varchar(128);
ALTER TABLE llx_contrat ADD COLUMN ref_customer varchar(30);
ALTER TABLE llx_commande ADD COLUMN fk_warehouse integer DEFAULT NULL after fk_shipping_method;
ALTER TABLE llx_commande ADD COLUMN fk_warehouse integer DEFAULT NULL AFTER fk_shipping_method;
ALTER TABLE llx_ecm_directories MODIFY COLUMN fullpath varchar(750);
ALTER TABLE llx_ecm_directories DROP INDEX idx_ecm_directories;
@ -102,20 +108,21 @@ ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (label, entity);
--ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files_fullpath(fullpath);
ALTER TABLE llx_product ADD COLUMN onportal tinyint DEFAULT 0 after tobuy;
ALTER TABLE llx_product ADD COLUMN onportal smallint DEFAULT 0 AFTER tobuy;
ALTER TABLE llx_user ADD COLUMN employee tinyint DEFAULT 1;
ALTER TABLE llx_user ADD COLUMN employee smallint DEFAULT 1 AFTER ref_int;
ALTER TABLE llx_user ADD COLUMN fk_establishment integer DEFAULT 0 AFTER employee;
CREATE TABLE IF NOT EXISTS llx_c_hrm_function
(
rowid integer PRIMARY KEY,
pos tinyint DEFAULT 0 NOT NULL,
pos smallint DEFAULT 0 NOT NULL,
code varchar(16) NOT NULL,
label varchar(50),
c_level tinyint DEFAULT 0 NOT NULL,
active tinyint DEFAULT 1 NOT NULL
c_level smallint DEFAULT 0 NOT NULL,
active smallint DEFAULT 1 NOT NULL
)ENGINE=innodb;
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(1, 5, 'EXECBOARD', 'Executive board', 0, 1);
@ -131,10 +138,10 @@ INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES
CREATE TABLE IF NOT EXISTS llx_c_hrm_department
(
rowid integer PRIMARY KEY,
pos tinyint DEFAULT 0 NOT NULL,
pos smallint DEFAULT 0 NOT NULL,
code varchar(16) NOT NULL,
label varchar(50),
active tinyint DEFAULT 1 NOT NULL
active smallint DEFAULT 1 NOT NULL
)ENGINE=innodb;
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(1, 5,'MANAGEMENT', 'Management', 1);
@ -173,7 +180,7 @@ CREATE TABLE IF NOT EXISTS llx_establishment (
fk_user_mod integer NOT NULL,
datec datetime NOT NULL,
tms timestamp NOT NULL,
status tinyint DEFAULT 1
status smallint DEFAULT 1
) ENGINE=InnoDB;
@ -221,7 +228,7 @@ create table llx_budget_lines
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_budget integer NOT NULL,
fk_project integer NOT NULL,
fk_project_ids varchar(255) NOT NULL, -- List of project ids related to this budget. If budget is dedicated to projects not yet started, we recommand to create a project "Projects to come".
amount double(24,8) NOT NULL,
datec datetime,
tms timestamp,
@ -230,13 +237,12 @@ create table llx_budget_lines
import_key integer
)ENGINE=innodb;
ALTER TABLE llx_budget_lines ADD UNIQUE INDEX uk_budget_lines (fk_budget, fk_project);
ALTER TABLE llx_budget_lines ADD UNIQUE INDEX uk_budget_lines (fk_budget, fk_project_ids);
-- Supprime orphelins pour permettre montee de la cle
-- MYSQL V4 DELETE llx_budget_lines FROM llx_budget_lines LEFT JOIN llx_budget ON llx_budget.rowid = llx_budget_lines.fk_budget WHERE llx_budget_lines.rowid IS NULL;
-- POSTGRESQL V8 DELETE FROM llx_budget_lines USING llx_budget WHERE llx_budget_lines.fk_budget NOT IN (SELECT llx_budget.rowid FROM llx_budget);
ALTER TABLE llx_budget_lines ADD INDEX idx_budget_lines (fk_project);
ALTER TABLE llx_budget_lines ADD CONSTRAINT fk_budget_lines_budget FOREIGN KEY (fk_budget) REFERENCES llx_budget (rowid);
@ -255,7 +261,7 @@ CREATE TABLE llx_product_pricerules
var_percent FLOAT NOT NULL, -- Price variation over based price
var_min_percent FLOAT NOT NULL -- Min price discount over general price
);
ALTER TABLE llx_product ADD COLUMN price_autogen TINYINT(1) DEFAULT 0;
ALTER TABLE llx_product ADD COLUMN price_autogen smallint DEFAULT 0;
ALTER TABLE llx_product_pricerules ADD CONSTRAINT unique_level UNIQUE (level);
@ -282,3 +288,23 @@ CREATE TABLE llx_opensurvey_user_formanswers (
) ENGINE=InnoDB;
create table llx_categorie_project
(
fk_categorie integer NOT NULL,
fk_project integer NOT NULL,
import_key varchar(14)
)ENGINE=innodb;
ALTER TABLE llx_categorie_project ADD PRIMARY KEY pk_categorie_project (fk_categorie, fk_project);
ALTER TABLE llx_categorie_project ADD INDEX idx_categorie_project_fk_categorie (fk_categorie);
ALTER TABLE llx_categorie_project ADD INDEX idx_categorie_project_fk_project (fk_project);
ALTER TABLE llx_categorie_project ADD CONSTRAINT fk_categorie_project_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
ALTER TABLE llx_categorie_project ADD CONSTRAINT fk_categorie_project_fk_project FOREIGN KEY (fk_project) REFERENCES llx_projet (rowid);

View File

@ -20,7 +20,7 @@ create table llx_budget
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer NOT NULL DEFAULT 1,
label varchar(255) NOT NULL,
label varchar(255) NOT NULL, -- For example 'Global budget for year' or 'Budget for each project'
status integer,
note text,
date_start date,

View File

@ -17,11 +17,10 @@
-- ===================================================================
ALTER TABLE llx_budget_lines ADD UNIQUE INDEX uk_budget_lines (fk_budget, fk_project);
ALTER TABLE llx_budget_lines ADD UNIQUE INDEX uk_budget_lines (fk_budget, fk_project_ids);
-- Supprime orphelins pour permettre montee de la cle
-- MYSQL V4 DELETE llx_budget_lines FROM llx_budget_lines LEFT JOIN llx_budget ON llx_budget.rowid = llx_budget_lines.fk_budget WHERE llx_budget_lines.rowid IS NULL;
-- POSTGRESQL V8 DELETE FROM llx_budget_lines USING llx_budget WHERE llx_budget_lines.fk_budget NOT IN (SELECT llx_budget.rowid FROM llx_budget);
ALTER TABLE llx_budget_lines ADD INDEX idx_budget_lines (fk_project);
ALTER TABLE llx_budget_lines ADD CONSTRAINT fk_budget_lines_budget FOREIGN KEY (fk_budget) REFERENCES llx_budget (rowid);

View File

@ -18,13 +18,13 @@
create table llx_budget_lines
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_budget integer NOT NULL,
fk_project integer NOT NULL,
amount double(24,8) NOT NULL,
datec datetime,
tms timestamp,
fk_user_creat integer,
fk_user_modif integer,
import_key integer
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_budget integer NOT NULL,
fk_project_ids varchar(255) NOT NULL, -- 'IDS:x,y' = List of project ids related to this budget. If budget is dedicated to projects not yet started, we recommand to create a project "Projects to come". 'FILTER:ref=*ABC' = Can also be a dynamic rule to select projects.
amount double(24,8) NOT NULL,
datec datetime,
tms timestamp,
fk_user_creat integer,
fk_user_modif integer,
import_key integer
)ENGINE=innodb;

View File

@ -0,0 +1,24 @@
-- ============================================================================
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ============================================================================
ALTER TABLE llx_categorie_project ADD PRIMARY KEY pk_categorie_project (fk_categorie, fk_project);
ALTER TABLE llx_categorie_project ADD INDEX idx_categorie_project_fk_categorie (fk_categorie);
ALTER TABLE llx_categorie_project ADD INDEX idx_categorie_project_fk_project (fk_project);
ALTER TABLE llx_categorie_project ADD CONSTRAINT fk_categorie_project_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
ALTER TABLE llx_categorie_project ADD CONSTRAINT fk_categorie_project_fk_project_rowid FOREIGN KEY (fk_project) REFERENCES llx_projet (rowid);

View File

@ -0,0 +1,25 @@
-- ============================================================================
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2012 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ============================================================================
create table llx_categorie_project
(
fk_categorie integer NOT NULL,
fk_project integer NOT NULL,
import_key varchar(14)
)ENGINE=innodb;

View File

@ -29,5 +29,5 @@ CREATE TABLE llx_opensurvey_sondage (
allow_comments tinyint NOT NULL DEFAULT 1,
allow_spy tinyint NOT NULL DEFAULT 1,
tms TIMESTAMP,
sujet TEXT, -- Not filled if format = 'F'. Question are into table llx_opensurvey_formquestions
sujet TEXT -- Not filled if format = 'F'. Question are into table llx_opensurvey_formquestions
) ENGINE=InnoDB;

View File

@ -27,6 +27,7 @@ create table llx_user
ref_int varchar(50), -- reference into an internal system (deprecated)
employee tinyint DEFAULT 1, -- 1 if user is an employee
fk_establishment integer DEFAULT 0,
datec datetime,
tms timestamp,

View File

@ -22,7 +22,7 @@ create table llx_user_param
(
fk_user integer NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
param varchar(64) NOT NULL,
param varchar(255) NOT NULL,
value text NOT NULL
)ENGINE=innodb;
@ -32,4 +32,4 @@ create table llx_user_param
-- 1 : first company param
-- 2 : second company param
-- 3 : etc...
--
--

View File

@ -1,7 +1,11 @@
# Dolibarr language file - Source file is en_US - oauth
ConfigOAuth=Oauth Configuration
NoAccessToken=No token access saved.
HasAccessToken=A token was generated and saved into database
NewTokenStored=Token received ans saved
TokenDeleted=Token deleted
UseTheFollowingUrlAsRedirectURI=Use the following URL as the Redirect URI when creating your credential on your OAuth provider:
ListOfSupportedOauthProviders=Enter here credential provided by your OAuth2 provider. Only supported OAuth2 providers are visible here. This setup may be used by other modules than need OAuth2 authentication.
OAUTH_AMAZON_NAME=Api Amazon
OAUTH_AMAZON_ID=Api Amazon Id
OAUTH_AMAZON_SECRET=Api Amazon Secret

View File

@ -3,7 +3,7 @@ Module64000Name=Direct Printing
Module64000Desc=Enable Direct Printing System
PrintingSetup=Setup of Direct Printing System
PrintingDesc=This module adds a Print button to send documents directly to a printer (without opening document into an application) with various module.
MenuDirectPrinting=Direct Printing
MenuDirectPrinting=Direct Printing jobs
DirectPrint=Direct print
ModuleDriverSetup=Setup Module Driver
PrintingDriverDesc=Configuration variables for printing driver.
@ -20,11 +20,13 @@ UserConf=Setup per user
PRINTGCP=Google Cloud Print
PRINTGCP_INFO=Google Api State
PRINTGCP_AUTHLINK=Authentication
PRINTGCP_TOKEN_ACCESS=Google Cloud Print Token
PRINTGCP_TOKEN_ACCESS=Google Cloud Print OAuth Token
PRINTGCP_TOKEN_REFRESH=Token Refresh Present
PRINTGCP_TOKEN_EXPIRED=Token Expired
PRINTGCP_TOKEN_EXPIRE_AT=Token expire at
RequestAccess=Request Access
PRINTGCP_DELETE_TOKEN=Delete saved token
RequestAccess=Click here to request access and receive a token to save
DeleteAccess=Click here to delete token
PrintGCPDesc=This driver allow to send documents directly to a printer with Google Cloud Print.
PrintingDriverDescprintgcp=Configuration variables for printing driver Google Cloud Print.
PrintTestDescprintgcp=List of Printers for Google Cloud Print.
@ -83,4 +85,4 @@ MEDIA_IPP_thermal=Thermal
IPP_COLOR_print-black=BW Printer
DirectPrintingJobsDesc=This page lists printing jobs found for available printers.
GoogleAuthNotConfigured=Google OAuth setup not done. Enable module OAuth and set a Google ID/Secret.
GoogleAuthConfigured=Google OAuth credentials found.
GoogleAuthConfigured=Google OAuth credentials found into setup of module OAuth.

View File

@ -176,6 +176,7 @@ ProjectOpenedProjectByOppStatus=Opened project/lead by opportunity status
ProjectsStatistics=Statistics on projects/leads
TaskAssignedToEnterTime=Task assigned. Entering time on this task should be possible.
IdTaskTime=Id task time
YouCanCompleteRef=If you want to complete the ref with some information (to use it as search filters), it is recommanded to add a - character to separate it, so the automatic numbering will still work correctly for next projects. For example %s-ABC. You may also prefer to add search keys into label.
OpenedProjectsByThirdparties=Opened projects by thirdparties
OpportunityTotalAmount=Opportunities total amount
OpportunityPonderatedAmount=Opportunities weighted amount

View File

@ -931,7 +931,7 @@ if (! function_exists("llxHeader"))
}
if (empty($conf->dol_hide_leftmenu))
{
left_menu('', $help_url, '', '', 1, $title);
left_menu('', $help_url, '', '', 1, $title, 1);
}
// main area
@ -1401,13 +1401,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
</script>' . "\n";
}
// Wrapper to show tooltips
print '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
});
</script>' . "\n";
// Raven.js for client-side Sentry logging support
if (array_key_exists('mod_syslog_sentry', $conf->loghandlers) && ! empty($conf->global->SYSLOG_SENTRY_DSN))
{
@ -1539,9 +1532,10 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
* @param int $leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules.
* @param string $title Title of web page
* @param string $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return void
*/
function left_menu($menu_array_before, $helppagename='', $notused='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='')
function left_menu($menu_array_before, $helppagename='', $notused='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='', $acceptdelayedhtml=0)
{
global $user, $conf, $langs, $db, $form;
global $hookmanager, $menumanager;
@ -1563,7 +1557,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
{
if (! is_object($form)) $form=new Form($db);
$selected=-1;
$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"));
$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
}
else
{
@ -1770,7 +1764,6 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
print "\n";
print '<!-- Begin right area -->'."\n";
if (empty($leftmenuwithoutmainarea)) main_area($title);
}
@ -1892,6 +1885,7 @@ if (! function_exists("llxFooter"))
/**
* Show HTML footer
* Close div /DIV data-role=page + /DIV class=fiche + /DIV /DIV main layout + /BODY + /HTML.
* If global var $delayedhtmlcontent was filled, we output it just before closing the body.
*
* @param string $comment A text to add as HTML comment into HTML generated page
* @param string $zone 'private' (for private pages) or 'public' (for public pages)
@ -1900,7 +1894,8 @@ if (! function_exists("llxFooter"))
function llxFooter($comment='',$zone='private')
{
global $conf, $langs;
global $delayedhtmlcontent;
// Global html output events ($mesgs, $errors, $warnings)
dol_htmloutput_events();
@ -1937,6 +1932,18 @@ if (! function_exists("llxFooter"))
//var_dump($langs); // Uncommment to see the property _tab_loaded to see which language file were loaded
if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile) && empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '</div> <!-- End div id-container -->'."\n"; // End div container
if (! empty($delayedhtmlcontent)) print $delayedhtmlcontent;
// Wrapper to show tooltips
print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n";
print '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
});
</script>' . "\n";
print "</body>\n";
print "</html>\n";
}

View File

@ -82,31 +82,16 @@ if ($id > 0 || ! empty($ref))
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'margin', $titre, 0, $picto);
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object,'ref','',1,'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td>';
print '</tr>';
// Status (to sell)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';
print $object->getLibStatut(2,0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">';
print $object->getLibStatut(2,1);
print '</td></tr>';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Total Margin
print '<tr><td>'.$langs->trans("TotalMargin").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td colspan="3">';
print '<span id="totalMargin"></span>'; // set by jquery (see below)
print '</td></tr>';
@ -125,7 +110,11 @@ if ($id > 0 || ! empty($ref))
}
print "</table>";
print '</div>';
print '</div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
if ($user->rights->facture->lire) {

View File

@ -73,21 +73,21 @@ if ($socid > 0)
dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"),0,'company');
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans('ThirdPartyName').'</td>';
print '<td colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
print '</td></tr>';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
}
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Alias names (commercial, trademark or alias names)
print '<tr><td class="titlefield">'.$langs->trans('AliasNames').'</td><td>';
print $object->name_alias;
print "</td></tr>";
if ($object->client)
{
print '<tr><td>';
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
@ -96,7 +96,7 @@ if ($socid > 0)
if ($object->fournisseur)
{
print '<tr><td>';
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
@ -104,7 +104,7 @@ if ($socid > 0)
}
// Total Margin
print '<tr><td>'.$langs->trans("TotalMargin").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td colspan="3">';
print '<span id="totalMargin"></span>'; // set by jquery (see below)
print '</td></tr>';
@ -123,7 +123,11 @@ if ($socid > 0)
}
print "</table>";
dol_fiche_end();
print '</div>';
print '<div style="clear:both"></div>';
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,";

View File

@ -137,7 +137,8 @@ if ($mode == 'setup' && $user->admin)
$classname = 'printing_'.$driver;
$langs->load($driver);
$printer = new $classname($db);
//print '<pre>'.print_r($printer, true).'</pre>';
//var_dump($printer);
$i=0;
$submit_enabled=0;
foreach ($printer->conf as $key)
@ -157,14 +158,14 @@ if ($mode == 'setup' && $user->admin)
case "authlink":
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans($key['varname']).'</td>';
print '<td class="button"><a href="'.$key['link'].'">'.$langs->trans('RequestAccess').'</a></td>';
print '<td><a class="button" href="'.$key['link'].'">'.$langs->trans('RequestAccess').'</a></td>';
print '<td>&nbsp;</td>';
print '</tr>'."\n";
break;
case "delete":
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans($key['varname']).'</td>';
print '<td class="button"><a href="'.$key['link'].'">'.$langs->trans('DeleteAccess').'</a></td>';
print '<td><a class="button" href="'.$key['link'].'">'.$langs->trans('DeleteAccess').'</a></td>';
print '<td>&nbsp;</td>';
print '</tr>'."\n";
break;

View File

@ -27,7 +27,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
llxHeader("",$langs->trans("Printing"));
print load_fiche_titre($langs->trans("Printing"));
print_barre_liste($langs->trans("Printing"), 0, $_SERVER["PHP_SELF"], '', '', '', '<a class="button" href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Refresh").'</a>', 0);
print $langs->trans("DirectPrintingJobsDesc").'<br><br>';

View File

@ -90,9 +90,6 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<?php echo $object->volume_units; ?>
</td></tr>
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
<td><?php echo $object->hidden; ?></td></tr>
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
<?php echo $object->textarea_note; ?>
</td></tr>

View File

@ -63,9 +63,6 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<?php echo $object->duration_unit; ?>
</td></tr>
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
<td><?php echo $object->hidden; ?></td></tr>
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
<?php echo $object->textarea_note; ?>
</td></tr>

View File

@ -249,7 +249,6 @@ if (empty($reshook))
$object->volume = GETPOST('volume');
$object->volume_units = GETPOST('volume_units');
$object->finished = GETPOST('finished');
$object->hidden = GETPOST('hidden')=='yes'?1:0;
$object->fk_unit = GETPOST('units');
$object->accountancy_code_sell = GETPOST('accountancy_code_sell');
$object->accountancy_code_buy = GETPOST('accountancy_code_buy');
@ -335,7 +334,6 @@ if (empty($reshook))
$object->volume = GETPOST('volume');
$object->volume_units = GETPOST('volume_units');
$object->finished = GETPOST('finished');
$object->hidden = GETPOST('hidden')=='yes'?1:0;
$units = GETPOST('units', 'int');
@ -1040,7 +1038,7 @@ else
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$type = $langs->trans('Product');
if ($object->isservice()) $type = $langs->trans('Service');
if ($object->isService()) $type = $langs->trans('Service');
//print load_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), "");
// Main official, simple, and not duplicated code
@ -1146,7 +1144,7 @@ else
// Stock
/*
if ($object->isproduct() && ! empty($conf->stock->enabled))
if ($object->isProduct() && ! empty($conf->stock->enabled))
{
print "<tr>".'<td>'.$langs->trans("StockLimit").'</td><td>';
print '<input name="seuil_stock_alerte" size="4" value="'.$object->seuil_stock_alerte.'">';
@ -1171,7 +1169,7 @@ else
print '</td></tr>';
}
if ($object->isservice())
if ($object->isService())
{
// Duration
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3"><input name="duration_value" size="3" maxlength="5" value="'.$object->duration_value.'">';
@ -1239,16 +1237,9 @@ else
print $object->showOptionals($extrafields,'edit');
}
// Note
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="3">';
$doleditor = new DolEditor('note', $object->note, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80);
$doleditor->Create();
print "</td></tr>";
if($conf->categorie->enabled) {
// Categories
// Tags-Categories
if ($conf->categorie->enabled)
{
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
@ -1260,6 +1251,14 @@ else
print "</td></tr>";
}
// Note
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="3">';
$doleditor = new DolEditor('note', $object->note, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80);
$doleditor->Create();
print "</td></tr>";
print '</table>';
print '<br>';
@ -1298,58 +1297,29 @@ else
// Fiche en mode visu
else
{
$head=product_prepare_head($object);
$showbarcode=empty($conf->barcode->enabled)?0:1;
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
$head=product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'card', $titre, 0, $picto);
$showphoto=$object->is_photo_available($conf->product->multidir_output[$object->entity]);
$showbarcode=empty($conf->barcode->enabled)?0:1;
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
// En mode visu
print '<table class="border" width="100%"><tr>';
// Ref
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'">';
print $form->showrefnav($object,'ref','',1,'ref');
print '</td>';
print '</tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->label.'</td>';
$nblignes=7;
if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) $nblignes++;
if ($showbarcode) $nblignes+=2;
if ($object->type!= Product::TYPE_SERVICE) $nblignes++;
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) $nblignes+=2;
if ($object->isservice()) $nblignes++;
else $nblignes+=4;
// Photo
if ($showphoto || $showbarcode)
{
print '<td valign="middle" align="center" width="25%" rowspan="'.$nblignes.'">';
print '<div class="photolist">';
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
if ($conf->browser->phone) $maxvisiblephotos=1;
if ($showphoto) print $object->show_photos($conf->product->multidir_output[$object->entity],1,$maxvisiblephotos,0,0,0,80);
if ($showphoto && $showbarcode) print '<br><br>';
if ($showbarcode) print $form->showbarcode($object);
print '</div>';
print '</td>';
}
print '</tr>';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Type
if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled))
{
// TODO change for compatibility with edit in place
$typeformat='select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
print '<tr><td>'.$form->editfieldkey("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat).'</td><td colspan="2">';
print '<tr><td class="titlefield">'.$form->editfieldkey("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat).'</td><td colspan="2">';
print $form->editfieldval("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat);
print '</td></tr>';
}
@ -1412,6 +1382,7 @@ else
print '</td></tr>';
// Status (to sell)
/*
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="2">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
@ -1428,7 +1399,8 @@ else
print $object->getLibStatut(2,1);
}
print '</td></tr>';
*/
// Batch number management (to batch)
if (! empty($conf->productbatch->enabled)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="2">';
@ -1448,18 +1420,25 @@ else
print dol_print_url($object->url);
print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Nature
if($object->type!= Product::TYPE_SERVICE)
{
print '<tr><td>'.$langs->trans("Nature").'</td><td colspan="2">';
print '<tr><td class="titlefield">'.$langs->trans("Nature").'</td><td colspan="2">';
print $object->getLibFinished();
print '</td></tr>';
}
if ($object->isservice())
if ($object->isService())
{
// Duration
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;';
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;';
if ($object->duration_value > 1)
{
$dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
@ -1475,7 +1454,7 @@ else
else
{
// Weight
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="2">';
print '<tr><td class="titlefield">'.$langs->trans("Weight").'</td><td colspan="2">';
if ($object->weight != '')
{
print $object->weight." ".measuring_units_string($object->weight_units,"weight");
@ -1549,11 +1528,6 @@ else
print $object->showOptionals($extrafields);
}
// Note
print '<!-- show Note --> '."\n";
print '<tr><td class="tdtop">'.$langs->trans("Note").'</td><td colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'">'.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'</td></tr>'."\n";
print '<!-- End show Note --> '."\n";
// Categories
if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
@ -1561,8 +1535,17 @@ else
print "</td></tr>";
}
print "</table>\n";
// Note
print '<!-- show Note --> '."\n";
print '<tr><td class="tdtop">'.$langs->trans("Note").'</td><td colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'">'.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'</td></tr>'."\n";
print '<!-- End show Note --> '."\n";
print "</table>\n";
print '</div>';
print '</div></div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
}

View File

@ -84,11 +84,13 @@ class Product extends CommonObject
//! Base price ('TTC' for price including tax or 'HT' for net price)
var $price_base_type;
//! Arrays for multiprices
var $multiprices=array();
var $multiprices_ttc=array();
var $multiprices_base_type=array();
var $multiprices_tva_tx=array();
var $multiprices_recuperableonly=array();
public $multiprices=array();
public $multiprices_ttc=array();
public $multiprices_base_type=array();
public $multiprices_min=array();
public $multiprices_min_ttc=array();
public $multiprices_tva_tx=array();
public $multiprices_recuperableonly=array();
//! Price by quantity arrays
var $price_by_qty;
var $prices_by_qty=array();
@ -125,6 +127,12 @@ class Product extends CommonObject
var $customcode; // Customs code
/**
* Product URL
* @var string
*/
public $url;
//! Unites de mesure
var $weight;
var $weight_units;
@ -717,6 +725,7 @@ class Product extends CommonObject
$sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null");
$sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
$sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1);
$sql.= ", fk_price_expression = ".($this->fk_price_expression != 0 ? $this->fk_price_expression : 'NULL');
$sql.= " WHERE rowid = " . $id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -1443,6 +1452,14 @@ class Product extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
$this->multiprices[$level] = $price;
$this->multiprices_ttc[$level] = $price_ttc;
$this->multiprices_min[$level]= $price_min;
$this->multiprices_min_ttc[$level]= $price_min_ttc;
$this->multiprices_base_type[$level]= $newpricebase;
$this->multiprices_tva_tx[$level]= $newvat;
$this->multiprices_recuperableonly[$level]= $newnpr;
$this->price = $price;
$this->price_ttc = $price_ttc;
$this->price_min = $price_min;
@ -1487,33 +1504,15 @@ class Product extends CommonObject
*
* @param int $expression_id Expression
* @return int <0 if KO, >0 if OK
* @deprecated Use Product::update instead
*/
function setPriceExpression($expression_id)
{
global $conf;
global $user;
// Clean parameters
$this->db->begin();
$expression_id = $expression_id != 0 ? $expression_id : 'NULL';
$this->fk_price_expression = $expression_id;
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
$sql.= " SET fk_price_expression = ".$expression_id;
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::setPriceExpression", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->error()." sql=".$sql;
$this->db->rollback();
return -1;
}
return $this->update($this->id, $user);
}
/**
@ -2194,11 +2193,12 @@ class Product extends CommonObject
/**
* Return nb of units or customers invoices in which product is included
*
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
function get_nb_vente($socid,$mode)
function get_nb_vente($socid, $mode, $filteronproducttype=-1)
{
global $conf;
global $user;
@ -2206,9 +2206,11 @@ class Product extends CommonObject
$sql = "SELECT sum(d.qty), date_format(f.datef, '%Y%m')";
if ($mode == 'bynumber') $sql.= ", count(DISTINCT f.rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as d, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.rowid = d.fk_facture";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
if ($filteronproducttype >= 0) $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('facture', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -2223,11 +2225,12 @@ class Product extends CommonObject
/**
* Return nb of units or supplier invoices in which product is included
*
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
function get_nb_achat($socid,$mode)
function get_nb_achat($socid, $mode, $filteronproducttype=-1)
{
global $conf;
global $user;
@ -2235,9 +2238,11 @@ class Product extends CommonObject
$sql = "SELECT sum(d.qty), date_format(f.datef, '%Y%m')";
if ($mode == 'bynumber') $sql.= ", count(DISTINCT f.rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as d, ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.rowid = d.fk_facture_fourn";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
if ($filteronproducttype >= 0) $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('facture_fourn', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -2252,11 +2257,12 @@ class Product extends CommonObject
/**
* Return nb of units or proposals in which product is included
*
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
function get_nb_propal($socid,$mode)
function get_nb_propal($socid, $mode, $filteronproducttype=-1)
{
global $conf;
global $user;
@ -2264,9 +2270,11 @@ class Product extends CommonObject
$sql = "SELECT sum(d.qty), date_format(p.datep, '%Y%m')";
if ($mode == 'bynumber') $sql.= ", count(DISTINCT p.rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s";
if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as prod";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.rowid = d.fk_propal";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
if ($filteronproducttype >= 0) $sql.= " AND prod.rowid = d.fk_product AND prod.fk_product_type =".$filteronproducttype;
$sql.= " AND p.fk_soc = s.rowid";
$sql.= " AND p.entity IN (".getEntity('propal', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -2280,20 +2288,23 @@ class Product extends CommonObject
/**
* Return nb of units or orders in which product is included
*
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
function get_nb_order($socid,$mode)
function get_nb_order($socid, $mode, $filteronproducttype=-1)
{
global $conf, $user;
$sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')";
if ($mode == 'bynumber') $sql.= ", count(DISTINCT c.rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as d, ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as p";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.rowid = d.fk_commande";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
if ($filteronproducttype >= 0) $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype;
$sql.= " AND c.fk_soc = s.rowid";
$sql.= " AND c.entity IN (".getEntity('commande', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -2307,20 +2318,23 @@ class Product extends CommonObject
/**
* Return nb of units or orders in which product is included
*
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
* @param int $socid Limit count on a particular third party id
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $filteronproducttype 0=To filter on product only, 1=To filter on services only
* @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
function get_nb_ordersupplier($socid,$mode)
function get_nb_ordersupplier($socid, $mode, $filteronproducttype=-1)
{
global $conf, $user;
$sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')";
if ($mode == 'bynumber') $sql.= ", count(DISTINCT c.rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as d, ".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."societe as s";
if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as p";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.rowid = d.fk_commande";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
if ($filteronproducttype >= 0) $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype;
$sql.= " AND c.fk_soc = s.rowid";
$sql.= " AND c.entity IN (".getEntity('commande_fournisseur', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -3485,9 +3499,10 @@ class Product extends CommonObject
* @param int $showaction 1=Show icon with action links (resize, delete)
* @param int $maxHeight Max height of image when size=1
* @param int $maxWidth Max width of image when size=1
* @param int $nolink Do not add a href link to view enlarged imaged into a new tab
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
*/
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160)
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160,$nolink=0)
{
global $conf,$user,$langs;
@ -3552,7 +3567,7 @@ class Product extends CommonObject
else if ($nbbyrow < 0) $return .= '<div class="inline-block">';
$return.= "\n";
$return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
if (empty($nolink)) $return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
// Show image (width height=$maxHeight)
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
@ -3568,7 +3583,8 @@ class Product extends CommonObject
$return.= '<img class="photo photowithmargin" border="0" '.($conf->dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
}
$return.= '</a>'."\n";
if (empty($nolink)) $return.= '</a>';
$return.="\n";
if ($showfilename) $return.= '<br>'.$viewfilename;
if ($showaction)
@ -3788,7 +3804,7 @@ class Product extends CommonObject
*
* @return boolean True if it's a product
*/
function isproduct()
function isProduct()
{
return ($this->type == Product::TYPE_PRODUCT ? true : false);
}
@ -3798,7 +3814,7 @@ class Product extends CommonObject
*
* @return boolean True if it's a service
*/
function isservice()
function isService()
{
return ($this->type == Product::TYPE_SERVICE ? true : false);
}
@ -4072,4 +4088,19 @@ class Product extends CommonObject
return 1;
}
/**
* Returns the rights used for this class
* @return stdClass
*/
public function getRights()
{
global $user;
if ($this->isProduct()) {
return $user->rights->produit;
} else {
return $user->rights->service;
}
}
}

View File

@ -193,8 +193,8 @@ if ($id > 0 || ! empty($ref))
print "<tr>";
$nblignes=6;
if ($object->isproduct() && ! empty($conf->stock->enabled)) $nblignes++;
if ($object->isservice()) $nblignes++;
if ($object->isProduct() && ! empty($conf->stock->enabled)) $nblignes++;
if ($object->isService()) $nblignes++;
// Reference
print '<td width="25%">'.$langs->trans("Ref").'</td><td>';

Some files were not shown because too many files have changed in this diff Show More