Merge branch 'develop' into multiprice-generator

# Conflicts:
#	htdocs/install/mysql/migration/3.8.0-3.9.0.sql
#	htdocs/product/price.php
This commit is contained in:
Marcos García de La Fuente 2015-10-27 10:41:50 +01:00
commit eff1f73950
167 changed files with 4738 additions and 2644 deletions

View File

@ -131,8 +131,9 @@ script:
# - cat upgrade370380.log
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
- php upgrade.php 3.8.0 3.9.0 ignoredbversion > upgrade380390.log
- cat upgrade380390.log
- php upgrade2.php 3.8.0 3.9.0 ignoredbversion > upgrade380390-2.log
# - cat upgrade370380-2.log
# - cat upgrade380390-2.log
- cd ../..
- date
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php

View File

@ -146,6 +146,12 @@ source_file = htdocs/langs/en_US/holiday.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.hrm]
file_filter = htdocs/langs/<lang>/hrm.lang
source_file = htdocs/langs/en_US/hrm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.incoterm]
file_filter = htdocs/langs/<lang>/incoterm.lang
source_file = htdocs/langs/en_US/incoterm.lang

View File

@ -19,6 +19,14 @@ Following changes may create regression for some external modules, but were nece
Dolibarr better:
- Deprecated hidden option MAIN_USE_CUSTOM_TRANSLATION has been removed. Use table llx_overwrite_trans instead.
- Trigger LINECONTRACT_INSERT has been renamed into LINECONTRACT_CREATE to match common denomination.
- A lot hooks used into PDF generation were not correctly implemented. We had to fix this. The result si that
the following hook were set as hook of type "replace". This means if your module implement such hooks, it must
return 0 to execute standard code or 1 to replace standard code (value to output should be set into resPrints instead).
This is list of hooks modified:
'pdf_getlinenum', 'pdf_getlineref', 'pdf_getlineref_supplier', 'pdf_getlinevatrate', 'pdf_getlineupexcltax',
'pdf_getlineupwithtax', 'pdf_getlineqty', 'pdf_getlineqty_asked', 'pdf_getlineqty_shipped', 'pdf_getlineqty_keeptoship',
'pdf_getlineunit', 'pdf_getlineremisepercent', 'pdf_getlineprogress', 'pdf_getlinetotalexcltax', 'pdf_getlinetotalwithtax'
***** ChangeLog for 3.8.1 compared to 3.8.0 *****

View File

@ -76,7 +76,7 @@ if ($action == 'disable') {
$action = 'update';
if ($result < 0) {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} else if ($action == 'enable') {
if ($accounting->fetch($id)) {
@ -84,7 +84,7 @@ if ($action == 'disable') {
}
$action = 'update';
if ($result < 0) {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}

View File

@ -125,7 +125,7 @@ else if ($action == 'delete')
}
if ($result < 0) {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}

View File

@ -100,9 +100,9 @@ if ($action == 'update') {
}
if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -110,7 +110,7 @@ else if ($action == 'add')
{
$db->rollback();
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='create';
}
}
@ -147,7 +147,7 @@ else if ($action == 'update')
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
else

View File

@ -76,14 +76,14 @@ if ($_POST["action"] == 'import') {
$result = $accounting->create($user);
if ($result > 0) {
setEventMessage($langs->trans("AccountingAccountAdd"), 'mesgs');
setEventMessages($langs->trans("AccountingAccountAdd"), null, 'mesgs');
} else {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
$cpt ++;
}
} else {
setEventMessage($langs->trans('AccountPlanNotFoundCheckSetting'), 'errors');
setEventMessages($langs->trans('AccountPlanNotFoundCheckSetting'), null, 'errors');
}
} else {
print '<div><font color="red">' . $langs->trans("AnyLineImport") . '</font></div>';

View File

@ -111,11 +111,11 @@ if ($action == 'update')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -126,9 +126,9 @@ if ($action == 'setlistsorttodo') {
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
@ -138,9 +138,9 @@ if ($action == 'setlistsortdone') {
if (! $res > 0)
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}

View File

@ -68,9 +68,9 @@ if ($action == 'update') {
}
if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -116,7 +116,7 @@ if ($action == 'update') {
$result=$accounting->fetch($accounting_account_id,null,1);
if ($result<0) {
//setEventMessage(null, $accounting->errors,'errors');
//setEventMessages(null, $accounting->errors, 'errors');
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
} else {

View File

@ -51,8 +51,8 @@ if ($action == "confirm_update") {
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
if ((floatval($debit)!=0.0) && (floatval($credit)!=0.0)) {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++;
}
@ -61,7 +61,7 @@ if ($action == "confirm_update") {
$result = $book->fetch($id);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
setEventMessages($book->error, $book->errors, 'errors');
} else {
$book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers;
@ -69,20 +69,20 @@ if ($action == "confirm_update") {
$book->debit = $debit;
$book->credit = $credit;
if (! empty($debit)) {
if (floatval($debit)!=0.0) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
if (floatval($credit)!=0.0) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->update();
if ($result < 0) {
setEventMessage($book->errors, 'errors');
setEventMessages($book->error, $book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = '';
}
}
@ -93,7 +93,7 @@ else if ($action == "add") {
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++;
}
@ -124,9 +124,9 @@ else if ($action == "add") {
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
setEventMessages($book->error, $book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = '';
}
}
@ -140,11 +140,11 @@ else if ($action == "confirm_delete") {
$piece_num = $book->piece_num;
if ($result < 0) {
setEventMessage($book->errors, 'errors');
setEventMessages($book->error, $book->errors, 'errors');
} else {
$result = $book->delete($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
setEventMessages($book->error, $book->errors, 'errors');
}
}
$action = '';
@ -168,9 +168,9 @@ else if ($action == "confirm_create") {
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
setEventMessages($book->error, $book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = '';
$piece_num = $book->piece_num;
}
@ -246,7 +246,7 @@ if ($action == 'create') {
$book = new BookKeeping($db);
$result = $book->fetch_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
setEventMessages($book->error, $book->errors, 'errors');
}
if (! empty($book->piece_num)) {
@ -277,7 +277,7 @@ if ($action == 'create') {
$result = $book->fetch_all_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
setEventMessages($book->error, $book->errors, 'errors');
} else {
print load_fiche_titre($langs->trans("ListeMvts"));
@ -372,4 +372,4 @@ if ($action == 'create') {
}
llxFooter();
$db->close();
$db->close();

View File

@ -74,7 +74,7 @@ if ($action == 'delbookkeeping') {
$result = $object->delete_by_importkey($import_key);
Header("Location: list.php");
if ($result < 0) {
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
} // Export
@ -86,7 +86,7 @@ else if ($action == 'export_csv') {
$object = new BookKeeping($db);
$result = $object->export_bookkeping('ebp');
if ($result < 0) {
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
foreach ( $object->linesexport as $line ) {

View File

@ -54,7 +54,7 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
$resql = $db->query($sql);
if (! $resql) {
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
}
} else {
header("Location: ./lines.php");

View File

@ -83,10 +83,10 @@ if ($action == 'validatehistory') {
if (! $resql1) {
$error ++;
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
} else {
$db->commit();
setEventMessage($langs->trans('Dispatched'), 'mesgs');
setEventMessages($langs->trans('Dispatched'), null, 'mesgs');
}
}
@ -346,4 +346,4 @@ print "</table>\n";
print '</td></tr></table>';
llxFooter();
$db->close();
$db->close();

View File

@ -109,14 +109,14 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
}
if (! $error) {
$db->commit();
setEventMessage($langs->trans('Save'), 'mesgs');
setEventMessages($langs->trans('Save'), null, 'mesgs');
} else {
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
}
}

View File

@ -343,7 +343,7 @@ if ($action == 'writeBookKeeping')
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Third party
@ -420,13 +420,13 @@ if ($action == 'writeBookKeeping')
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
}
}
// Export

View File

@ -185,7 +185,7 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -215,7 +215,7 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -246,14 +246,14 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
}
if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
}
}

View File

@ -220,7 +220,7 @@ if ($action == 'writebookkeeping')
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -250,7 +250,7 @@ if ($action == 'writebookkeeping')
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -282,14 +282,14 @@ if ($action == 'writebookkeeping')
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
}
if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
}
}

View File

@ -55,7 +55,7 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
dol_syslog('accountancy/supplier/card.php:: $sql=' . $sql);
$resql = $db->query($sql);
if (! $resql) {
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
}
} else {
header("Location: ./lines.php");

View File

@ -79,10 +79,10 @@ if ($action == 'validatehistory') {
if (! $resql1) {
$error ++;
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
} else {
$db->commit();
setEventMessage($langs->trans('Dispatched'), 'mesgs');
setEventMessages($langs->trans('Dispatched'), null, 'mesgs');
}
}

View File

@ -115,14 +115,14 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
}
if (! $error) {
$db->commit();
setEventMessage($langs->trans('Save'), 'mesgs');
setEventMessages($langs->trans('Save'), null, 'mesgs');
} else {
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
}
}

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* 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
@ -69,11 +69,11 @@ if ($action == 'update' || $action == 'add')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -60,11 +60,11 @@ if ($action == 'update')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -133,7 +133,7 @@ if (empty($reshook))
if ($userid != $user->id && $userid != $object->user_id)
{
$error++;
setEventMessage($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), 'errors');
setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
}
}
@ -169,7 +169,7 @@ if (empty($reshook))
$thirdparty=new Societe($db);
$thirdparty->fetch($socid);
$error++;
setEventMessage($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), 'errors');
setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), null, 'errors');
}
}
@ -195,12 +195,12 @@ if (empty($reshook))
if ($result < 0)
{
$langs->load("errors");
setEventMessage($langs->trans($nuser->error), 'errors');
setEventMessages($langs->trans($nuser->error), null, 'errors');
}
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->errors, $object->error, 'errors');
}
}
@ -216,13 +216,13 @@ if (empty($reshook))
if ($result < 0)
{
$langs->load("errors");
setEventMessage($langs->trans($company->error), 'errors');
setEventMessage($company->errors, 'errors');
setEventMessages($langs->trans($company->error), null, 'errors');
setEventMessages($company->error, $company->errors, 'errors');
}
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -236,7 +236,7 @@ if (empty($reshook))
$result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent"));
$langs->load("mails");
setEventMessage($langs->trans("MailSuccessfulySent", $from, $object->email));
setEventMessages($langs->trans("MailSuccessfulySent", $from, $object->email), null, 'mesgs');
}
}
@ -352,7 +352,7 @@ if (empty($reshook))
$newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']) > 0)
{
setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors');
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
}
else
{
@ -368,7 +368,7 @@ if (empty($reshook))
}
else
{
setEventMessage("ErrorBadImageFormat", 'errors');
setEventMessages("ErrorBadImageFormat", null, 'errors');
}
}
else
@ -397,9 +397,9 @@ if (empty($reshook))
else
{
if ($object->error) {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
$action='';
}
@ -503,7 +503,7 @@ if (empty($reshook))
if ($num) {
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorLoginAlreadyExists",$login), 'errors');
setEventMessages($langs->trans("ErrorLoginAlreadyExists",$login), null, 'errors');
}
}
if (empty($pass)) {
@ -528,7 +528,7 @@ if (empty($reshook))
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) {
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorBadEMail",$email), 'errors');
setEventMessages($langs->trans("ErrorBadEMail",$email), null, 'errors');
}
$public=0;
if (isset($public)) $public=1;
@ -554,9 +554,9 @@ if (empty($reshook))
$db->rollback();
if ($object->error) {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
$action = 'create';
@ -609,7 +609,7 @@ if (empty($reshook))
if ($result < 0)
{
$error++;
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -617,9 +617,9 @@ if (empty($reshook))
{
$error++;
if ($object->error) {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -654,7 +654,7 @@ if (empty($reshook))
if ($result < 0)
{
$error++;
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
@ -662,9 +662,9 @@ if (empty($reshook))
$error++;
if ($object->error) {
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessage($object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
$action='';
}
@ -683,7 +683,7 @@ if (empty($reshook))
{
if (!$mailmanspip->del_to_spip($object))
{
setEventMessage($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, 'errors');
setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors');
}
}
}
@ -694,7 +694,7 @@ if (empty($reshook))
{
if (!$mailmanspip->add_to_spip($object))
{
setEventMessage($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, 'errors');
setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors');
}
}
}

View File

@ -110,7 +110,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
{
$langs->load("errors");
$errmsg=$langs->trans($company->error);
setEventMessage($company->errors, 'errors');
setEventMessages($company->error, $company->errors, 'errors');
}
else
{
@ -131,7 +131,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id)
{
$error++;
setEventMessage($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), 'errors');
setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
}
}
@ -167,7 +167,7 @@ if ($action == 'setsocid')
$thirdparty=new Societe($db);
$thirdparty->fetch(GETPOST('socid','int'));
$error++;
setEventMessage($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), 'errors');
setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), null, 'errors');
}
}

View File

@ -1575,7 +1575,7 @@ class Adherent extends CommonObject
$picto='user';
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto) $result.=($link.img_object('', $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
return $result;

View File

@ -72,12 +72,12 @@ if ($action == 'dolibarr2ldap')
if ($result >= 0)
{
setEventMessage($langs->trans("MemberSynchronized"));
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
$db->commit();
}
else
{
setEventMessage($ldap->error, 'errors');
setEventMessages($ldap->errors, $ldap->error, 'errors');
$db->rollback();
}
}

View File

@ -86,12 +86,12 @@ if ($action == "save" && empty($cancel))
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$db->commit();
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"),null, 'errors');
$db->rollback();
}
}

View File

@ -72,7 +72,7 @@ if ($actionsave)
if (! empty($src) && ! dol_is_url($src))
{
setEventMessage($langs->trans("ErrorParamMustBeAnUrl"),'errors');
setEventMessages($langs->trans("ErrorParamMustBeAnUrl"), null, 'errors');
$error++;
$errorsaved++;
break;
@ -104,12 +104,12 @@ if ($actionsave)
if (! $error)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
if (empty($errorsaved)) setEventMessage($langs->trans("Error"),'errors');
if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -54,12 +54,12 @@ if ($actionsave)
if ($i >= 4)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessage($langs->trans("SaveFailed"), 'errors');
setEventMessages($langs->trans("SaveFailed"), null, 'errors');
}
}

View File

@ -6,8 +6,8 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* 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
@ -54,11 +54,11 @@ if ($action == 'updateMask')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -96,13 +96,13 @@ if ($action == 'specimen')
}
else
{
setEventMessage($module->error,'errors');
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
}
else
{
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
@ -116,11 +116,11 @@ if ($action == 'set_ASKPRICESUPPLIER_DRAFT_WATERMARK')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -134,11 +134,11 @@ if ($action == 'set_ASKPRICESUPPLIER_FREE_TEXT')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -150,11 +150,11 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -178,12 +178,12 @@ if ($action == 'setModuleOptions')
if (! $error)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -56,11 +56,11 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -97,11 +97,11 @@ if ($action == 'setModuleOptions')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'msgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -111,11 +111,11 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -85,7 +85,7 @@ if ($action == 'add') {
}
else
{
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
$error++;
}
}
@ -121,7 +121,7 @@ if ($action == 'add') {
$resql = $db->query($sql);
if (! $resql)
{
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
$error++;
}
}

View File

@ -36,16 +36,19 @@ $action = GETPOST("action");
/*
* Actions
*/
if ($action == 'setvalue' && $user->admin)
{
$result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("url"), 'chaine', 0, '', $conf->entity);
if ($result >= 0)
$result=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
$result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
if ($result1 >= 0 && $result2 >= 0)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -73,13 +76,22 @@ $var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="120">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'><td valign="top">';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("ClickToDialUseTelLink").'</td><td>';
print $form->selectyesno("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", $conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS, 1).'<br>';
print '<br>';
print $langs->trans("ClickToDialUseTelLinkDesc");
print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("DefaultLink").'</td><td>';
print '<input size="92" type="text" name="url" value="'.$conf->global->CLICKTODIAL_URL.'"><br>';
print '<input size="92" type="text" name="CLICKTODIAL_URL"'.($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'"><br>';
print '<br>';
print $langs->trans("ClickToDialUrlDesc").'<br>';
print $langs->trans("Example").':<br>http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
@ -64,11 +64,11 @@ if ($action == 'updateMask')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -106,13 +106,13 @@ else if ($action == 'specimen')
}
else
{
setEventMessage($module->error,'errors');
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
}
else
{
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
@ -137,12 +137,12 @@ if ($action == 'setModuleOptions')
if (! $error)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -196,11 +196,11 @@ else if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -214,11 +214,11 @@ else if ($action == 'set_ORDER_FREE_TEXT')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -228,9 +228,9 @@ else if ($action=="setshippableiconinlist") {
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist,'yesno',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -243,11 +243,28 @@ else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
// Activate ask for warehouse
else if ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
{
$res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER",$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -630,6 +647,36 @@ else
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
}
// Ask for warehouse during order
if ($conf->stock->enabled)
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp</td><td align="center">';
if (! empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
}
else
{
if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
}
}
print '</td></tr>';
}
else
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
}
print '</table>';
print '<br>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 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) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -125,19 +125,19 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
$error++;
$langs->load("errors");
$tmparray=explode(':',$result);
setEventMessage($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]),'errors');
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors');
}
else
{
$error++;
setEventMessage($langs->trans("ErrorFailedToSaveFile"),'errors');
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
}
}
else
{
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorBadImageFormat"),'errors');
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
}
}
}
@ -230,7 +230,7 @@ if ($action == 'addthumb')
{
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorBadImageFormat"),'errors');
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING);
}
}
@ -238,7 +238,7 @@ if ($action == 'addthumb')
{
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors');
setEventMessages($langs->trans("ErrorFileDoesNotExists",$_GET["file"]), null, 'errors');
dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
}
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -87,11 +87,11 @@ if ($action == 'update')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -68,7 +68,7 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
{
if (dolibarr_set_const($db, $constname, $constvalue, 'chaine', 1, $constnote, $entity) >= 0)
{
setEventMessage($langs->trans("RecordSaved"));
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action="";
$constname="";
$constvalue="";
@ -99,7 +99,7 @@ if (! empty($consts) && $action == 'update')
}
}
}
if ($nbmodified > 0) setEventMessage($langs->trans("RecordSaved"));
if ($nbmodified > 0) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action='';
}
@ -122,7 +122,7 @@ if (! empty($consts) && $action == 'delete')
}
}
}
if ($nbdeleted > 0) setEventMessage($langs->trans("RecordDeleted"));
if ($nbdeleted > 0) setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
$action='';
}
@ -131,7 +131,7 @@ if ($action == 'delete')
{
if (dolibarr_del_const($db, $rowid, $entity) >= 0)
{
setEventMessage($langs->trans("RecordDeleted"));
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
}
else
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2014 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
@ -59,11 +59,11 @@ if ($action == 'updateMask')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessage($langs->trans("Error"), null, 'errors');
}
}
@ -101,13 +101,13 @@ else if ($action == 'specimen') // For contract
}
else
{
setEventMessage($obj->error,'errors');
setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR);
}
}
else
{
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
@ -132,12 +132,12 @@ if ($action == 'setModuleOptions')
if (! $error)
{
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -194,11 +194,11 @@ else if ($action == 'set_other')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
@ -34,6 +34,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$langs->load("errors");
@ -465,6 +466,9 @@ if ($id == 11)
'fichinter' => $langs->trans('InterventionCard')
);
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
complete_elementList_with_modules($elementList);
asort($elementList);
$sourceList = array(
'internal' => $langs->trans('Internal'),
@ -544,20 +548,20 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
setEventMessage($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),'errors');
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
// Other checks
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
$ok=0;
setEventMessage($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'),'errors');
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
}
if (isset($_POST["code"]))
{
if ($_POST["code"]=='0')
{
$ok=0;
setEventMessage($langs->transnoentities('ErrorCodeCantContainZero'),'errors');
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
}
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
{
@ -574,7 +578,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
else
{
$ok=0;
setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")),'errors');
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
}
}
@ -633,13 +637,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessage($langs->transnoentities("RecordSaved"));
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
}
else
{
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessage($langs->transnoentities("ErrorRecordAlreadyExists"),'errors');
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
}
else {
dol_print_error($db);
@ -683,7 +687,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$resql = $db->query($sql);
if (! $resql)
{
setEventMessage($db->error(),'errors');
setEventMessage($db->error(), 'errors');
}
}
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
@ -707,7 +711,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
{
setEventMessage($langs->transnoentities("ErrorRecordIsUsedByChild"),'errors');
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
}
else
{

View File

@ -37,6 +37,7 @@ $langs->load("companies");
$langs->load("products");
$langs->load("members");
$langs->load("projects");
$langs->load("hrm");
if (! $user->admin) accessforbidden();
@ -46,17 +47,21 @@ $action = GETPOST('action');
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
// List of supported permanent search area
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT);
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module400Name');
$searchform=array();
if (empty($conf->use_javascript_ajax))
{
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT", "MAIN_SEARCHFORM_EMPLOYEE");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT,$conf->global->MAIN_SEARCHFORM_EMPLOYEE);
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects"), $langs->trans("Users"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module400Name');
}
if ($action == 'update')
{
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLISTE_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity);
@ -76,13 +81,16 @@ if ($action == 'update')
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())),'chaine',0,'',$conf->entity);
/*
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE", $_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PROJECT", $_POST["MAIN_SEARCHFORM_PROJECT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_EMPLOYEE", $_POST["MAIN_SEARCHFORM_EMPLOYEE"],'chaine',0,'',$conf->entity);
*/
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity);
@ -161,19 +169,22 @@ if ($action == 'edit') // Edit
print '<br>';
// Liste des zone de recherche permanantes supportees
print '<table summary="search" class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td colspan="2">'.$langs->trans("Activated").'</td></tr>';
$var=True;
foreach ($searchform as $key => $value)
if (! empty($searchform))
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$searchformtitle[$key].'</td><td colspan="2">';
print $form->selectyesno($searchform[$key],$searchformconst[$key],1);
print '</td></tr>';
print '<table summary="search" class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td colspan="2">'.$langs->trans("Activated").'</td></tr>';
$var=True;
foreach ($searchform as $key => $value)
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$searchformtitle[$key].'</td><td colspan="2">';
print $form->selectyesno($searchform[$key],$searchformconst[$key],1);
print '</td></tr>';
}
print '</table>';
print '<br>';
}
print '</table>';
print '<br>';
// Other
print '<table summary="edit" class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
@ -204,6 +215,12 @@ if ($action == 'edit') // Edit
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Max size of short lists on customer card
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLISTE_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Disable javascript and ajax
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DisableJavascript").'</td><td>';
@ -348,20 +365,23 @@ else // Show
print '<br>';
// Liste des zone de recherches permanentes supportees
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td>'.$langs->trans("Activated").'</td><td>&nbsp;</td></tr>';
$var=true;
foreach ($searchform as $key => $value)
// List of search forms to show
if (! empty($searchform))
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$searchformtitle[$key].'</td><td>'.yn($searchformconst[$key]).'</td>';
print '<td align="left">'.$langs->trans("IfModuleEnabled",$langs->transnoentitiesnoconv($searchformmodule[$key]));
print '</td></tr>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td>'.$langs->trans("Activated").'</td><td>&nbsp;</td></tr>';
$var=true;
foreach ($searchform as $key => $value)
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$searchformtitle[$key].'</td><td>'.yn($searchformconst[$key]).'</td>';
print '<td align="left">';
if (! empty($searchformmodule[$key])) print $langs->trans("IfModuleEnabled",$langs->transnoentitiesnoconv($searchformmodule[$key]));
print '</td></tr>';
}
print '</table>';
print '<br>';
}
print '</table>';
print '<br>';
// Other
$var=true;
@ -385,6 +405,11 @@ else // Show
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>';
print '<td width="20">&nbsp;</td>';
print "</tr>";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td>' . $conf->global->MAIN_SIZE_SHORTLISTE_LIMIT . '</td>';
print '<td width="20">&nbsp;</td>';
print "</tr>";
// Disable javascript/ajax
$var=!$var;

View File

@ -99,7 +99,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if (! isValidEmail($email))
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorBadEMail",$email),'errors');
setEventMessages($langs->trans("ErrorBadEMail",$email), null, 'errors');
}
else
{
@ -118,11 +118,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if ($result < 0)
{
$error++;
setEventMessage($mailmanspip->error,'errors');
setEventMessages($mailmanspip->error,$mailmanspip->errors,'errors');
}
else
{
setEventMessage($langs->trans("MailmanCreationSuccess"));
setEventMessages($langs->trans("MailmanCreationSuccess"), null);
}
}
if ($action == 'testunsubscribe')
@ -131,11 +131,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if ($result < 0)
{
$error++;
setEventMessage($mailmanspip->error,'errors');
setEventMessages($mailmanspip->error,$mailmanspip->errors,'errors');
}
else
{
setEventMessage($langs->trans("MailmanDeletionSuccess"));
setEventMessages($langs->trans("MailmanDeletionSuccess"), null);
}
}
}
@ -156,12 +156,15 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
$head = mailmanspip_admin_prepare_head();
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
$var=true;
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
//$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
//$link.=$langs->trans("Disable");
@ -200,21 +203,30 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
});
</script>';
form_constantes($constantes,1);
form_constantes($constantes,2);
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>';
}
else
{
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
//$link.=img_$langs->trans("Activate")
$link.=img_picto($langs->trans("Disabled"),'switch_off');
$link.='</a>';
print load_fiche_titre($langs->trans('MailmanTitle'), $link,'');
dol_fiche_end();
}
dol_fiche_end();
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{

View File

@ -78,16 +78,16 @@ if ($action == 'update')
$result=$menu->update($user);
if ($result > 0)
{
setEventMessage($langs->trans("RecordModifiedSuccessfully"));
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
else
{
setEventMessage($menu->error, 'errors');
setEventMessages($menu->error, $menu->errors, 'errors');
}
}
else
{
setEventMessage($menu->error, 'errors');
setEventMessages($menu->error, $menu->errors, 'errors');
}
$_GET["menuId"] = $_POST['menuId'];
$action = "edit";
@ -159,13 +159,13 @@ if ($action == 'add')
}
if (! $error && $_POST['menuId'] && $_POST['type'] == 'top')
{
setEventMessage($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), 'errors');
setEventMessages($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), null, 'errors');
$action = 'create';
$error++;
}
if (! $error && empty($_POST['menuId']) && $_POST['type'] == 'left')
{
setEventMessage($langs->trans("ErrorLeftMenuMustHaveAParentId"), 'errors');
setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
$action = 'create';
$error++;
}
@ -204,7 +204,7 @@ if ($action == 'add')
else
{
$action = 'create';
setEventMessage($menu->error, 'errors');
setEventMessages($menu->error, $menu->errors, 'errors');
}
}
}
@ -222,7 +222,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == 'yes')
$this->db->commit();
llxHeader();
setEventMessage($langs->trans("MenuDeleted"));
setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs');
llxFooter();
exit ;
}

View File

@ -186,7 +186,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes')
{
$db->commit();
setEventMessage($langs->trans("MenuDeleted"));
setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs');
header("Location: ".DOL_URL_ROOT.'/admin/menus/index.php?menu_handler='.$menu_handler);
exit ;
@ -359,7 +359,7 @@ if ($conf->use_javascript_ajax)
else
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorFeatureNeedJavascript"), 'errors');
setEventMessages($langs->trans("ErrorFeatureNeedJavascript"), null, 'errors');
}
print '<br>';

View File

@ -54,28 +54,30 @@ if ($action == 'update' || $action == 'add')
$constname=GETPOST("constname");
$constvalue=GETPOST("constvalue");
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
{
if ($constvalue) $constvalue=0;
else $constvalue=1;
}
// Action mise a jour ou ajout d'une constante
if ($action == 'update' || $action == 'add')
{
foreach($_POST['constname'] as $key => $val)
{
$constname=$_POST["constname"][$key];
$constvalue=$_POST["constvalue"][$key];
$consttype=$_POST["consttype"][$key];
$constnote=$_POST["constnote"][$key];
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname];
$consttype=$_POST["consttype"];
$constnote=GETPOST("constnote");
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
if (! $res > 0) $error++;
}
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
}
}
// Action activation d'un sous module du module adherent
@ -115,7 +117,6 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
$head = mailmanspip_admin_prepare_head();
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
$var=true;
@ -124,6 +125,10 @@ $var=true;
*/
if (! empty($conf->global->ADHERENT_USE_SPIP))
{
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
//$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
//$link.=$langs->trans("Disable");
@ -139,21 +144,28 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
print '<br>';
form_constantes($constantes);
print '<br>';
form_constantes($constantes,2);
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>';
}
else
{
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
//$link.=$langs->trans("Activate");
$link.=img_picto($langs->trans("Disabled"),'switch_off');
$link.='</a>';
print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
dol_fiche_end();
}
dol_fiche_end();
llxFooter();
$db->close();

View File

@ -25,11 +25,15 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$langs->load("admin");
$langs->load("help");
$langs->load("members");
$youuselaststable = 0;
/*
* View
@ -42,9 +46,54 @@ print load_fiche_titre("Dolibarr",'','title_setup');
print '<div style="padding-left: 30px;">'.img_picto_common('', 'dolibarr_box.png','height="120"').'</div>';
print '<div class="fichecenter"><div class="fichehalfleft">';
print $langs->trans("Version").' / '.$langs->trans("DolibarrLicense").':';
print '<ul>';
print '<li>'.DOL_VERSION.' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
print '<li><strong>'.DOL_VERSION.'</strong>';
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl)
{
$title=$sfurl->channel[0]->item[0]->title;
function word_limiter($text, $limit = 30, $chars = '0123456789.')
{
if (strlen( $text ) > $limit)
{
$words = str_word_count($text, 2, $chars);
$words = array_reverse($words, TRUE);
foreach($words as $length => $word) {
if ($length + strlen( $word ) >= $limit)
{
array_shift($words);
} else {
break;
}
}
$words = array_reverse($words);
$text = implode(" ", $words) . '';
}
return $text;
}
$str = word_limiter($title);
$str = preg_replace('/[^0-9\.]/', '', $str);
print ' ('.$langs->trans("LastStableVersion").': <b>'.$str.'</b>';
if (DOL_VERSION == $str)
{
$youuselaststable=1;
print $langs->trans("YouUseLastStableVersion");
}
print ')';
print ' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
}
print '</ul>';
//print "<br>\n";
@ -114,6 +163,9 @@ print '</li>';
print '</ul>';
print '</div><div class="fichehalfright">';
print $langs->trans("HelpCenter").':';
print '<ul>';
print '<li>';
@ -122,6 +174,7 @@ print '<a target="_blank" href="'.DOL_URL_ROOT.'/support/index.php" data-ajax="f
print '</li>';
print '</ul>';
print $langs->trans("Foundation").':';
print '<ul>';
@ -153,6 +206,33 @@ print '</li>';
print '</ul>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
if ($youuselaststable)
{
print '<br>';
print '<br>';
$tmp=versiondolibarrarray();
if ((empty($tmp[2]) && (strpos($tmp[1], '0') === 0)) || (strpos($tmp[2], '0') === 0))
{
print $langs->trans("TitleExampleForMajorRelease").':<br>';
print '<textarea style="width:80%; min-height: 60px">';
print $langs->trans("ExampleOfNewsMessageForMajorRelease", DOL_VERSION, DOL_VERSION);
print '</textarea>';
}
else
{
print $langs->trans("TitleExampleForMaintenanceRelease").':<br>';
print '<textarea style="width:80%; min-height: 60px">';
print $langs->trans("ExampleOfNewsMessageForMaintenanceRelease", DOL_VERSION, DOL_VERSION);
print '</textarea>';
}
}
llxFooter();

View File

@ -52,8 +52,8 @@ if ($action == 'delete')
{
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action='';
}

View File

@ -60,8 +60,8 @@ if ($action == 'delete')
{
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action='';
}
@ -357,7 +357,7 @@ if ($what == 'postgresql')
//{
if ($errormsg)
{
setEventMessage($langs->trans("Error")." : ".$errormsg, 'errors');
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
$resultstring='';
$resultstring.='<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
@ -368,7 +368,7 @@ if ($what == 'postgresql')
{
if ($what)
{
setEventMessage($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"));
setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs');
$resultstring='<div class="ok">';
$resultstring.=$langs->trans("BackupFileSuccessfullyCreated").'.<br>';
@ -379,7 +379,7 @@ if ($what == 'postgresql')
}
else
{
setEventMessage($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user));
setEventMessages($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user), null, 'mesgs');
}
}
//}

View File

@ -34,7 +34,7 @@ $action=GETPOST('action','alpha');
if (! $user->admin) accessforbidden();
if (GETPOST('msg','alpha')) {
setEventMessage(GETPOST('msg','alpha'), 'errors');
setEventMessages(GETPOST('msg','alpha'), null, 'errors');
}
@ -63,7 +63,7 @@ if ($action=='install')
if (! $original_file)
{
$langs->load("Error");
setEventMessage($langs->trans("ErrorFileRequired"), 'warnings');
setEventMessages($langs->trans("ErrorFileRequired"), null, 'warnings');
$error++;
}
else
@ -71,7 +71,7 @@ if ($action=='install')
if (! preg_match('/\.zip/i',$original_file))
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), 'errors');
setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors');
$error++;
}
}
@ -99,7 +99,7 @@ if ($action=='install')
if (! empty($result['error']))
{
$langs->load("errors");
setEventMessage($langs->trans($result['error'],$original_file), 'errors');
setEventMessages($langs->trans($result['error'],$original_file), null, 'errors');
$error++;
}
else
@ -116,7 +116,7 @@ if ($action=='install')
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
setEventMessage($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), 'errors');
setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), null, 'errors');
$error++;
}
}
@ -128,7 +128,7 @@ if ($action=='install')
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
if ($result <= 0)
{
setEventMessage($langs->trans("ErrorFailedToCopy"), 'errors');
setEventMessages($langs->trans("ErrorFailedToCopy"), null, 'errors');
$error++;
}
}
@ -142,7 +142,7 @@ if ($action=='install')
if (! $error)
{
setEventMessage($langs->trans("SetupIsReadyForUse"));
setEventMessages($langs->trans("SetupIsReadyForUse"), null, 'mesgs');
}
}

View File

@ -184,7 +184,7 @@ $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$title,$help_url);
/*
if ($mode == 'search')
{
if ($modesearch == 'soc')
@ -209,7 +209,7 @@ if ($mode == 'search')
$db->free($resql);
}
}
*/
if ($id > 0)
{
@ -226,7 +226,7 @@ if ($id > 0)
print '<table class="border" width="100%">';
// Alias name (commercial, trademark or alias name)
print '<tr><td class="titelfield">'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
print '<tr><td class="titelfield">'.$langs->trans('AliasNames').'</td><td colspan="3">';
print $object->name_alias;
print "</td></tr>";
@ -376,17 +376,6 @@ if ($id > 0)
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
if (empty($object->outstanding_limit)) print $langs->trans("NoLimit");
// display amount and link to unpaid bill
$outstandingBills = $object->get_OutstandingBill();
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency);
if ($object->outstanding_limit != '')
{
if ($outstandingBills > $object->outstanding_limit)
print img_warning($langs->trans("OutstandingBillReached"));
//print ' / ' . price($soc->outstanding_limit);
}
print ')';
print '</td>';
print '</tr>';
@ -491,14 +480,24 @@ if ($id > 0)
// Nbre max d'elements des petites listes
$MAXLIST=4;
$tableaushown=1;
$MAXLIST=$conf->global->MAIN_SIZE_SHORTLISTE_LIMIT;
// Lien recap
$outstandingBills = $object->get_OutstandingBill();
$warn = '';
if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingBills)
{
$warn = img_warning($langs->trans("OutstandingBillReached"));
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("Summary").'</td>';
print '<td align="right"><a href="'.DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id.'">'.$langs->trans("ShowCustomerPreview").'</a></td></tr></table></td>';
print '<td>'.$langs->trans("Summary").'</td>';
print '<td align="right"><a href="'.DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id.'">'.$langs->trans("ShowCustomerPreview").'</a></td>';
print '</tr>';
print '<tr class="impair">';
print '<td>'.$langs->trans("CurrentOutstandingBill").'</td>';
print '<td align="right">'.price($outstandingBills).$warn.'</td>';
print '</tr>';
print '</table>';
print '<br>';
@ -684,7 +683,6 @@ if ($id > 0)
if ($num > 0) {
print '<table class="noborder" width="100%">';
$tableaushown=1;
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
@ -868,7 +866,6 @@ if ($id > 0)
{
print '<table class="noborder" width="100%">';
$tableaushown=1;
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
@ -1024,6 +1021,7 @@ if ($id > 0)
// List of done actions
show_actions_done($conf,$langs,$db,$object);
}
}
else
{

View File

@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (! $user->rights->societe->lire) accessforbidden();
@ -65,6 +66,7 @@ $formfile = new FormFile($db);
$companystatic=new Societe($db);
if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
llxHeader();
@ -125,6 +127,8 @@ if (count($listofsearchfields))
*/
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$langs->load("propal");
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql.= ", s.code_client";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
@ -144,7 +148,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("ProposalsDraft").' <span class="badge">'.$num.'</span></td></tr>';
print '<td colspan="3">'.$langs->trans("ProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
if ($num > 0)
{
@ -182,6 +186,10 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>';
}
print "</table><br>";
$db->free($resql);
@ -219,7 +227,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("DraftOrders").' <span class="badge">'.$num.'</span></td></tr>';
print '<td colspan="3">'.$langs->trans("DraftOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
if ($num)
{
@ -257,10 +265,96 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoOrder").'</td></tr>';
}
print "</table><br>";
$db->free($resql);
}
else
{
dol_print_error($db);
}
}
/*
* Draft suppliers orders
*/
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
{
$langs->load("orders");
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql.= ", s.code_client";
$sql.= ", s.code_fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE cf.fk_soc = s.rowid";
$sql.= " AND cf.fk_statut = 0";
$sql.= " AND cf.entity IN (".getEntity('supplier_order', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND cf.fk_soc = ".$socid;
$resql = $db->query($sql);
if ($resql)
{
$total = 0;
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("DraftSuppliersOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
if ($num)
{
$i = 0;
$var = true;
while ($i < $num)
{
$var=!$var;
$obj = $db->fetch_object($resql);
print '<tr '.$bc[$var].'><td class="nowrap">';
$supplierorderstatic->id=$obj->rowid;
$supplierorderstatic->ref=$obj->ref;
$supplierorderstatic->ref_supplier=$obj->ref_suppliert;
$supplierorderstatic->total_ht = $obj->total_ht;
$supplierorderstatic->total_tva = $obj->total_tva;
$supplierorderstatic->total_ttc = $obj->total_ttc;
print $supplierorderstatic->getNomUrl(1);
print '</td>';
print '<td class="nowrap">';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->client=$obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'customer',16);
print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
$i++;
$total += $obj->total_ttc;
}
if ($total>0)
{
$var=!$var;
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoSupplierOrder").'</td></tr>';
}
print "</table><br>";
$db->free($resql);
} else {
dol_print_error($db);
}
}

View File

@ -1,348 +0,0 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is freei 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/>.
*/
/**
* \file htdocs/comm/list.php
* \ingroup commercial societe
* \brief List of customers
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->load("companies");
$langs->load("customers");
$langs->load("suppliers");
$langs->load("commercial");
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user,'societe',$socid,'');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page=GETPOST('page','int');
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom";
$search_company = GETPOST("search_company");
$search_zipcode = GETPOST("search_zipcode");
$search_town = GETPOST("search_town");
$search_code = GETPOST("search_code");
$search_compta = GETPOST("search_compta");
$search_status = GETPOST("search_status",'int');
$search_country = GETPOST("search_country",'int');
$search_type_thirdparty = GETPOST("search_type_thirdparty",'int');
$optioncss = GETPOST('optioncss','alpha');
// Load sale and categ filters
$search_sale = GETPOST("search_sale",'int');
$search_categ = GETPOST("search_categ",'int');
$catid = GETPOST("catid",'int');
// If the internal user must only see his customers, force searching by him
if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('customerlist'));
$extrafields = new ExtraFields($db);
/*
* Actions
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_sale="";
$search_categ="";
$catid="";
$search_company="";
$search_zipcode="";
$search_town="";
$search_code='';
$search_compta='';
$search_status='';
$search_country="";
$search_type_thirdparty='';
}
if ($search_status=='') $search_status=1; // always display activ customer first
/*
* view
*/
$formother=new FormOther($db);
$form = new Form($db);
$thirdpartystatic=new Societe($db);
$formcompany=new FormCompany($db);
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url);
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,";
$sql.= " s.datec, s.canvas";
$sql.= ",s.fk_pays";
$sql.= ",typent.code as typent_code";
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) ";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) ";
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
$sql.= " WHERE s.fk_stcomm = st.id";
$sql.= " AND s.client IN (1, 3)";
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= " AND s.rowid = sc.fk_soc";
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_company) $sql.= natural_search(array('s.nom', 's.name_alias'), $search_company);
if ($search_zipcode) $sql.= natural_search("s.zip", $search_zipcode);
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_code) $sql.= natural_search("s.code_client", $search_code);
if ($search_compta) $sql.= natural_search("s.code_compta", $search_compta);
if ($search_status!='') $sql.= " AND s.status = ".$db->escape($search_status);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_sale > 0) $sql.= " AND sc.fk_user = ".$search_sale;
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit +1, $offset);
dol_syslog('comm/list.php:', LOG_DEBUG);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$param = "&amp;search_company=".htmlspecialchars($search_company);
$param.="&amp;search_code=".htmlspecialchars($search_code);
$param.="&amp;search_zipcode=".htmlspecialchars($search_zipcode);
$param.="&amp;search_town=".htmlspecialchars($search_town);
if ($search_categ != '') $param.='&amp;search_categ='.htmlspecialchars($search_categ);
if ($search_sale > 0) $param.='&amp;search_sale='.htmlspecialchars($search_sale);
if ($search_status != '') $param.='&amp;search_status='.htmlspecialchars($search_status);
if ($search_country != '') $param.='&amp;search_country='.htmlspecialchars($search_country);
if ($search_type_thirdparty != '') $param.='&amp;search_type_thirdparty='.htmlspecialchars($search_type_thirdparty);
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss;
print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies.png');
$i = 0;
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
// Filter on categories
$moreforfilter='';
if (! empty($conf->categorie->enabled))
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$formother->select_categories(2,$search_categ,'search_categ',1);
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('SalesRepresentatives'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.='</div>';
}
if ($moreforfilter)
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder);
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_zipcode" value="'.$search_zipcode.'" size="10">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_town" value="'.$search_town.'" size="10">';
print '</td>';
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '</td>';
print '<td class="liste_titre" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_code" value="'.$search_code.'" size="10">';
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input type="text" class="flat" name="search_compta" value="'.$search_compta.'" size="10">';
print '</td>';
print '<td class="liste_titre" align="center">';
print '&nbsp;';
print '</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td class="liste_titre" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</tr>'."\n";
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>';
$thirdpartystatic->id=$obj->rowid;
$thirdpartystatic->name=$obj->name;
$thirdpartystatic->client=$obj->client;
$thirdpartystatic->code_client=$obj->code_client;
$thirdpartystatic->canvas=$obj->canvas;
$thirdpartystatic->status=$obj->status;
$thirdpartystatic->name_alias=$obj->name_alias;
print $thirdpartystatic->getNomUrl(1);
print '</td>';
print '<td>'.$obj->zip.'</td>';
print '<td>'.$obj->town.'</td>';
//Country
print '<td align="center">';
$tmparray=getCountry($obj->fk_pays,'all');
print $tmparray['label'];
print '</td>';
//Type ent
print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print '</td>';
print '<td>'.$obj->code_client.'</td>';
print '<td>'.$obj->code_compta.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td align="center">'.$thirdpartystatic->getLibStatut(3);
print '</td>';
print '<td></td>';
print "</tr>\n";
$i++;
}
$db->free($result);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";
}
else
{
dol_print_error($db);
}
llxFooter();
$db->close();

View File

@ -2181,7 +2181,7 @@ if ($action == 'create')
}
$arrayofinvoiceforpropal = $object->getInvoiceArrayList();
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || ! empty($conf->global->WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES))
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED))
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled&amp;socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>';
}

View File

@ -1,613 +0,0 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013-2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 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
* 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/>.
*/
/**
* \file htdocs/comm/prospect/list.php
* \ingroup prospect
* \brief Page to list prospects
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->load("propal");
$langs->load("companies");
// Security check
$socid = GETPOST("socid",'int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'societe',$socid,'');
$action = GETPOST('action','alpha');
$socname = GETPOST("socname",'alpha');
$stcomm = GETPOST("stcomm",'alpha'); // code
$search_stcomm = GETPOST("search_stcomm",'int');
$search_nom = GETPOST("search_nom");
$search_zipcode = GETPOST("search_zipcode");
$search_town = GETPOST("search_town");
$search_state = GETPOST("search_state");
$search_datec = GETPOST("search_datec");
$search_categ = GETPOST("search_categ",'int');
$search_status = GETPOST("search_status",'int');
$catid = GETPOST("catid",'int');
$search_country = GETPOST("search_country",'int');
$search_type_thirdparty = GETPOST("search_type_thirdparty",'int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom";
$search_level_from = GETPOST("search_level_from","alpha");
$search_level_to = GETPOST("search_level_to","alpha");
// If both parameters are set, search for everything BETWEEN them
if ($search_level_from != '' && $search_level_to != '')
{
// Ensure that these parameters are numbers
$search_level_from = (int) $search_level_from;
$search_level_to = (int) $search_level_to;
// If from is greater than to, reverse orders
if ($search_level_from > $search_level_to)
{
$tmp = $search_level_to;
$search_level_to = $search_level_from;
$search_level_from = $tmp;
}
// Generate the SQL request
$sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range';
}
// If only "from" parameter is set, search for everything GREATER THAN it
else if ($search_level_from != '')
{
// Ensure that this parameter is a number
$search_level_from = (int) $search_level_from;
// Generate the SQL request
$sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range';
}
// If only "to" parameter is set, search for everything LOWER THAN it
else if ($search_level_to != '')
{
// Ensure that this parameter is a number
$search_level_to = (int) $search_level_to;
// Generate the SQL request
$sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range';
}
// If no parameters are set, dont search for anything
else
{
$sortwhere = '0 as is_in_range';
}
// Select every potentiels, and note each potentiels which fit in search parameters
dol_syslog('prospects::prospects_prospect_level',LOG_DEBUG);
$sql = "SELECT code, label, sortorder, ".$sortwhere;
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
$sql.= " WHERE active > 0";
$sql.= " ORDER BY sortorder";
$resql = $db->query($sql);
if ($resql)
{
$tab_level = array();
$search_levels = array();
while ($obj = $db->fetch_object($resql))
{
// Compute level text
$level=$langs->trans($obj->code);
if ($level == $obj->code) $level=$langs->trans($obj->label);
// Put it in the array sorted by sortorder
$tab_level[$obj->sortorder] = $level;
// If this potentiel fit in parameters, add its code to the $search_levels array
if ($obj->is_in_range == 1)
{
$search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"';
}
}
// Implode the $search_levels array so that it can be use in a "IN (...)" where clause.
// If no paramters was set, $search_levels will be empty
$search_levels = implode(',', $search_levels);
}
else dol_print_error($db);
// Load sale and categ filters
$search_sale = GETPOST('search_sale','int');
$search_categ = GETPOST('search_categ','int');
// If the internal user must only see his prospect, force searching by him
if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
// List of available states; we'll need that for each lines (quick changing prospect states) and for search bar (filter by prospect state)
$sts = array(-1,0,1,2,3);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$contextpage='prospectlist';
$hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$socname="";
$stcomm="";
$search_stcomm="";
$search_nom="";
$search_zipcode="";
$search_town="";
$search_state="";
$search_datec="";
$search_categ="";
$search_status="";
$search_country="";
$search_type_thirdparty="";
$search_array_options=array();
}
if ($search_status=='') $search_status=1; // always display active customer first
/*
* Actions
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
if ($action == 'setstcomm')
{
$object = new Client($db);
$result=$object->fetch($socid);
$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');
$action=''; $socid=0;
}
}
/*
* View
*/
$formother=new FormOther($db);
$form=new Form($db);
$formcompany=new FormCompany($db);
$prospectstatic=new Client($db);
$prospectstatic->client=2;
$prospectstatic->loadCacheOfProspStatus();
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
$sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,";
$sql.= " st.libelle as stcomm_label,";
$sql.= " d.nom as departement";
$sql.= " ,s.fk_pays";
$sql.= " ,typent.code as typent_code";
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
// Add fields for extrafields
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) ";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) ";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= " WHERE s.fk_stcomm = st.id";
$sql.= " AND s.client IN (2, 3)";
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc";
if ($socid) $sql.= " AND s.rowid = " .$socid;
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_nom) $sql .= natural_search(array('s.nom','s.name_alias'), $search_nom);
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
if ($search_town) $sql .= natural_search('s.town', $search_town);
if ($search_state) $sql .= natural_search('d.nom', $search_state);
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
// Insert levels filters
if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
// Insert sale filter
if ($search_sale > 0) $sql .= " AND sc.fk_user = ".$db->escape($search_sale);
if ($socname)
{
$sql .= natural_search('s.nom', $search_nom);
$sortfield = "s.nom";
$sortorder = "ASC";
}
// Add where from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= " ORDER BY $sortfield $sortorder, s.nom ASC";
$sql.= $db->plimit($conf->liste_limit+1, $offset);
//print $sql;
dol_syslog('comm/prospect/list.php', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num == 1 && $socname)
{
$obj = $db->fetch_object($resql);
header("Location: card.php?socid=".$obj->socid);
exit;
}
else
{
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url);
}
$param='&search_stcomm='.$search_stcomm;
$param.='&search_nom='.urlencode($search_nom);
$param.='&search_zipcode='.urlencode($search_zipcode);
$param.='&search_town='.urlencode($search_town);
// Store the status filter in the URL
if (isSet($search_setstcomm))
{
foreach ($search_setstcomm as $key => $value)
{
if ($value == 'true')
$param.='&search_setstcomm['.((int) $key).']=true';
else
$param.='&search_setstcomm['.((int) $key).']=false';
}
}
if ($search_level_from != '') $param.='&search_level_from='.$search_level_from;
if ($search_level_to != '') $param.='&search_level_to='.$search_level_to;
if ($search_categ != '') $param.='&search_categ='.urlencode($search_categ);
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
if ($search_status != '') $param.='&search_status='.$search_status;
if ($search_country != '') $param.='&amp;search_country='.$search_country;
if ($search_type_thirdparty != '') $param.='&amp;search_type_thirdparty='.$search_type_thirdparty;
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
print_barre_liste($langs->trans("ListOfProspects"), $page, $_SERVER["PHP_SELF"], $param, $sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies.png');
// Print the search-by-sale and search-by-categ filters
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
// Filter on categories
$moreforfilter='';
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ,'search_categ',1);
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('SalesRepresentatives'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.='</div>';
}
if ($moreforfilter)
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"s.fk_departement","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
// Extrafields
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
{
foreach($extrafields->attribute_list as $key => $val)
{
if ($val)
{
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,"",$sortfield,$sortorder);
}
}
}
// Hook fields
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_nom" size="10" value="'.$search_nom.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_zipcode" size="6" value="'.$search_zipcode.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_town" size="8" value="'.$search_town.'">';
print '</td>';
print '<td class="liste_titre" align="center">';
print '<input type="text" class="flat" name="search_state" size="8" value="'.$search_state.'">';
print '</td>';
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '</td>';
print '<td class="liste_titre" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
print '</td>';
print '<td align="center" class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_datec" value="'.$search_datec.'">';
print '</td>';
// Prospect level
print '<td class="liste_titre" align="center">';
$options_from = '<option value="">&nbsp;</option>'; // Generate in $options_from the list of each option sorted
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
{
$options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>';
$options_from .= $langs->trans($tab_level_label);
$options_from .= '</option>';
}
array_reverse($tab_level, true); // Reverse the list
$options_to = '<option value="">&nbsp;</option>'; // Generate in $options_to the list of each option sorted in the reversed order
foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
{
$options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>';
$options_to .= $langs->trans($tab_level_label);
$options_to .= '</option>';
}
// Print these two select
print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>';
print ' ';
print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>';
print '</td>';
// Prospect status
print '<td class="liste_titre" align="center">';
$arraystcomm=array();
foreach($prospectstatic->cacheprospectstatus as $key => $val)
{
$arraystcomm[$val['id']]=$val['label'];
}
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2);
print '</td>';
print '<td class="liste_titre" align="center">';
print '&nbsp;';
print '</td>';
// Extrafields
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
{
foreach($extrafields->attribute_list as $key => $val)
{
if ($val)
{
$crit=$search_array_options['search_options_'.$key];
print '<td class="liste_titre">';
print $extrafields->showInputField($key, $crit, '', '', 'search_', 4);
print '</td>';
}
}
}
// Hook fields
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Status
print '<td class="liste_titre" align="right">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
// Print the search button
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
print "</tr>\n";
$i = 0;
$var=true;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>';
$prospectstatic->id=$obj->socid;
$prospectstatic->name=$obj->name;
$prospectstatic->status=$obj->status;
$prospectstatic->code_client=$obj->code_client;
$prospectstatic->client=$obj->client;
$prospectstatic->fk_prospectlevel=$obj->fk_prospectlevel;
$prospectstatic->name_alias=$obj->name_alias;
print $prospectstatic->getNomUrl(1,'prospect');
print '</td>';
print "<td>".$obj->zip."</td>";
print "<td>".$obj->town."</td>";
print '<td align="center">'.$obj->departement.'</td>';
//Country
print '<td align="center">';
$tmparray=getCountry($obj->fk_pays,'all');
print $tmparray['label'];
print '</td>';
//Type ent
print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print '</td>';
// Creation date
print '<td align="center">'.dol_print_date($db->jdate($obj->datec)).'</td>';
// Level
print '<td align="center">';
print $prospectstatic->getLibProspLevel();
print "</td>";
// Statut
print '<td align="center" class="nowrap">';
print $prospectstatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']);
print "</td>";
print '<td align="center" class="nowrap">';
foreach($prospectstatic->cacheprospectstatus as $key => $val)
{
$titlealt='default';
if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$obj->socid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page?'&page='.urlencode($page):'').'">'.img_action($titlealt,$val['code']).'</a>';
}
print '</td>';
// Extrafields
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
{
foreach($extrafields->attribute_list as $key => $val)
{
if ($val)
{
print '<td>';
$paramkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$paramkey);
print '</td>';
}
}
}
// Hook fields
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td align="right">';
print $prospectstatic->LibStatut($prospectstatic->status,5);
print '</td>';
print '<td></td>';
print "</tr>\n";
$i++;
}
if ($num > $conf->liste_limit || $page > 0) print_barre_liste('', $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print "</table>";
print "</form>";
$db->free($resql);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
}
else
{
dol_print_error($db);
}
llxFooter();
$db->close();

View File

@ -702,6 +702,7 @@ class Commande extends CommonOrder
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int";
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
$sql.= ", fk_shipping_method";
$sql.= ", fk_warehouse";
$sql.= ", remise_absolue, remise_percent";
$sql.= ", fk_incoterms, location_incoterms";
$sql.= ", entity";
@ -724,6 +725,7 @@ class Commande extends CommonOrder
$sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null");
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL');
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
$sql.= ", ".($this->warehouse_id>0?$this->warehouse_id:'NULL');
$sql.= ", ".($this->remise_absolue>0?$this->db->escape($this->remise_absolue):'NULL');
$sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0);
$sql.= ", ".(int) $this->fk_incoterms;
@ -1063,6 +1065,7 @@ class Commande extends CommonOrder
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
$this->warehouse_id = $object->warehouse_id;
$this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid;
$this->ref_client = $object->ref_client;
@ -1142,7 +1145,7 @@ class Commande extends CommonOrder
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price (without tax)
* @param string $label Label
* @param array $array_options extrafields array
* @param array $array_options extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @return int >0 if OK, <0 if KO
*
@ -1432,6 +1435,7 @@ class Commande extends CommonOrder
$sql.= ', c.date_commande';
$sql.= ', c.date_livraison';
$sql.= ', c.fk_shipping_method';
$sql.= ', c.fk_warehouse';
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
$sql.= ', c.fk_incoterms, c.location_incoterms';
@ -1499,6 +1503,7 @@ class Commande extends CommonOrder
$this->demand_reason_code = $obj->demand_reason_code;
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
$this->warehouse_id = ($obj->fk_warehouse>0)?$obj->fk_warehouse:null;
$this->fk_delivery_address = $obj->fk_delivery_address;
//Incoterms

View File

@ -952,7 +952,7 @@ if ($id > 0 || ! empty($ref))
if ($sep > 0) print '&nbsp;'; // If we had at least one line in future
else print $langs->trans("CurrentBalance");
print ' '.$object->currency_code.'</td>';
print '<td align="right" class="nowrap"><b>'.price($total, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
print '<td align="right" class="nowrap"><b>'.price($total).'</b></td>';
print '<td>&nbsp;</td>';
print '</tr>';
} else {
@ -961,9 +961,9 @@ if ($id > 0 || ! empty($ref))
if ($sep > 0) print '&nbsp;'; // If we had at least one line in future
else print $langs->trans("Total");
print ' '.$object->currency_code.'</td>';
print '<td align="right" class="nowrap"><b>'.price($total_deb*-1, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
print '<td align="right" class="nowrap"><b>'.price($total_cred, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
print '<td align="right" class="nowrap"><b>'.price($total_cred-($total_deb*-1), 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
print '<td align="right" class="nowrap"><b>'.price($total_deb*-1).'</b></td>';
print '<td align="right" class="nowrap"><b>'.price($total_cred).'</b></td>';
print '<td align="right" class="nowrap"><b>'.price($total_cred-($total_deb*-1)).'</b></td>';
print '<td>&nbsp;</td>';
print '</tr>';
}

View File

@ -1283,7 +1283,8 @@ if (empty($reshook))
// Ecrase $txtva par celui du produit
// Ecrase $base_price_type par celui du produit
// Replaces $fk_unit with the product's
if (! empty($idprod)) {
if (! empty($idprod))
{
$prod = new Product($db);
$prod->fetch($idprod);
@ -1304,8 +1305,11 @@ if (empty($reshook))
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
{
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
}
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
@ -1318,26 +1322,30 @@ if (empty($reshook))
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
if ($result) {
if (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines [0]->price);
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
$price_base_type = $prodcustprice->lines [0]->price_base_type;
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
$pu_ht = price($prodcustprice->lines[0]->price);
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$prod->tva_tx = $prodcustprice->lines[0]->tva_tx;
}
}
}
// if price ht is forced (ie: calculated by margin rate and cost price)
if (! empty($price_ht)) {
// if price ht was forced (ie: from gui when calculated by margin rate and cost price)
if (! empty($price_ht))
{
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
elseif ($tva_tx != $prod->tva_tx) {
if ($price_base_type != 'HT') {
elseif ($tva_tx != $prod->tva_tx)
{
if ($price_base_type != 'HT')
{
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
} else {
}
else
{
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
}
}
@ -1870,7 +1878,7 @@ if ($action == 'create')
$objectsrc->fetch_lines();
$objectsrc->fetch_thirdparty();
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
$projectid = (! empty($projectid) ? $projectid : $objectsrc->fk_project);
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
@ -2250,9 +2258,6 @@ if ($action == 'create')
// Project
if (! empty($conf->projet->enabled) && $socid > 0)
{
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
@ -2347,8 +2352,8 @@ if ($action == 'create')
}
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1);
//We check if Origin document has already an invoice attached to it
$objectsrc->fetchObjectLinked($originid,'','','facture');
// We check if Origin document (id and type is known) has already at least one invoice attached to it
$objectsrc->fetchObjectLinked($originid,$origin,'','facture');
$cntinvoice=count($objectsrc->linkedObjects['facture']);
if ($cntinvoice>=1)
{

View File

@ -281,7 +281,7 @@ if ($resql)
if ($search_user > 0) $param.='&search_user=' .$search_user;
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
if ($search_status > 0) $param.='&search_status='.$search_status;
if ($search_status != '') $param.='&search_status='.$search_status;
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png');
$i = 0;

View File

@ -417,6 +417,7 @@ $search_societe = GETPOST("search_societe");
$search_paymentmode = GETPOST("search_paymentmode");
$search_montant_ht = GETPOST("search_montant_ht");
$search_montant_ttc = GETPOST("search_montant_ttc");
$search_status = GETPOST("search_status");
$late = GETPOST("late");
// Do we click on purge search criteria ?
@ -428,6 +429,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_paymentmode='';
$search_montant_ht='';
$search_montant_ttc='';
$search_status='';
}
$sortfield = GETPOST("sortfield",'alpha');
@ -483,6 +485,7 @@ if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmo
if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
if ($search_status) $sql .= " AND f.fk_statut = ".$search_status;
if ($month > 0)
{
if ($year > 0)
@ -528,6 +531,7 @@ if ($resql)
if ($search_societe) $param.='&amp;search_paymentmode='.urlencode($search_paymentmode);
if ($search_montant_ht) $param.='&amp;search_montant_ht='.urlencode($search_montant_ht);
if ($search_montant_ttc) $param.='&amp;search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_status) $param.='&amp;search_status='.urlencode($search_status);
if ($late) $param.='&amp;late='.urlencode($late);
if ($mode) $param.='&amp;mode='.urlencode($mode);
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;

View File

@ -25,6 +25,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
$langs->load("companies");
if (! empty($conf->facture->enabled)) $langs->load("bills");
@ -43,6 +44,7 @@ if ($user->societe_id > 0)
* View
*/
$form = new Form($db);
$userstatic=new User($db);
llxHeader();
@ -58,28 +60,7 @@ if ($socid > 0)
$head = societe_prepare_head($societe);
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company');
print "<table width=\"100%\">\n";
print '<tr><td valign="top" width="50%">';
print '<table class="border" width="100%">';
// Name
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->name.'</td></tr>';
// Prefix
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
print ($societe->prefix_comm?$societe->prefix_comm:'&nbsp;');
print '</td></tr>';
}
print "</table>";
print "</td></tr></table>\n";
print '</div>';
dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
@ -87,6 +68,18 @@ if ($socid > 0)
print load_fiche_titre($langs->trans("CustomerPreview"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("Element").'</td>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td align="right">'.$langs->trans("Debit").'</td>';
print '<td align="right">'.$langs->trans("Credit").'</td>';
print '<td align="right">'.$langs->trans("Balance").'</td>';
print '<td align="right">'.$langs->trans("Author").'</td>';
print '</tr>';
$TData = array();
$TDataSort = array();
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,";
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
@ -95,7 +88,7 @@ if ($socid > 0)
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.fk_user_valid = u.rowid";
$sql.= " ORDER BY f.datef DESC";
$sql.= " ORDER BY f.datef ASC";
$resql=$db->query($sql);
if ($resql)
@ -103,23 +96,6 @@ if ($socid > 0)
$var=true;
$num = $db->num_rows($resql);
print '<tr class="liste_titre">';
print '<td width="100" align="center">'.$langs->trans("Date").'</td>';
print '<td>&nbsp;</td>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td align="right">'.$langs->trans("Debit").'</td>';
print '<td align="right">'.$langs->trans("Credit").'</td>';
print '<td align="right">'.$langs->trans("Balance").'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
if (! $num > 0)
{
print '<tr '.$bc[false].'><td colspan="7">'.$langs->trans("NoInvoice").'</td></tr>';
}
$solde = 0;
// Boucle sur chaque facture
for ($i = 0 ; $i < $num ; $i++)
{
@ -133,29 +109,18 @@ if ($socid > 0)
continue;
}
$totalpaye = $fac->getSommePaiement();
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td align=\"center\">".dol_print_date($fac->date,'day')."</td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id.'">'.img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."</a></td>\n";
print '<td aling="left">'.$fac->getLibStatut(2,$totalpaye).'</td>';
print '<td align="right">'.price($fac->total_ttc)."</td>\n";
if (($fac->statut == Facture::STATUS_ABANDONED ) || ($fac->statut == Facture::STATUS_CLOSED && ! $fact->close_code) ) $solde = $solde = $solde + $totalpaye;
else $solde = $solde + $fac->total_ttc;
print '<td align="right">&nbsp;</td>';
print '<td align="right">'.price($solde)."</td>\n";
// Author
$userstatic->id=$objf->userid;
$userstatic->login=$objf->login;
print '<td class="nowrap" align="right">';
print $userstatic->getLoginUrl(1);
print '</td>';
print "</tr>\n";
$TData[] = array(
'date' => $fac->date,
'link' => $fac->getNomUrl(1),
'status' => $fac->getLibStatut(2,$totalpaye),
'amount' => $fac->total_ttc,
'author' => $userstatic->getLoginUrl(1)
);
$TDataSort[] = $fac->date;
// Paiements
$sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
@ -166,6 +131,7 @@ if ($socid > 0)
$sql.= " WHERE pf.fk_paiement = p.rowid";
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND pf.fk_facture = ".$fac->id;
$sql.= " ORDER BY p.datep ASC";
$resqlp = $db->query($sql);
if ($resqlp)
@ -176,26 +142,21 @@ if ($socid > 0)
while ($j < $nump)
{
$objp = $db->fetch_object($resqlp);
//$var=!$var;
print "<tr ".$bc[$var].">";
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
print '<td>';
print '&nbsp; &nbsp; &nbsp; '; // Decalage
print '<a href="paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'</td>';
print "<td>&nbsp;</td>\n";
print "<td>&nbsp;</td>\n";
print '<td align="right">'.price($objp->amount).'</td>';
$solde = $solde - $objp->amount;
print '<td align="right">'.price($solde)."</td>\n";
// Author
$paymentstatic = new Paiement($db);
$paymentstatic->id = $objp->rowid;
$userstatic->id=$objp->userid;
$userstatic->login=$objp->login;
print '<td class="nowrap" align="right">';
print $userstatic->getLoginUrl(1);
print '</td>';
print '</tr>';
$TData[] = array(
'date' => $db->jdate($objp->dp),
'link' => $langs->trans("Payment") .' '. $paymentstatic->getNomUrl(1),
'status' => '',
'amount' => -$objp->amount,
'author' => $userstatic->getLoginUrl(1)
);
$TDataSort[] = $db->jdate($objp->dp);
$j++;
}
@ -212,9 +173,63 @@ if ($socid > 0)
{
dol_print_error($db);
}
if(empty($TData)) {
print '<tr '.$bc[false].'><td colspan="7">'.$langs->trans("NoInvoice").'</td></tr>';
} else {
// Sort array by date
asort($TDataSort);
array_multisort($TData,$TDataSort);
// Balance calculation
foreach($TData as &$data1) {
$balance += $data1['amount'];
$data1['balance'] += $balance;
}
// Reverse array to have last elements on top
$TData = array_reverse($TData);
$totalDebit = 0;
$totalCredit = 0;
// Display array
foreach($TData as $data) {
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td align=\"center\">".dol_print_date($data['date'],'day')."</td>\n";
print '<td>'.$data['link']."</td>\n";
print '<td aling="left">'.$data['status'].'</td>';
print '<td align="right">'.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."</td>\n";
$totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
print '<td align="right">'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."</td>\n";
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
print '<td align="right">'.price($data['balance'])."</td>\n";
// Author
print '<td class="nowrap" align="right">';
print $data['author'];
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="3">&nbsp;</td>';
print '<td align="right">'.price($totalDebit).'</td>';
print '<td align="right">'.price($totalCredit).'</td>';
print '<td colspan="2">&nbsp;</td>';
print "</tr>\n";
}
print "</table>";
print "<br>";
}
print '</div>';
}
else
{

View File

@ -908,7 +908,7 @@ class Contact extends CommonObject
*/
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='')
{
global $langs;
global $conf, $langs;
$result='';
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
@ -923,7 +923,14 @@ class Contact extends CommonObject
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"';
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowContact");
$link.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$link.= ' title="'.dol_escape_htmltag($label, 1).'"';
$link.= ' class="classfortooltip">';
$linkend='</a>';
if ($option == 'xxx')

View File

@ -246,7 +246,7 @@ if ($resql)
print '<input type="text" class="flat" size="6" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="12" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
//print '<td class="liste_titre">&nbsp;</td>';
@ -292,9 +292,10 @@ if ($resql)
$userstatic->id=$val['id'];
$userstatic->lastname=$val['lastname'];
$userstatic->firstname=$val['firstname'];
print $userstatic->getNomUrl(1);
print '<div class="float">'.$userstatic->getNomUrl(1);
$j++;
if ($j < $nbofsalesrepresentative) print '<br/>';
if ($j < $nbofsalesrepresentative) print ', ';
print '</div>';
}
}
else print $langs->trans("NoSalesRepresentativeAffected");

View File

@ -37,12 +37,77 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$search_boxvalue=GETPOST('q');
$arrayresult=array('a'=>'aaaa', 'b'=>'bbbb');
$arrayresult=array();
if ($conf->projet->enabled)
// Define $searchform
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
{
$arrayresult['searchintoproject']=$langs->trans("SearchIntoProject", $search_boxvalue);
$langs->load("companies");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company'));
$arrayresult['searchintothirdparty']=array('text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue));
}
if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire)
{
$langs->load("companies");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact'));
$arrayresult['searchintocontact']=array('text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue));
}
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
&& empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED))
{
$langs->load("products");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', $langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp', img_object('','product'));
$arrayresult['searchintoproduct']=array('text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue));
}
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire)
{
$langs->load("projects");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub'));
$arrayresult['searchintoprojects']=array('text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue));
}
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
{
$langs->load("members");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', $langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm', img_object('','user'));
$arrayresult['searchintomember']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue));
}
if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->user->user->lire)
{
$langs->load("users");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub'));
$arrayresult['searchintouser']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue));
}
/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag
if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read)
{
$langs->load("hrm");
$searchform.=printSearchForm(DOL_URL_ROOT.'/hrm/employee/list.php', DOL_URL_ROOT.'/hrm/employee/list.php', $langs->trans("Employees"), 'employee', 'search_all', 'M', 'searchleftemployee', img_object('','user'));
}
*/
// Execute hook addSearchEntry
$parameters=array();
$reshook=$hookmanager->executeHooks('addSearchEntry',$parameters);
if (empty($reshook))
{
$arrayresult=array_merge($arrayresult, $hookmanager->resArray);
}
else $arrayresult=$hookmanager->resArray;
print json_encode($arrayresult);
if (is_object($db)) $db->close();

View File

@ -63,8 +63,9 @@ class box_contacts extends ModeleBoxes
if ($user->rights->societe->lire)
{
$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
$sql.= ", s.nom as socname";
$sql.= ", s.code_client";
$sql.= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile";
$sql.= ", s.nom as socname, s.name_alias";
$sql.= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -93,10 +94,21 @@ class box_contacts extends ModeleBoxes
$contactstatic->firstname=$objp->firstname;
$contactstatic->civility_id=$objp->civility_id;
$contactstatic->statut=$objp->status;
$societestatic->id = $objp->fk_soc;
$societestatic->code_client = $objp->code_client;
$contactstatic->phone_pro = $objp->phone;
$contactstatic->phone_perso = $objp->phone_perso;
$contactstatic->phone_mobile = $objp->phone_mobile;
$contactstatic->address = $objp->address;
$contactstatic->zip = $objp->zip;
$contactstatic->town = $objp->town;
$societestatic->id = $objp->fk_soc;
$societestatic->name = $objp->socname;
$societestatic->name_alias = $objp->name_alias;
$societestatic->code_client = $objp->code_client;
$societestatic->code_fournisseur = $objp->code_fournisseur;
$societestatic->client = $objp->client;
$societestatic->fournisseur = $objp->fournisseur;
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $contactstatic->getNomUrl(1),

View File

@ -388,11 +388,16 @@ abstract class CommonDocGenerator
// Add vat by rates
foreach ($object->lines as $line)
{
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
$vatformated=vatrate($line->tva_tx);
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
}
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{

View File

@ -1507,6 +1507,36 @@ abstract class CommonObject
}
/**
* Change the warehouse
*
* @param int $warehouse_id Id of warehouse
* @return int 1 if OK, 0 if KO
*/
function setWarehouse($warehouse_id)
{
if (! $this->table_element) {
dol_syslog(get_class($this)."::setWarehouse was called on objet with property table_element not defined",LOG_ERR);
return -1;
}
if ($warehouse_id<0) $warehouse_id='NULL';
dol_syslog(get_class($this).'::setWarehouse('.$warehouse_id.')');
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_warehouse = ".$warehouse_id;
$sql.= " WHERE rowid=".$this->id;
if ($this->db->query($sql)) {
$this->warehouse_id = ($warehouse_id=='NULL')?null:$warehouse_id;
return 1;
} else {
dol_syslog(get_class($this).'::setWarehouse Error ', LOG_DEBUG);
$this->error=$this->db->error();
return 0;
}
}
/**
* Set last model used by doc generator
*
@ -2231,13 +2261,18 @@ abstract class CommonObject
/**
* Fetch array of objects linked to current object. Links are loaded into this->linkedObjects array and this->linkedObjectsIds
*
* @param int $sourceid Object source id
* @param string $sourcetype Object source type
* @param int $targetid Object target id
* @param string $targettype Object target type
* Possible usage for parameters:
* - all parameters empty -> we look all link to current object (current object can be source or target)
* - one couple id+type is provided -> this will set $justsource or $justtarget
* - one couple id+type is provided and other type is provided -> this will set $justsource or $justtarget + criteria on other type
*
*
* @param int $sourceid Object source id (if not defined, id of object)
* @param string $sourcetype Object source type (if not defined, element name of object)
* @param int $targetid Object target id (if not defined, id of object)
* @param string $targettype Object target type (if not defined, elemennt name of object)
* @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
* @param int $alsosametype 0=Return only links to different object than source. 1=Include also link to objects of same type.
* @param int $alsosametype 0=Return only links to object that differs from source. 1=Include also link to objects of same type.
* @return void
* @see add_object_linked, updateObjectLinked, deleteObjectLinked
*/
@ -2255,12 +2290,12 @@ abstract class CommonObject
if (! empty($sourceid) && ! empty($sourcetype) && empty($targetid))
{
$justsource=true;
$justsource=true; // the source (id and type) is a search criteria
if (! empty($targettype)) $withtargettype=true;
}
if (! empty($targetid) && ! empty($targettype) && empty($sourceid))
{
$justtarget=true;
$justtarget=true; // the target (id and type) is a search criteria
if (! empty($sourcetype)) $withsourcetype=true;
}
@ -2309,13 +2344,27 @@ abstract class CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($obj->fk_source == $sourceid)
if ($justsource || $justtarget)
{
$this->linkedObjectsIds[$obj->targettype][$obj->rowid]=$obj->fk_target;
if ($justsource)
{
$this->linkedObjectsIds[$obj->targettype][$obj->rowid]=$obj->fk_target;
}
else if ($justtarget)
{
$this->linkedObjectsIds[$obj->sourcetype][$obj->rowid]=$obj->fk_source;
}
}
if ($obj->fk_target == $targetid)
else
{
$this->linkedObjectsIds[$obj->sourcetype][$obj->rowid]=$obj->fk_source;
if ($obj->fk_source == $sourceid && $obj->sourcetype == $sourcetype)
{
$this->linkedObjectsIds[$obj->targettype][$obj->rowid]=$obj->fk_target;
}
if ($obj->fk_target == $targetid && $obj->targettype == $targettype)
{
$this->linkedObjectsIds[$obj->sourcetype][$obj->rowid]=$obj->fk_source;
}
}
$i++;
}
@ -2986,60 +3035,60 @@ abstract class CommonObject
print '<tr class="liste_titre nodrag nodrop">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td align="center" width="5">&nbsp;</td>';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum" align="center" width="5">&nbsp;</td>';
// Description
print '<td>'.$langs->trans('Description').'</td>';
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
if ($this->element == 'askpricesupplier')
{
print '<td align="right"><span id="title_fourn_ref">'.$langs->trans("AskPriceSupplierRefFourn").'</span></td>';
print '<td class="linerefsupplier" align="right"><span id="title_fourn_ref">'.$langs->trans("AskPriceSupplierRefFourn").'</span></td>';
}
// VAT
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
print '<td class="linecolvat" align="right" width="50">'.$langs->trans('VAT').'</td>';
// Price HT
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
print '<td class="linecoluht" align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">'.$langs->trans('PriceUTTC').'</td>';
// Qty
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
print '<td class="linecolqty" align="right" width="50">'.$langs->trans('Qty').'</td>';
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td align="left" width="50">'.$langs->trans('Unit').'</td>';
print '<td class="linecoluseunit" align="left" width="50">'.$langs->trans('Unit').'</td>';
}
// Reduction short
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
print '<td class="linecoldiscount" align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
if ($this->situation_cycle_ref) {
print '<td align="right" width="50">' . $langs->trans('Progress') . '</td>';
print '<td class="linecolcycleref" align="right" width="50">' . $langs->trans('Progress') . '</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
{
if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" class="margininfos" width="80">'.$langs->trans('BuyingPrice').'</td>';
print '<td class="linecolmargin1 margininfos" align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
else
print '<td align="right" class="margininfos" width="80">'.$langs->trans('CostPrice').'</td>';
print '<td class="linecolmargin1 margininfos" align="right" width="80">'.$langs->trans('CostPrice').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous)
print '<td align="right" class="margininfos" width="50">'.$langs->trans('MarginRate').'</td>';
print '<td class="linecolmargin2 margininfos" align="right" width="50">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous)
print '<td align="right" class="margininfos" width="50">'.$langs->trans('MarkRate').'</td>';
print '<td class="linecolmargin2 margininfos" align="right" width="50">'.$langs->trans('MarkRate').'</td>';
}
// Total HT
print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
print '<td class="linecolht" align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
print '<td></td>'; // No width to allow autodim
print '<td class="linecoledit"></td>'; // No width to allow autodim
print '<td width="10"></td>';
print '<td class="linecoldelete" width="10"></td>';
print '<td width="10"></td>';
print '<td class="linecolmove" width="10"></td>';
print "</tr>\n";
@ -3782,10 +3831,10 @@ abstract class CommonObject
foreach ($tab as $key => $value)
{
// Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine)
// Test fetch_array ! is_int($key) because fetch_array result is a mix table with Key as alpha and Key as int (depend db engine)
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
{
// we can add this attribute to adherent object
// we can add this attribute to object
$this->array_options["options_".$key]=$value;
}
}
@ -3833,7 +3882,7 @@ abstract class CommonObject
/**
* Add/Update all extra fields values for the current object.
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* This function delte record with all extrafields and insert them again from the array $this->array_options.
* This function delete record with all extrafields and insert them again from the array $this->array_options.
*
* @return int -1=error, O=did nothing, 1=OK
*/
@ -3887,12 +3936,25 @@ abstract class CommonObject
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
if ($value)
{
$object->fetch(0,$value);
$this->array_options[$key]=$object->id;
}
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$object = new $InfoFieldList[0]($this->db);
if ($value)
{
$res=$object->fetch(0,$value);
if ($res > 0) $this->array_options[$key]=$object->id;
else
{
$this->error="Ref '".$value."' for object '".$object->element."' not found";
$this->db->rollback();
return -1;
}
}
}
else
{
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
}
break;
}
}

View File

@ -111,7 +111,7 @@ class ExtraFields
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param string $default_value Defaulted value
* @param string $default_value Defaulted value (Example: '', '0', 'null', 'avalue')
* @param array $param Params for field
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
@ -1085,10 +1085,19 @@ class ExtraFields
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$object->ref.'" >';
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$valuetoshow=$object->ref;
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ref is id because name is not unique
$out.='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$valuetoshow.'" >';
}
else
{
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
$out.='Error bad setup of extrafield';
}
}
/* Add comments
if ($type == 'date') $out.=' (YYYY-MM-DD)';
@ -1326,9 +1335,17 @@ class ExtraFields
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$value=$object->getNomUrl(3);
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$value=$object->getNomUrl(3);
}
else
{
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
$out.='Error bad setup of extrafield';
}
}
}
elseif ($type == 'text')

View File

@ -144,6 +144,21 @@ class HookManager
'formBuilddocLineOptions',
'moveUploadedFile',
'pdf_writelinedesc',
'pdf_getlinenum',
'pdf_getlineref',
'pdf_getlineref_supplier',
'pdf_getlinevatrate',
'pdf_getlineupexcltax',
'pdf_getlineupwithtax',
'pdf_getlineqty',
'pdf_getlineqty_asked',
'pdf_getlineqty_shipped',
'pdf_getlineqty_keeptoship',
'pdf_getlineunit',
'pdf_getlineremisepercent',
'pdf_getlineprogress',
'pdf_getlinetotalexcltax',
'pdf_getlinetotalwithtax',
'paymentsupplierinvoices',
'printAddress',
'printSearchForm',

View File

@ -4501,27 +4501,34 @@ class Form
/**
* Return a HTML select string, built from an array of key+value but content returned into select come from an Ajax call of an URL.
* Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
* Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.
*
* @param string $htmlname Name of html select area
* @param string $url Url
* @param string $url Url. Must return a json_encode of array(key=>array('text'=>'A text', 'url'=>'An url'), ...)
* @param string $id Preselected key
* @param string $moreparam Add more parameters onto the select tag
* @param string $moreparamtourl Add more parameters onto the Ajax called URL
* @param int $disabled Html select box is disabled
* @param int $minimumInputLength Minimum Input Length
* @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.
*/
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='')
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='')
{
global $langs;
$out = '';
$tmpplugin='select2';
$out.='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
<script type="text/javascript">
$(document).ready(function () {
$(".'.$htmlname.'").select2({
'.($callurlonselect ? 'var saveRemoteData = [];':'').'
$(".'.$htmlname.'").select2({
ajax: {
dir: "ltr",
url: "'.$url.'",
@ -4535,8 +4542,14 @@ class Form
},
results: function (remoteData, pageNumber, query) {
console.log(remoteData);
return {results:[{id:\'none\', text:\'aa\'}, {id:\'rrr\', text:\'Red\'},{id:\'bbb\', text:\'Search a into projects\'}], more:false}
//return {results:[remoteData], more:false}
saveRemoteData = remoteData;
/* format json result for select2 */
result = []
$.each( remoteData, function( key, value ) {
result.push({id: key, text: value.text});
});
//return {results:[{id:\'none\', text:\'aa\'}, {id:\'rrr\', text:\'Red\'},{id:\'bbb\', text:\'Search a into projects\'}], more:false}
return {results: result, more:false}
},
/*processResults: function (data, page) {
// parse the results into the format expected by Select2.
@ -4549,18 +4562,26 @@ class Form
},*/
cache: true
},
placeholder: "'.dol_escape_js($placeholder).'",
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: '.$minimumInputLength.',
//templateResult: formatRepo, // omitted for brevity, see the source of this page
//templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
formatResult: function(result, container, query, escapeMarkup) {
return escapeMarkup(result.text);
}
});
$(".'.$htmlname.'").change(function() {
alert(\'eee\');
$(".'.$htmlname.'").select2.clearSearch();
} );
'.($callurlonselect ? '
$(".'.$htmlname.'").change(function() {
var selected = $(".'.$htmlname.'").select2("val");
$(".'.$htmlname.'").select2("val",""); /* reset visible combo value */
$.each( saveRemoteData, function( key, value ) {
if (key == selected)
{
console.log("Do a redirect into selectArrayAjax to "+value.url)
location.assign(value.url);
}
});
});' : '' ) . '
});
</script>';
@ -5248,10 +5269,12 @@ class Form
* @param int $height Height of photo (auto if 0)
* @param int $caneditfield Add edit fields
* @param string $cssclass CSS name to use on img for photo
* @param int $genericifundef Use a generic image if no image avaiable
* @param string $imagesize 'mini', 'small' or '' (original)
* @param int $addlinktofullsize Add link to fullsize image
* @param int $cache 1=Accept to use image in cache
* @return string HTML code to output photo
*/
static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $genericifundef=0)
static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='', $addlinktofullsize=1, $cache=0)
{
global $conf,$langs;
@ -5265,47 +5288,73 @@ class Form
$dir=$conf->societe->multidir_output[$entity];
$smallfile=$object->logo;
$smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile);
if (! empty($object->logo)) $file=$id.'/logos/thumbs/'.$smallfile;
if (! empty($object->logo))
{
if ((string) $imagesize == 'mini') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_mini');
else if ((string) $imagesize == 'small') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_small');
else $file=$id.'/logos/thumbs/'.$smallfile;
}
}
else if ($modulepart=='contact')
{
$dir=$conf->societe->multidir_output[$entity].'/contact';
$file=$id.'/photos/'.$object->photo;
if (! empty($object->photo))
{
if ((string) $imagesize == 'mini') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_mini');
else if ((string) $imagesize == 'small') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_small');
else $file=$id.'/photos/'.$object->photo;
}
}
else if ($modulepart=='userphoto')
{
$dir=$conf->user->dir_output;
if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo;
if (! empty($object->photo))
{
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_mini');
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_small');
else $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo;
}
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email;
}
else if ($modulepart=='memberphoto')
{
$dir=$conf->adherent->dir_output;
if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo;
if (! empty($object->photo))
{
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
else $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo;
}
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email;
} else {
}
else
{
$dir=$conf->$modulepart->dir_output;
if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo;
if (! empty($object->photo))
{
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini');
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small');
else $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo;
}
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email;
}
if ($dir)
{
$cache='0';
if ($file && file_exists($dir."/".$file))
{
$ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
if ($addlinktofullsize) $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
$ret.='<img alt="Photo" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
$ret.='</a>';
if ($addlinktofullsize) $ret.='</a>';
}
else if ($altfile && file_exists($dir."/".$altfile))
{
$ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
if ($addlinktofullsize) $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
$ret.='<img alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">';
$ret.='</a>';
if ($addlinktofullsize) $ret.='</a>';
}
else
{

View File

@ -176,22 +176,24 @@ class FormFile
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<table width="100%" class="nobordernopadding">';
$out .= '<tr>';
$out .= '<td valign="middle" class="nowrap">';
$out .= $langs->trans("URLToLink") . ': ';
$out .= '<div>';
$out .= '<div class="float" style="padding-right: 10px;">';
$out .= '<label for="link">'.$langs->trans("URLToLink") . '</label>: ';
$out .= '<input type="text" name="link" size="'.$maxlength.'" id="link">';
$out .= ' &nbsp; ' . $langs->trans("Label") . ': ';
$out .= '</div>';
$out .= '<div class="float" style="padding-right: 10px;">';
$out .= '<label for="label">'.$langs->trans("Label") . '</label>: ';
$out .= '<input type="text" name="label" id="label">';
$out .= '<input type="hidden" name="objecttype" value="' . $object->element . '">';
$out .= '<input type="hidden" name="objectid" value="' . $object->id . '">';
$out .= '&nbsp;';
$out .= '</div>';
$out .= '<div class="float" style="padding-right: 10px;">';
$out .= '<input type="submit" class="button" name="linkit" value="'.$langs->trans("ToLink").'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
$out .= '>';
$out .= '</td></tr>';
$out .= '</table>';
$out .= '</div>';
$out .= '</div>';
$out .= '<div class="clearboth"></div>';
$out .= '</form><br>';
$parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm);
$res = $hookmanager->executeHooks('formattachOptions',$parameters,$object);
@ -492,7 +494,7 @@ class FormFile
$out.= '<input type="hidden" name="action" value="builddoc">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out.= '<div class="titre">'.$titletoshow.'</div>';
$out.= load_fiche_titre($titletoshow, '', '');
$out.= '<table class="liste formdoc noborder" summary="listofdocumentstable" width="100%">';
$out.= '<tr class="liste_titre">';

View File

@ -302,7 +302,7 @@ class FormOther
/**
* Return select list for categories (to use in form search selectors)
*
* @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members)
* @param int $type Type of categories (0=product, 1=supplier, 2=customer, 3=member, 4=contact)
* @param integer $selected Preselected value
* @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized"
@ -598,7 +598,7 @@ class FormOther
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$color = colorArrayToHex(colorStringToArray($color,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 40px; background-color: #'.$color.'" value="'.$color.'">';
else print $textifnotdefined;
}

View File

@ -678,9 +678,11 @@ function activateModule($value,$withdeps=1)
$ret='';
$modName = $value;
$modFile = $modName . ".class.php";
$modulesdir = dolGetModulesDirs();
// Loop on each directory
// Loop on each directory to fill $modulesdir
$modulesdir = dolGetModulesDirs();
// Loop on each modulesdir directories
$found=false;
foreach ($modulesdir as $dir)
{
@ -775,9 +777,11 @@ function unActivateModule($value, $requiredby=1)
$ret='';
$modName = $value;
$modFile = $modName . ".class.php";
$modulesdir = dolGetModulesDirs();
// Loop on each directory
// Loop on each directory to fill $modulesdir
$modulesdir = dolGetModulesDirs();
// Loop on each modulesdir directories
$found=false;
foreach ($modulesdir as $dir)
{
@ -887,13 +891,13 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
if ($modulequalified)
{
// Load languages files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
{
foreach($objMod->langfiles as $langfile)
{
$langs->load($langfile);
}
}
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
{
foreach($objMod->langfiles as $langfile)
{
$langs->load($langfile);
}
}
// Complete arrays
//&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond
@ -943,12 +947,113 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
return 1;
}
/**
* Add external modules to list of contact element
*
* @param array $elementList elementList
* @return int 1
*/
function complete_elementList_with_modules(&$elementList)
{
global $db, $modules, $conf, $langs;
// Search modules
$filename = array();
$modules = array();
$orders = array();
$categ = array();
$dirmod = array();
$i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined.
$modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir)
{
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog("Scan directory ".$dir." for modules");
$handle=@opendir(dol_osencode($dir));
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
//print "$i ".$file."\n<br>";
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{
include_once $dir.$file;
$objMod = new $modName($db);
if ($objMod->numero > 0)
{
$j = $objMod->numero;
}
else
{
$j = 1000 + $i;
}
$modulequalified=1;
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
//If module is not activated disqualified
if (empty($conf->global->$const_name)) $modulequalified=0;
if ($modulequalified)
{
// Load languages files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
{
foreach($objMod->langfiles as $langfile)
{
$langs->load($langfile);
}
}
$modules[$i] = $objMod;
$filename[$i]= $modName;
$orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module
//print "x".$modName." ".$orders[$i]."\n<br>";
if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories
else $categ[$objMod->special]=1;
$dirmod[$i] = $dirroot;
if (! empty($objMod->module_parts['contactelement']))
{
$elementList[$objMod->name] = $langs->trans($objMod->name);
//exit;
}
$j++;
$i++;
}
else dol_syslog("Module ".get_class($objMod)." not qualified");
}
}
}
closedir($handle);
}
else
{
dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
}
}
return 1;
}
/**
* Show array with constants to edit
*
* @param array $tableau Array of constants
* @param int $strictw3c Respect W3C (no form into table)
* @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (no form into table), 2=No form nor button at all
* @return void
*/
function form_constantes($tableau,$strictw3c=0)
@ -957,7 +1062,7 @@ function form_constantes($tableau,$strictw3c=0)
$form = new Form($db);
if (! empty($strictw3c)) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
if (! empty($strictw3c) && $strictw3c == 1) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -1094,7 +1199,7 @@ function form_constantes($tableau,$strictw3c=0)
}
print '</table>';
if (! empty($strictw3c))
if (! empty($strictw3c) && $strictw3c == 1)
{
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print "</form>\n";

View File

@ -91,6 +91,13 @@ function societe_prepare_head(Societe $object)
$head[$h][2] = 'agenda';
$h++;
}
if (! empty($conf->projet->enabled) && (!empty($user->rights->projet->lire) ))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Projects");
$head[$h][2] = 'project';
$h++;
}
//show categorie tab
/*if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
@ -456,9 +463,10 @@ function getFormeJuridiqueLabel($code)
* @param DoliDB $db Database handler
* @param Object $object Third party object
* @param string $backtopage Url to go once contact is created
* @param int $nocreatelink 1=Hide create project link
* @return void
*/
function show_projects($conf,$langs,$db,$object,$backtopage='')
function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0)
{
global $user;
global $bc;
@ -470,7 +478,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
$langs->load("projects");
$buttoncreate='';
if (! empty($conf->projet->enabled) && $user->rights->projet->creer)
if (! empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink))
{
//$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject");
@ -864,13 +872,13 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
/**
* Show html area with actions to do
*
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
* @param Adherent|Societe $object Object third party or member
* @param Contact $objcon Object contact
* @param int $noprint Return string but does not output it
* @return mixed Return html part or void if noprint is 1
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
* @param Adherent|Societe $object Object third party or member
* @param Contact $objcon Object contact
* @param int $noprint Return string but does not output it
* @return mixed Return html part or void if noprint is 1
*/
function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
{

View File

@ -886,7 +886,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
} else {
$morehtmlright.=$object->getLibStatut(2);
}
if (! empty($object->name_nalias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>';
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>';
$morehtmlref.='<div class="refidno">';
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
$morehtmlref.='</div>';
@ -1544,9 +1544,9 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep
}
}
if (! empty($addlink)) // Link on phone number + link to add action (if conf->global->AGENDA_ADDACTIONFORPHONE set)
if (! empty($addlink)) // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
{
if (! empty($conf->browser->phone)) // If phone, we use link of phone
if (! empty($conf->browser->phone) || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone
{
$newphone ='<a href="tel:'.$phone.'"';
$newphone.='>'.$phone.'</a>';
@ -1689,10 +1689,10 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint=0)
$showgmap=$showomap=0;
// TODO Add a hook here
if ($mode=='thirdparty' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS)) $showgmap=1;
if (($mode=='thirdparty' || $mode =='societe') && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS)) $showgmap=1;
if ($mode=='contact' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) $showgmap=1;
if ($mode=='member' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) $showgmap=1;
if ($mode=='thirdparty' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) $showomap=1;
if (($mode=='thirdparty' || $mode =='societe') && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) $showomap=1;
if ($mode=='contact' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) $showomap=1;
if ($mode=='member' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) $showomap=1;
@ -4384,7 +4384,7 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='', $wit
*
* @param string $firstname Firstname
* @param string $lastname Lastname
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname
* @return string Firstname + lastname or Lastname + firstname
*/
function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
@ -5223,3 +5223,32 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
return $res;
}
/**
* Return the filename of file to get the thumbs
*
* @param string $file Original filename
* @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
*/
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 = basename($fileName);
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpg$/i',$file)?'.jpg':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpeg$/i',$file)?'.jpeg':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.gif$/i',$file)?'.gif':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.png$/i',$file)?'.png':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.bmp$/i',$file)?'.bmp':'');
if (! $extImgTarget) return $file;
$subdir='';
if ($extName) $subdir = 'thumbs/';
return $dirName.$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
}

120
htdocs/core/lib/hrm.lib.php Normal file
View File

@ -0,0 +1,120 @@
<?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/>.
*/
/**
* \file htdocs/core/lib/hrm.lib.php
* \ingroup HRM
* \brief Library for hrm
*/
$langs->load('hrm');
/**
* Return head table for employee tabs screen
*
* @param object $object contact
* @return array head table of tabs
*/
function employee_prepare_head($object) {
global $langs, $conf, $user;
$h = 0;
$head = array ();
$head [$h] [0] = DOL_URL_ROOT.'/hrm/employee/card.php?id=' . $object->id;
$head [$h] [1] = $langs->trans("Card");
$head [$h] [2] = 'card';
$h ++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'employee');
$head [$h] [0] = DOL_URL_ROOT.'/hrm/employee/info.php?id=' . $object->id;
$head [$h] [1] = $langs->trans("Info");
$head [$h] [2] = 'info';
$h ++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'employee', 'remove');
return $head;
}
/**
* Return head table for establishment tabs screen
*
* @param Establishment $object Object related to tabs
* @return array Array of tabs to show
*/
function establishment_prepare_head($object)
{
global $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment');
$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove');
return $head;
}
/**
* Return array head with list of tabs to view object informations
*
* @return array head
*/
function hrm_admin_prepare_head()
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_hrm.php';
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'parameters';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php';
$head[$h][1] = $langs->trans("Establishments");
$head[$h][2] = 'establishments';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin');
complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin','remove');
return $head;
}

View File

@ -483,7 +483,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
break;
case IMAGETYPE_JPEG: // 2
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
$extImgTarget = (preg_match('/\.jpeg$/',$file)?'.jpeg':'.jpg');
$extImgTarget = (preg_match('/\.jpeg$/i',$file)?'.jpeg':'.jpg');
$newquality=$quality;
break;
case IMAGETYPE_PNG: // 3
@ -512,7 +512,7 @@ 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.'/'.$fileName.$extName.$extImgTarget; // Chemin complet du fichier de la vignette
$imgThumbName = $dirthumb.'/'.getImageFileNameForSize($file, $extName, $extImgTarget); // Chemin complet du fichier de la vignette
// Check if permission are ok
//$fp = fopen($imgThumbName, "w");

View File

@ -1032,20 +1032,23 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
* @param int $hideref Hide reference
* @param int $hidedesc Hide description
* @param int $issupplierline Is it a line for a supplier object ?
* @return string|null
* @return string
*/
function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0)
{
global $db, $conf, $langs, $hookmanager;
$reshook=0;
if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('pdf'=>$pdf,'i'=>$i,'outputlangs'=>$outputlangs,'w'=>$w,'h'=>$h,'posx'=>$posx,'posy'=>$posy,'hideref'=>$hideref,'hidedesc'=>$hidedesc,'issupplierline'=>$issupplierline,'special_code'=>$special_code);
$action='';
$reshook=$hookmanager->executeHooks('pdf_writelinedesc',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
if (empty($reshook))
{
@ -1054,6 +1057,7 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
$pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1, false, true, 'J',true);
return $labelproductservice;
}
return '';
}
/**
@ -1250,22 +1254,25 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return null|string
* @return string
*/
function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
// TODO add hook function
}
else
if (empty($reshook))
{
return dol_htmlentitiesbr($object->lines[$i]->num);
}
return '';
}
@ -1276,22 +1283,25 @@ function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return null|string
* @return string
*/
function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
// TODO add hook function
}
else
if (empty($reshook))
{
return dol_htmlentitiesbr($object->lines[$i]->product_ref);
}
return '';
}
/**
@ -1301,22 +1311,25 @@ function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return null|string
* @return string
*/
function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
// TODO add hook function
}
else
if (empty($reshook))
{
return dol_htmlentitiesbr($object->lines[$i]->ref_supplier);
}
return '';
}
/**
@ -1332,7 +1345,9 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1340,13 +1355,13 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlinevatrate',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
else
if (empty($reshook))
{
if (empty($hidedetails) || $hidedetails > 1) return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1);
}
return '';
}
/**
@ -1365,7 +1380,9 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1373,13 +1390,13 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineupexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
if (!empty($hookmanager->resPrint)) print $hookmanager->resPrint;
}
else
if (empty($reshook))
{
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->subprice, 0, $outputlangs);
}
return '';
}
/**
@ -1389,25 +1406,29 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide value (0 = no, 1 = yes, 2 = just special lines)
* @return void
* @return string
*/
function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
foreach($object->hooks as $modules)
{
if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails);
}
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineupwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint)) print $hookmanager->resPrint;
}
else
if (empty($reshook))
{
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
}
return '';
}
/**
@ -1423,25 +1444,25 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code != 3)
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty;
}
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty;
}
return '';
}
/**
@ -1457,24 +1478,24 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code != 3)
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_asked;
}
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_asked;
}
return '';
}
/**
@ -1490,24 +1511,24 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code != 3)
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_shipped;
}
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_shipped;
}
return '';
}
/**
@ -1517,30 +1538,30 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code != 3)
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return ($object->lines[$i]->qty_asked - $object->lines[$i]->qty_shipped);
}
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) return ($object->lines[$i]->qty_asked - $object->lines[$i]->qty_shipped);
}
return '';
}
/**
@ -1556,31 +1577,32 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = false)
{
global $langs;
if ($object->lines[$i]->special_code != 3) {
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) {
$special_code = $object->lines[$i]->special_code;
if (!empty($object->lines[$i]->fk_parent_line)) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code
);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object,
$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
} else {
if (empty($hidedetails) || $hidedetails > 1) {
return $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
}
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
$special_code = $object->lines[$i]->special_code;
if (!empty($object->lines[$i]->fk_parent_line)) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code
);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) return $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
}
return '';
}
@ -1599,24 +1621,24 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if ($object->lines[$i]->special_code != 3)
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
}
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
}
return '';
}
/**
@ -1627,24 +1649,28 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
* @return string
*/
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
{
if ($object->lines[$i]->special_code != 3) {
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) {
$special_code = $object->lines[$i]->special_code;
if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
} else {
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->situation_percent . '%';
}
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
$special_code = $object->lines[$i]->special_code;
if (!empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->situation_percent . '%';
}
return '';
}
/**
@ -1663,27 +1689,25 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
if ($object->lines[$i]->special_code == 3)
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
return $outputlangs->transnoentities("Option");
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code, 'sign'=>$sign);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
else
if (empty($reshook))
{
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht, 0, $outputlangs);
}
if ($object->lines[$i]->special_code == 3)
{
return $outputlangs->transnoentities("Option");
}
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht, 0, $outputlangs);
}
return '';
}
@ -1701,27 +1725,25 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code == 3)
$reshook=0;
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
{
return $outputlangs->transnoentities("Option");
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
}
else
if (empty($reshook))
{
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action='';
$reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
else return $reshook;
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
}
if ($object->lines[$i]->special_code == 3)
{
return $outputlangs->transnoentities("Option");
}
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
}
return '';
}

View File

@ -74,7 +74,7 @@ function dol_decode($chain)
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
*
* @param string $chain String to hash
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5)
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0.
* @return string Hash of string
*/
function dol_hash($chain,$type=0)

View File

@ -414,7 +414,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
{
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 40px; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("None");
}
print ' &nbsp; ('.$langs->trans("Default").': <strong>edf4fb</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
@ -440,7 +440,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
else
{
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 40px; background-color: #'.$color.'" value="'.$color.'">';
else print '';
}
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
@ -459,7 +459,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
else
{
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 40px; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");
}
print ' &nbsp; ('.$langs->trans("Default").': <strong>6e7896</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';

View File

@ -91,7 +91,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
if (! $passok)
{
if ((! $passcrypted || $passtyped)
&& ($passtyped == $passclear))
&& ($passclear && ($passtyped == $passclear)))
{
$passok=true;
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found pass in database");

View File

@ -69,11 +69,11 @@ 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->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 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->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/soc.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 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->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 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->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/fourn/list.php?leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->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->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->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->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/soc.php?leftmenu=supplier&amp;action=create&amp;type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/prospect/list.php?leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/soc.php?leftmenu=prospects&amp;action=create&amp;type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/list.php?leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->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->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/soc.php?leftmenu=customers&amp;action=create&amp;type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
-- Third parties - Contacts
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->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);

View File

@ -590,13 +590,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{
$langs->load("commercial");
$newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects');
$newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects');
/* no more required, there is a filter that can do more
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
*/
$newmenu->add("/societe/soc.php?leftmenu=prospects&amp;action=create&amp;type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer);
//$newmenu->add("/contact/list.php?leftmenu=customers&amp;type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
@ -606,7 +606,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
{
$langs->load("commercial");
$newmenu->add("/comm/list.php?leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers');
$newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers');
$newmenu->add("/societe/soc.php?leftmenu=customers&amp;action=create&amp;type=c", $langs->trans("MenuNewCustomer"), 2, $user->rights->societe->creer);
//$newmenu->add("/contact/list.php?leftmenu=customers&amp;type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
@ -616,10 +616,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
{
$langs->load("suppliers");
$newmenu->add("/fourn/list.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
$newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
$newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
//$newmenu->add("/fourn/list.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire);
//$newmenu->add("/contact/list.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire);
}
// Contacts
@ -1146,7 +1144,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Security check
$newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire);
$newmenu->add("/fourn/list.php",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
$newmenu->add("/societe/list.php?type=f",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
$newmenu->add("/contact/list.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire);
$newmenu->add("/fourn/stats.php",$langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
}

View File

@ -0,0 +1,250 @@
<?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/>.
*/
/**
* \file htdocs/core/modules/modHRM.class.php
* \ingroup HRM
* \brief Description and activation file for module HRM
*/
include_once (DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php");
/**
* Class to describe and activate the HRM module
*/
class modHRM extends DolibarrModules
{
/**
* Constructor.
* Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db
*/
public function __construct($db)
{
global $langs, $conf;
$this->db = $db;
$this->numero = 4000;
$this->rights_class = 'hrm';
$this->family = "hr";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace ( '/^mod/i', '', get_class ( $this ) );
$this->description = "Gestion des ressources humaines";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
$this->const_name = 'MAIN_MODULE_' . strtoupper ( $this->name );
$this->special = 0;
// $this->picto = '';
// define triggers
$this->module_parts = array();
// Data directories to create when module is enabled
$this->dirs = array();
// Config pages
$this->config_page_url = array('admin_hrm.php@hrm');
// Dependencies
$this->depends = array();
$this->requiredby = array(/*"
modSalaries,
modExpenseReport,
modHoliday
"*/);
$this->conflictwith = array();
$this->phpmin = array (
5,
3
); // Minimum version of PHP required by module
$this->need_dolibarr_version = array (
3,
7
); // Minimum version of Dolibarr required by module
$this->langfiles = array (
"hrm"
);
// Dictionnaries
$this->dictionnaries=array(
'langs'=>'hrm',
'tabname'=>array(
MAIN_DB_PREFIX."c_hrm_department",
MAIN_DB_PREFIX."c_hrm_function"
),
'tablib'=>array(
"DepartmentDict",
"FunctionDict"
),
'tabsql'=>array(
'SELECT rowid, pos, code, label, active FROM '.MAIN_DB_PREFIX.'c_hrm_department',
'SELECT rowid, pos, code, label, c_level, active FROM '.MAIN_DB_PREFIX.'c_hrm_department'
),
'tabsqlsort'=>array(
'rowid ASC',
'rowid ASC'
),
'tabfield'=>array(
"code,label",
"code,label"
),
'tabfieldvalue'=>array(
"code,label",
"code,label"
),
'tabfieldinsert'=>array(
"code,label",
"code,label"
),
'tabrowid'=>array(
"rowid",
"rowid"
),
'tabcond'=>array(
'$conf->hrm->enabled',
'$conf->hrm->enabled'
)
);
// Constantes
$this->const = array ();
$r = 0;
// Boxes
$this->boxes = array ();
// Permissions
$this->rights = array(); // Permission array used by this module
$r = 0;
$this->rights[$r][0] = 4001;
$this->rights[$r][1] = 'See employees';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'read';
$r ++;
$this->rights[$r][0] = 4002;
$this->rights[$r][1] = 'Create employees';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'write';
$r ++;
$this->rights[$r][0] = 4003;
$this->rights[$r][1] = 'Delete employees';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'delete';
$r ++;
$this->rights[$r][0] = 4004;
$this->rights[$r][1] = 'Export employees';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'export';
$r ++;
// Main menu entries
$this->menus = array (); // List of menus to add
$r = 0;
$this->menu[$r] = array (
'fk_menu' => 'fk_mainmenu=hrm',
'type' => 'left',
'titre' => 'Employees',
'leftmenu' => 'employee',
'mainmenu' => 'hrm',
'url' => '/hrm/employee/index.php',
'langs' => 'hrm',
'position' => 100,
'enabled' => '$user->rights->hrm->employee->read',
'perms' => '$user->rights->hrm->employee->read',
'target' => '',
'user' => 0
);
$r ++;
$this->menu[$r] = array(
'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=employee',
'type' => 'left',
'titre' => 'NewEmployee',
'mainmenu' => 'hrm',
'url' => '/hrm/employee/card.php?action=create',
'langs' => 'hrm',
'position' => 101,
'enabled' => '$user->rights->hrm->employee->write',
'perms' => '$user->rights->hrm->employee->write',
'target' => '',
'user' => 0
);
$r ++;
$this->menu[$r] = array(
'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=employee',
'type' => 'left',
'titre' => 'List',
'mainmenu' => 'hrm',
'url' => '/hrm/employee/list.php',
'langs' => 'hrm',
'position' => 102,
'enabled' => '$user->rights->hrm->employee->read',
'perms' => '$user->rights->hrm->employee->read',
'target' => '',
'user' => 0
);
$r ++;
$this->menu[$r] = array(
'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=employee',
'type' => 'left',
'titre' => 'Statistics',
'mainmenu' => 'hrm',
'url' => '/hrm/employee/stats.php',
'langs' => 'hrm',
'position' => 103,
'enabled' => '$user->rights->hrm->employee->read',
'perms' => '$user->rights->hrm->employee->read',
'target' => '',
'user' => 0
);
$r ++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus
* (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Enabling module ('', 'noboxes')
* @return int if OK, 0 if KO
*/
function init($options='')
{
// Permissions
$this->remove($options);
$sql = array();
return $this->_init($sql,$options);
}
}

View File

@ -100,9 +100,12 @@
<table class="nobordernopadding">
<tr><td>
<textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo GETPOST('param'); ?></textarea>
</td><td id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></td>
<td><span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></span>
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?></span></td></tr>
</td><td>
<span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></span>
<span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></span>
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?></span>
<span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0)?></span>
</td></tr>
</table>
</td>

View File

@ -93,7 +93,7 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') )
<tr><td><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo $extrafields->attribute_pos[$attrname]; ?>"></td></tr>
<!-- Value (for select list / radio) -->
<?php
if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($type == 'chkbxlst') || ($type == 'radio'))
if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($type == 'chkbxlst') || ($type == 'radio') || ($type == 'link'))
{
?>
<tr id="value_choice">

View File

@ -49,36 +49,36 @@ if (in_array($object->element,array('propal', 'askpricesupplier','facture','invo
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
<tr class="liste_titre nodrag nodrop">
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<td class="linecoldescription" <?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
</td>
<?php if ($object->element == 'askpricesupplier') { ?>
<td align="right"><span id="title_fourn_ref"><?php echo $langs->trans('AskPriceSupplierRefFourn'); ?></span></td>
<tdclass="linecolrefsupplier" align="right"><span id="title_fourn_ref"><?php echo $langs->trans('AskPriceSupplierRefFourn'); ?></span></td>
<?php } ?>
<td align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td>
<td align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td>
<td class="linecolvat" align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td>
<td class="linecoluht" align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td>
<?php if (! empty($inputalsopricewithtax)) { ?>
<td align="right"><span id="title_up_ttc"><?php echo $langs->trans('PriceUTTC'); ?></span></td>
<td class="linecoluttc" align="right"><span id="title_up_ttc"><?php echo $langs->trans('PriceUTTC'); ?></span></td>
<?php } ?>
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
<td class="linecolqty" align="right"><?php echo $langs->trans('Qty'); ?></td>
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td align="left">';
print '<td class="linecoluseunit" align="left">';
print '<span id="title_units">';
print $langs->trans('Unit');
print '</span></td>';
}
?>
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
<td class="linecoldiscount" align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
<?php
if ($this->situation_cycle_ref) {
print '<td align="right">' . $langs->trans('Progress') . '</td>';
print '<td class="linecolcycleref" align="right">' . $langs->trans('Progress') . '</td>';
}
if (! empty($usemargins))
{
?>
<td align="right" class="margininfos">
<td align="right" class="margininfos linecolmargin1">
<?php
if ($conf->global->MARGIN_TYPE == "1")
echo $langs->trans('BuyingPrice');
@ -87,11 +87,11 @@ if (in_array($object->element,array('propal', 'askpricesupplier','facture','invo
?>
</td>
<?php
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right" class="margininfos"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right" class="margininfos"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right" class="margininfos linecolmargin2"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
}
?>
<td colspan="<?php echo $colspan; ?>">&nbsp;</td>
<td class="linecoledit" colspan="<?php echo $colspan; ?>">&nbsp;</td>
</tr>
<tr <?php echo $bcnd[$var]; ?>>
@ -102,7 +102,7 @@ else {
$coldisplay=0; }
?>
<td class="nobottom"<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<td class="nobottom linecoldescription"<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<?php
@ -211,33 +211,33 @@ else {
</td>
<?php if ($object->element == 'askpricesupplier') { ?>
<td class="nobottom" align="right"><input id="fourn_ref" name="fourn_ref" class="flat" value="" size="12"></td>
<td class="nobottom linecolresupplier" align="right"><input id="fourn_ref" name="fourn_ref" class="flat" value="" size="12"></td>
<?php } ?>
<td class="nobottom" align="right"><?php
<td class="nobottom linecolvat" align="right"><?php
if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0, true);
else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer);
?>
</td>
<td class="nobottom" align="right">
<td class="nobottom linecoluht" align="right">
<input type="text" size="5" name="price_ht" id="price_ht" class="flat" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>">
</td>
<?php if (! empty($inputalsopricewithtax)) { ?>
<td class="nobottom" align="right">
<td class="nobottom linecoluttc" align="right">
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (isset($_POST["price_ttc"])?$_POST["price_ttc"]:''); ?>">
</td>
<?php } ?>
<td class="nobottom" align="right"><input type="text" size="2" name="qty" id="qty" class="flat" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>">
<td class="nobottom linecolqty" align="right"><input type="text" size="2" name="qty" id="qty" class="flat" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>">
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="nobottom" align="left">';
print '<td class="nobottom linecoluseunit" align="left">';
print $form->selectUnits($line->fk_unit, "units");
print '</td>';
}
?>
<td class="nobottom nowrap" align="right"><input type="text" size="1" name="remise_percent" id="remise_percent" class="flat" value="<?php echo (isset($_POST["remise_percent"])?$_POST["remise_percent"]:$buyer->remise_percent); ?>"><span class="hideonsmartphone">%</span></td>
<td class="nobottom nowrap linecoldiscount" align="right"><input type="text" size="1" name="remise_percent" id="remise_percent" class="flat" value="<?php echo (isset($_POST["remise_percent"])?$_POST["remise_percent"]:$buyer->remise_percent); ?>"><span class="hideonsmartphone">%</span></td>
<?php
if ($this->situation_cycle_ref) {
$coldisplay++;
@ -246,7 +246,7 @@ else {
if (! empty($usemargins))
{
?>
<td class="nobottom" align="right" class="margininfos">
<td align="right" class="nobottom margininfos linecolmargin">
<!-- For predef product -->
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat" data-role="none" style="display: none;"></select>
@ -277,7 +277,7 @@ else {
}
}
?>
<td class="nobottom" align="center" valign="middle" colspan="<?php echo $colspan; ?>">
<td class="nobottom linecoledit" align="center" valign="middle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
</td>
<?php
@ -521,6 +521,7 @@ jQuery(document).ready(function() {
if (this.id != 'pmpprice')
{
i++;
this.price = parseFloat(this.price);//fix this.price >0
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
var defaultbuyprice = '<?php echo ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1')?'bestsupplierprice':''); ?>';

View File

@ -50,9 +50,9 @@ if (empty($usemargins)) $usemargins=0;
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
<?php } ?>
<td><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
<td class="linecoldescription"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
<?php
if (($line->info_bits & 2) == 2) {
?>
@ -125,17 +125,17 @@ if (empty($usemargins)) $usemargins=0;
?>
</td>
<?php if ($object->element == 'askpricesupplier') { ?>
<td align="right"><?php echo $line->ref_fourn; ?></td>
<td class="linecolrefsupplier" align="right"><?php echo $line->ref_fourn; ?></td>
<?php } ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
<td align="right" class="linecolvat nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td>
<td align="right" class="linecoluht nowrap"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td>
<?php if ($inputalsopricewithtax) { ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?></td>
<td align="right" class="linecoluttc nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?></td>
<?php } ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?>
<td align="right" class="linecolqty nowrap"><?php $coldisplay++; ?>
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
// I comment this because it shows info even when not required
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
@ -148,7 +148,7 @@ if (empty($usemargins)) $usemargins=0;
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td align="left" class="nowrap">';
print '<td align="left" class="linecoluseunit nowrap">';
$label = $line->getLabelOfUnit('short');
if ($label !== '') {
print $langs->trans($label);
@ -158,42 +158,42 @@ if (empty($usemargins)) $usemargins=0;
?>
<?php if (!empty($line->remise_percent) && $line->special_code != 3) { ?>
<td align="right"><?php
<td class="linecoldiscount" align="right"><?php
$coldisplay++;
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
echo dol_print_reduction($line->remise_percent,$langs);
?></td>
<?php } else { ?>
<td><?php $coldisplay++; ?>&nbsp;</td>
<td class="linecoldiscount"><?php $coldisplay++; ?>&nbsp;</td>
<?php }
if ($this->situation_cycle_ref) {
$coldisplay++;
print '<td align="right" class="nowrap">' . $line->situation_percent . '%</td>';
print '<td align="right" class="linecolcycleref nowrap">' . $line->situation_percent . '%</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
{
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
?>
<td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
<td align="right" class="linecolmargin1 nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
<?php if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?>
<td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td>
<td align="right" class="linecolmargin2 nowrap margininfos"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td>
<?php }
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
<td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->marque_tx, null, null, null, null, $rounding).'%'; ?></td>
<td align="right" class="linecolmargin2 nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->marque_tx, null, null, null, null, $rounding).'%'; ?></td>
<?php }
}
?>
<?php if ($line->special_code == 3) { ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td>
<td align="right" class="linecoloption nowrap"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td>
<?php } else { ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td>
<td align="right" class="liencolht nowrap"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td>
<?php } ?>
<?php if ($this->statut == 0 && ($object_rights->creer)) { ?>
<td align="center"><?php $coldisplay++; ?>
<td class="linecoledit" align="center"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) == 2) { ?>
<?php } else { ?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>">
@ -202,7 +202,7 @@ if (empty($usemargins)) $usemargins=0;
<?php } ?>
</td>
<td align="center"><?php $coldisplay++; ?>
<td class="linecoldelete" align="center"><?php $coldisplay++; ?>
<?php
if ($this->situation_counter == 1 || !$this->situation_cycle_ref) {
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&amp;action=ask_deleteline&amp;lineid=' . $line->id . '">';
@ -213,7 +213,7 @@ if (empty($usemargins)) $usemargins=0;
</td>
<?php if ($num > 1 && empty($conf->browser->phone) && ($this->situation_counter == 1 || !$this->situation_cycle_ref)) { ?>
<td align="center" class="tdlineupdown"><?php $coldisplay++; ?>
<td align="center" class="linecolmove tdlineupdown"><?php $coldisplay++; ?>
<?php if ($i > 0) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>">
<?php echo img_up('default',0,'imgupforline'); ?>
@ -226,7 +226,7 @@ if (empty($usemargins)) $usemargins=0;
<?php } ?>
</td>
<?php } else { ?>
<td align="center"<?php echo (empty($conf->browser->phone)?' class="tdlineupdown"':''); ?>><?php $coldisplay++; ?></td>
<td align="center"<?php echo (empty($conf->browser->phone)?' class="linecolmove tdlineupdown"':' class="linecolmove"'); ?>><?php $coldisplay++; ?></td>
<?php } ?>
<?php } else { ?>
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>

View File

@ -520,7 +520,7 @@ if ($action == 'create')
dol_fiche_head('');
print '<table class="border" width="100%">';
print '<table class="border centpercent">';
// Ref
print '<tr><td width="30%" class="fieldrequired">';
@ -662,6 +662,8 @@ if ($action == 'create')
print '<br>';
print '<table class="noborder" width="100%">';
@ -1533,9 +1535,9 @@ else if ($id || $ref)
*/
if ($action != 'presend')
{
print '<table width="100%"><tr><td width="50%" valign="top">';
$objectref = dol_sanitizeFileName($object->ref);
print '<div class="fichecenter"><div class="fichehalfleft">';
$objectref = dol_sanitizeFileName($object->ref);
$filedir = $conf->expedition->dir_output . "/sending/" .$objectref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
@ -1552,14 +1554,14 @@ else if ($id || $ref)
//$linktoelem = $form->showLinkToObjectBlock($object);
//if ($linktoelem) print '<br>'.$linktoelem;
print '</td><td valign="top" width="50%">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'shipping',$socid);
print '</td></tr></table>';
print '</div></div></div>';
}
/*

View File

@ -88,9 +88,7 @@ if ($action == 'setdatedelivery' && $user->rights->commande->creer)
$commande->fetch($id);
$result=$commande->set_date_livraison($user,$datelivraison);
if ($result < 0)
{
$mesg='<div class="error">'.$commande->error.'</div>';
}
setEventMessages($commande->error, $commande->errors, 'errors');
}
if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
@ -98,6 +96,8 @@ if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
$commande = new Commande($db);
$commande->fetch($id);
$commande->setDeliveryAddress(GETPOST('delivery_address_id','int'));
if ($result < 0)
setEventMessages($commande->error, $commande->errors, 'errors');
}
if ($action == 'setmode' && $user->rights->commande->creer)
@ -105,7 +105,24 @@ if ($action == 'setmode' && $user->rights->commande->creer)
$commande = new Commande($db);
$commande->fetch($id);
$result = $commande->setPaymentMethods(GETPOST('mode_reglement_id','int'));
if ($result < 0) dol_print_error($db,$commande->error);
if ($result < 0)
setEventMessages($commande->error, $commande->errors, 'errors');
}
if ($action == 'setavailability' && $user->rights->commande->creer) {
$commande = new Commande($db);
$commande->fetch($id);
$result=$commande->availability(GETPOST('availability_id'));
if ($result < 0)
setEventMessages($commande->error, $commande->errors, 'errors');
}
if ($action == 'setdemandreason' && $user->rights->commande->creer) {
$commande = new Commande($db);
$commande->fetch($id);
$result=$commande->demand_reason(GETPOST('demand_reason_id'));
if ($result < 0)
setEventMessages($commande->error, $commande->errors, 'errors');
}
if ($action == 'setconditions' && $user->rights->commande->creer)
@ -113,7 +130,8 @@ if ($action == 'setconditions' && $user->rights->commande->creer)
$commande = new Commande($db);
$commande->fetch($id);
$result=$commande->setPaymentTerms(GETPOST('cond_reglement_id','int'));
if ($result < 0) dol_print_error($db,$commande->error);
if ($result < 0)
setEventMessages($commande->error, $commande->errors, 'errors');
}
// shipping method
@ -121,8 +139,18 @@ if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
$commande = new Commande($db);
$commande->fetch($id);
$result=$commande->setShippingMethod(GETPOST('shipping_method_id', 'int'));
if ($result < 0)
setEventMessages($commande->error, $commande->errors, 'errors');
}
// warehouse
if ($action == 'setwarehouse' && $user->rights->commande->creer) {
$commande = new Commande($db);
$commande->fetch($id);
$result = $commande->setWarehouse(GETPOST('warehouse_id', 'int'));
if ($result < 0)
setEventMessages($commande->error, $commande->errors, 'errors');
}
/*
@ -164,8 +192,8 @@ if ($id > 0 || ! empty($ref))
}
// Onglet commande
$nbrow=8;
if (! empty($conf->projet->enabled)) $nbrow++;
//$nbrow=8;
//if (! empty($conf->projet->enabled)) $nbrow++;
print '<table class="border" width="100%">';
@ -286,6 +314,27 @@ if ($id > 0 || ! empty($ref))
print '</td>';
print '</tr>';
// Warehouse
if (! empty($conf->stock->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct=new FormProduct($db);
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('Warehouse');
print '</td>';
if ($action != 'editwarehouse' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetWarehouse'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($action == 'editwarehouse') {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'warehouse_id', 1);
} else {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'none');
}
print '</td>';
print '</tr>';
}
// Terms of payment
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -529,7 +578,7 @@ if ($id > 0 || ! empty($ref))
}
// Qty ordered
print '<td align="center">'.$objp->qty.'</td>';
print '<td align="center">' . ($objp->qty!=1?'<span class="badge">'.$objp->qty.'</span>':$objp->qty) . '</td>';
// Qty already shipped
$qtyProdCom=$objp->qty;
@ -677,7 +726,7 @@ if ($id > 0 || ! empty($ref))
print '<td'.($warehousecanbeselectedlater?'':' class="fieldrequired"').'>'.$langs->trans("WarehouseSource").'</td>';
print '<td>';
print $formproduct->selectWarehouses(-1,'entrepot_id','',1);
print $formproduct->selectWarehouses(! empty($commande->warehouse_id)?$commande->warehouse_id:-1,'entrepot_id','',1);
if (count($formproduct->cache_warehouses) <= 0)
{
print ' &nbsp; '.$langs->trans("WarehouseSourceNotDefined").' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("AddOne").'</a>';

View File

@ -1534,7 +1534,7 @@ class ExpenseReport extends CommonObject
$response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24;
$response->label=$langs->trans("ExpenseReportsToPay");
$response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&amp;statut=5';
$response->img=img_object($langs->trans("ExpenseReports"),"user");
$response->img=img_object($langs->trans("ExpenseReports"),"trip");
while ($obj=$this->db->fetch_object($resql))
{

View File

@ -1575,6 +1575,7 @@ class CommandeFournisseur extends CommonOrder
$result=$this->call_trigger('ORDER_SUPPLIER_DELETE',$user);
if ($result < 0)
{
$this->errors[]='ErrorWhenRunningTrigger';
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
return -1;
}
@ -1587,6 +1588,8 @@ class CommandeFournisseur extends CommonOrder
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if (! $this->db->query($sql) )
{
$this->error=$this->db->lasterror();
$this->errors[]=$this->db->lasterror();
$error++;
}
@ -1597,12 +1600,14 @@ class CommandeFournisseur extends CommonOrder
if ($this->db->affected_rows($resql) < 1)
{
$this->error=$this->db->lasterror();
$this->errors[]=$this->db->lasterror();
$error++;
}
}
else
{
$this->error=$this->db->lasterror();
$this->errors[]=$this->db->lasterror();
$error++;
}
@ -1612,6 +1617,8 @@ class CommandeFournisseur extends CommonOrder
$result=$this->deleteExtraFields();
if ($result < 0)
{
$this->error='FailToDeleteExtraFields';
$this->errors[]='FailToDeleteExtraFields';
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
@ -1619,7 +1626,11 @@ class CommandeFournisseur extends CommonOrder
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
if ($res < 0) {
$this->error='FailToDeleteObjectLinked';
$this->errors[]='FailToDeleteObjectLinked';
$error++;
}
if (! $error)
{
@ -1634,6 +1645,7 @@ class CommandeFournisseur extends CommonOrder
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
{
$this->error='ErrorFailToDeleteFile';
$this->errors[]='ErrorFailToDeleteFile';
$error++;
}
}
@ -1643,6 +1655,7 @@ class CommandeFournisseur extends CommonOrder
if (! $res)
{
$this->error='ErrorFailToDeleteDir';
$this->errors[]='ErrorFailToDeleteDir';
$error++;
}
}

View File

@ -229,7 +229,7 @@ class ProductFournisseur extends Product
else
{
$this->db->rollback();
return 1;
return -1;
}
}
else
@ -312,7 +312,7 @@ class ProductFournisseur extends Product
else
{
$this->db->rollback();
return 1;
return -1;
}
}
else

View File

@ -1515,8 +1515,8 @@ if ($action == 'create')
$txt=$langs->trans("SupplierOrder");
}
print '<tr><td>'.$txt.'</td><td colspan="2">'.$objectsrc->getNomUrl(1);
//We check if Origin document has already an invoice attached to it
$objectsrc->fetchObjectLinked($originid,'','','invoice_supplier');
// We check if Origin document (id and type is known) has already at least one invoice attached to it
$objectsrc->fetchObjectLinked($originid,$origin,'','invoice_supplier');
$cntinvoice=count($objectsrc->linkedObjects['invoice_supplier']);
if ($cntinvoice>=1)
{

View File

@ -94,9 +94,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_company="";
$search_amount_no_tax="";
$search_amount_all_tax="";
$search_status="";
$year="";
$month="";
$filter="";
}
// List of fields to search into when doing a "search in all"
@ -162,15 +162,6 @@ if ($socid)
{
$sql .= " AND s.rowid = ".$socid;
}
if ($filter && $filter != -1) // GETPOST('filtre') may be a string
{
$filtrearr = explode(",", $filter);
foreach ($filtrearr as $fil)
{
$filt = explode(":", $fil);
$sql .= " AND " . $filt[0] . " = " . $filt[1];
}
}
if ($search_all)
{
$sql.= natural_search(array_keys($fieldstosearchall), $search_all);
@ -232,7 +223,7 @@ if ($search_amount_all_tax != '')
if ($search_status != '')
{
$sql.= " AND fac.fk_statut = '".$db->escape($search_status)."'";
$sql.= " AND fac.fk_statut = ".$search_status;
}
$nbtotalofrecords = 0;
@ -268,6 +259,7 @@ if ($resql)
if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax);
if ($filter && $filter != -1) $param.='&filtre='.urlencode($filter);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
if ($search_status >= 0) $param.="&search_status=".$search_status;
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
@ -337,8 +329,8 @@ if ($resql)
print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="6" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
print '</td><td class="liste_titre" align="right">';
$liststatus=array('fac.fk_statut:0'=>$langs->trans("Draft"),'fac.fk_statut:1,paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid"));
print $form->selectarray('filtre', $liststatus, $filter, 1);
$liststatus=array('0'=>$langs->trans("Draft"),'1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid"));
print $form->selectarray('filtre', $liststatus, $search_status, 1);
print '</td><td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';

View File

@ -1,333 +0,0 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
*
* 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/>.
*/
/**
* \file htdocs/fourn/list.php
* \ingroup fournisseur
* \brief Home page of supplier area
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$langs->load("suppliers");
$langs->load("orders");
$langs->load("companies");
$socname = GETPOST("socname");
$search_name = GETPOST("search_name");
$search_zipcode = GETPOST("search_zipcode");
$search_town = GETPOST("search_town");
$search_supplier_code = GETPOST("search_supplier_code");
$search_supplier_accounting = GETPOST("search_supplier_accounting");
$search_datec = GETPOST("search_datec");
$search_categ = GETPOST('search_categ','int');
$search_status = GETPOST("search_status",'int');
$catid = GETPOST("catid",'int');
$search_country = GETPOST("search_country",'int');
$search_type_thirdparty = GETPOST("search_type_thirdparty",'int');
$optioncss = GETPOST('optioncss','alpha');
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user,'societe',$socid,'');
$page = GETPOST('page','int');
$sortorder = GETPOST('sortorder','alpha');
$sortfield = GETPOST('sortfield','alpha');
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="nom";
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('supplierlist'));
$extrafields = new ExtraFields($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$socname="";
$search_name="";
$search_zipcode="";
$search_town="";
$search_supplier_code="";
$search_supplier_accounting="";
$search_datec="";
$search_categ="";
$search_status='';
$catid="";
$search_country="";
$search_type_thirdparty="";
}
if ($search_status=='') $search_status=1; // always display activ customer first
$extrafields->fetch_name_optionals_label('thirdparty');
/*
* Actions
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
/*
* View
*/
$form=new Form($db);
$htmlother=new FormOther($db);
$thirdpartystatic=new Societe($db);
$formcompany=new FormCompany($db);
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url);
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.datec, st.libelle as stcomm, s.prefix_comm, s.status as status, ";
$sql.= "code_fournisseur, code_compta_fournisseur";
$sql.= ",s.fk_pays";
$sql.= ",typent.code as typent_code";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef ON ef.fk_object = s.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) ";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) ";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cf ON s.rowid = cf.fk_soc"; // We need this table joined to the select in order to filter by categ
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1";
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc";
if ($socid) $sql .= " AND s.rowid = ".$socid;
if ($socname) {
$sql .= natural_search('s.nom', $socname);
$sortfield = "s.nom";
$sortorder = "ASC";
}
if ($search_name) $sql .= natural_search(array('s.nom', 's.name_alias'), $search_name);
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
if ($search_town) $sql .= natural_search('s.town', $search_town);
if ($search_supplier_code) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_supplier_code)."%'";
if ($search_supplier_accounting) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_supplier_accounting)."%'";
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
if ($search_status!='') $sql.= " AND s.status = ".$db->escape($search_status);
if ($catid > 0) $sql.= " AND cf.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cf.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cf.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cf.fk_categorie IS NULL";
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
//print $sql;
dol_syslog('fourn/list.php:', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$param = "&amp;search_name=".htmlspecialchars($search_name);
$param.="&amp;search_supplier_code=".htmlspecialchars($search_supplier_code);
$param.="&amp;search_zipcode=".htmlspecialchars($search_zipcode);
$param.="&amp;search_town=".htmlspecialchars($search_town);
if ($search_categ != '') $param.='&amp;search_categ='.htmlspecialchars($search_categ);
if ($search_status != '') $param.='&amp;search_status='.htmlspecialchars($search_status);
if ($search_country != '') $param.='&amp;search_country='.htmlspecialchars($search_country);
if ($search_type_thirdparty != '') $param.='&amp;search_type_thirdparty='.htmlspecialchars($search_type_thirdparty);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies');
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
// Filter on categories
$moreforfilter='';
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$htmlother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ,'search_categ',1);
$moreforfilter.='</div>';
}
if ($moreforfilter)
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,'valign="middle"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,'valign="middle"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'valign="middle"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SupplierCode"),$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="right"',$sortfield,$sortorder);
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_name" value="'.$search_name.'"></td>';
print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_zipcode" value="'.$search_zipcode.'"></td>';
print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_town" value="'.$search_town.'"></td>';
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '</td>';
print '<td class="liste_titre" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_supplier_code" value="'.$search_supplier_code.'">';
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_supplier_accounting" value="'.$search_supplier_accounting.'">';
print '</td>';
print '<td align="right" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">';
print '</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td class="liste_titre" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td>\n";
print '</tr>';
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($resql);
$var=!$var;
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->name=$obj->name;
$thirdpartystatic->status=$obj->status;
$thirdpartystatic->name_alias=$obj->name_alias;
print "<tr ".$bc[$var].">";
print '<td>';
print $thirdpartystatic->getNomUrl(1,'supplier');
print "</td>\n";
print '<td>'.$obj->zip.'</td>'."\n";
print '<td>'.$obj->town.'</td>'."\n";
//Country
print '<td align="center">';
$tmparray=getCountry($obj->fk_pays,'all');
print $tmparray['label'];
print '</td>';
//Type ent
print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print '</td>';
print '<td align="left">'.$obj->code_fournisseur.'&nbsp;</td>';
print '<td align="left">'.$obj->code_compta_fournisseur.'&nbsp;</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td align="center">'.$thirdpartystatic->getLibStatut(3).'</td>';
print '<td></td>';
print "</tr>\n";
$i++;
}
print "</table>\n";
print "</form>\n";
$db->free($resql);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
}
else
{
dol_print_error($db);
}
$db->close();
llxFooter();

View File

@ -0,0 +1,126 @@
<?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/>.
*/
/**
* \file htdocs/hrm/admin/admin_establishment.php
* \ingroup HRM
* \brief HRM Establishment module setup page
*/
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
$langs->load("admin");
$langs->load('hrm');
if (! $user->admin)
accessforbidden();
$error=0;
$action = GETPOST('action', 'alpha');
$object = new Establishment($db);
/*
* Actions
*/
/*
* View
*/
$page_name = "Establishments";
llxHeader('', $langs->trans($page_name));
$form = new Form($db);
dol_htmloutput_mesg($mesg);
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback);
// Configuration header
$head = hrm_admin_prepare_head();
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;
$result = $db->query($sql);
if ($result)
{
$var=false;
$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>';
if ($num)
{
$establishmentstatic=new Establishment($db);
while ($i < $num && $i < $max)
{
$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>';
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;
$i++;
}
}
else
{
print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
}
print '</table>';
}
else
{
dol_print_error($db);
}
dol_fiche_end();
// Buttons
print '<div class="tabsAction">';
print '<a class="butAction" href="../establishment/card.php?action=create">'.$langs->trans("NewEstablishment").'</a>';
print '</div>';
llxFooter();
$db->close();

View File

@ -0,0 +1,58 @@
<?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/>.
*/
/**
* \file htdocs/hrm/admin/admin_hrm.php
* \ingroup HRM
* \brief HRM module setup page
*/
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("admin");
$langs->load('hrm');
if (! $user->admin)
accessforbidden();
$action = GETPOST('action', 'alpha');
/*
* Actions
*/
/*
* View
*/
$page_name = "Parameters";
llxHeader('', $langs->trans($page_name));
$form = new Form($db);
dol_htmloutput_mesg($mesg);
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback);
// Configuration header
$head = hrm_admin_prepare_head();
dol_fiche_head($head, 'parameters', $langs->trans("HRM"), 0, "user");
llxFooter();
$db->close();

View File

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