Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop6

This commit is contained in:
Laurent Destailleur 2016-12-26 15:44:31 +01:00
commit b5c815367c
92 changed files with 1207 additions and 791 deletions

View File

@ -152,6 +152,52 @@ Dolibarr better:
- The trigger that activate or close a contract line is run on a contract line, not on contract. - The trigger that activate or close a contract line is run on a contract line, not on contract.
***** ChangeLog for 4.0.3 to 4.0.2 *****
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
FIX: #5958 no discount on supplier command made by replenishment
FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them
FIX: #5972 #5734
FIX: #6007
FIX: #6010
FIX: #6029
FIX: #6043 - Payment mode not visible on supplier invoice list
FIX: #6051
FIX: #6062
FIX: #6088
FIX: A draft can be deleted by a user with create permission.
FIX: bad permission to see contract on home page
FIX: bad permission to see contract statistics
FIX: Bcc must not appears to recipient when using SMTPs lib
FIX: Consistent description for add or edit product
FIX: delete contract extrafields on contract deletion
FIX: Deposits and credit notes weren't added in the received and pending columns
FIX: export extrafields must not include separe type
FIX: Export of opportunity status must be code, not id.
FIX: False positive on services not activated
FIX: Filter was wrong or lost during navigation
FIX: HT and TTC price should always be displayed together
FIX: if a supplier price reference is changed after creating an order, we can't clone order.
FIX: in export. Error when using a separate extrafields.
FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
FIX: javascript error when using on mobile/smartphone
FIX: javascript xss injection and a translation
FIX: Label of project is in field title not label.
FIX: List of people able to validate an expense report was not complete.
FIX: Missing field
FIX: Module gravatar was not triggered on thirdparty and contact card
FIX: Must use external link into a forged email content.
FIX: Pb in management of date end of projects
FIX: Regression when deleting product
FIX: rendering of output of estimated amount on project overview page.
FIX: Sanitize title of ajax_dialog
FIX: Security to restrict email sending was not efficient
FIX: Setting supplier as client when accept a supplier proposal
FIX: Some statistics not compatible with multicompany module.
FIX: the time spent on project was not visible in its overwiew
FIX: Update intervention lline crash with PgSQL
FIX: wrong test on dict.php
FIX: wrong var name
***** ChangeLog for 4.0.2 compared to 4.0.1 ***** ***** ChangeLog for 4.0.2 compared to 4.0.1 *****
FIX: #5340 FIX: #5340
FIX: #5779 FIX: #5779

28
dev/setup/nginx/dolibarr Normal file
View File

@ -0,0 +1,28 @@
# Dolibarr server configuration sample for NGinx
server {
listen 80;
listen [::]:80;
root /path/to/your/htdocs;
# Optionnal
error_log /path/to/your/log/directory/nginx.error.log;
access_log /path/to/your/log/directory/nginx.access.log;
index index.php index.html index.htm;
# Optionnal
server_name your-fqdn.tld;
location / {
try_files $uri $uri/ /index.php;
}
location ~ [^/]\.php(/|$) {
try_files $uri =404;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 600;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}

View File

@ -89,8 +89,11 @@ if ($user->societe_id > 0)
//accessforbidden(); //accessforbidden();
} }
// Initialize technical object to manage context to save list fields
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'mymodulelist';
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('skeletonlist')); $hookmanager->initHooks(array('mymodulelist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
@ -305,6 +308,7 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -62,7 +62,10 @@ $list_account = array (
'ACCOUNTING_VAT_PAY_ACCOUNT', 'ACCOUNTING_VAT_PAY_ACCOUNT',
'ACCOUNTING_ACCOUNT_SUSPENSE', 'ACCOUNTING_ACCOUNT_SUSPENSE',
'ACCOUNTING_ACCOUNT_TRANSFER_CASH', 'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
'DONATION_ACCOUNTINGACCOUNT' 'DONATION_ACCOUNTINGACCOUNT',
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL',
'LOAN_ACCOUNTING_ACCOUNT_INTEREST',
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'
); );

View File

@ -357,7 +357,7 @@ class AccountancyExport
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 20), 20); $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 20), 20);
$Tab['sens'] = $data->sens; // C or D $Tab['sens'] = $data->sens; // C or D
$Tab['signe_montant'] = '+'; $Tab['signe_montant'] = '+';
$Tab['montant'] = str_pad(abs($data->montant) * 100, 12, '0', STR_PAD_LEFT); // TODO manage negative amount $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
$Tab['contrepartie'] = str_repeat(' ', 8); $Tab['contrepartie'] = str_repeat(' ', 8);
if (! empty($data->date_echeance)) if (! empty($data->date_echeance))
$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); $Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);

View File

@ -68,9 +68,9 @@ if ($action == 'validatehistory') {
$db->begin(); $db->begin();
// First clean corrupted data // First clean corrupted data
$sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sqlclean .= " SET fd.fk_code_ventilation = 0"; $sqlclean .= " SET erd.fk_code_ventilation = 0";
$sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN '; $sqlclean .= ' WHERE erd.fk_code_ventilation NOT IN ';
$sqlclean .= ' (SELECT accnt.rowid '; $sqlclean .= ' (SELECT accnt.rowid ';
$sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
$sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; $sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
@ -79,18 +79,18 @@ if ($action == 'validatehistory') {
// Now make the binding // Now make the binding
if ($db->type == 'pgsql') { if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
$sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "c_type_fees as t, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; $sql1 .= " WHERE " . MAIN_DB_PREFIX . "expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; $sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number";
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0"; $sql1 .= " AND " . MAIN_DB_PREFIX . "expensereport_det.fk_code_ventilation = 0";
} else { } else {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd, " . MAIN_DB_PREFIX . "c_type_fees as t, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " SET fd.fk_code_ventilation = accnt.rowid"; $sql1 .= " SET erd.fk_code_ventilation = accnt.rowid";
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; $sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; $sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0"; $sql1 .= " AND erd.fk_code_ventilation = 0";
} }
$resql1 = $db->query($sql1); $resql1 = $db->query($sql1);
@ -106,9 +106,9 @@ if ($action == 'validatehistory') {
$error = 0; $error = 0;
$db->begin(); $db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql1 .= " SET fd.fk_code_ventilation = 0"; $sql1 .= " SET erd.fk_code_ventilation = 0";
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN '; $sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
$sql1 .= ' (SELECT accnt.rowid '; $sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
@ -129,12 +129,12 @@ if ($action == 'validatehistory') {
$error = 0; $error = 0;
$db->begin(); $db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql1.= " SET fd.fk_code_ventilation = 0"; $sql1.= " SET erd.fk_code_ventilation = 0";
$sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er";
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; $sql1.= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; $sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
$sql1.= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; $sql1.= " AND er.entity IN (" . getEntity("accountancy", 1) . ")";
$sql1.=")"; $sql1.=")";
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
@ -197,16 +197,17 @@ print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,"; $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,"; $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; $sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
} }
$sql .= " ROUND(SUM(erd.total_ht),2) as total"; $sql .= " ROUND(SUM(erd.total_ht),2) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
$sql .= " WHERE er.date_create >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
$sql .= " AND er.date_create <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND er.fk_statut > 0 "; $sql .= " AND er.fk_statut > 0 ";
$sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql); dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
@ -250,17 +251,17 @@ print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,"; $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,"; $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; $sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
} }
$sql .= " ROUND(SUM(erd.total_ht),2) as total"; $sql .= " ROUND(SUM(erd.total_ht),2) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
$sql .= " WHERE er.date_create >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
$sql .= " AND er.date_create <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND er.fk_statut > 0 "; $sql .= " AND er.fk_statut > 0 ";
$sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL"; $sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql); dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
@ -312,8 +313,8 @@ for($i = 1; $i <= 12; $i ++) {
$sql .= " ROUND(SUM(erd.total_ht),2) as total"; $sql .= " ROUND(SUM(erd.total_ht),2) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " WHERE er.date_create >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
$sql .= " AND er.date_create <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND er.fk_statut > 0 "; $sql .= " AND er.fk_statut > 0 ";
$sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -36,9 +37,6 @@ $langs->load("accountancy");
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
// Validate History
$action = GETPOST('action');
$langs->load("admin"); $langs->load("admin");
$langs->load("dict"); $langs->load("dict");
$langs->load("bills"); $langs->load("bills");
@ -73,11 +71,11 @@ print "<br>\n";
// STEPS // STEPS
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
@ -86,16 +84,16 @@ print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
$textlink = '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
if (! empty($conf->tax->enabled)) if (! empty($conf->tax->enabled))
{ {
$textlink = '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n"; print "<br>\n";
@ -104,7 +102,7 @@ if (! empty($conf->tax->enabled))
/*if (! empty($conf->salaries->enabled)) /*if (! empty($conf->salaries->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
// htdocs/admin/salaries.php // htdocs/admin/salaries.php
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
@ -112,14 +110,14 @@ if (! empty($conf->tax->enabled))
if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
} }
if (! empty($conf->loan->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. if (! empty($conf->loan->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuLoanAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
} }
@ -127,7 +125,7 @@ if (! empty($conf->loan->enabled)) // TODO Move this in the default account pag
if (! empty($conf->don->enabled)) if (! empty($conf->don->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
}*/ }*/
@ -138,7 +136,7 @@ print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>')."<br>\n";
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
@ -148,14 +146,21 @@ print "<br>\n";
$step = 0; $step = 0;
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescCustomer", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescCustomer", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSupplier", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSupplier", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", $step, '<strong>'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."<br>\n";
print "<br>\n"; print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", $step)."<br>\n";
print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", $step)."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", $step)."<br>\n";
print "<br>\n"; print "<br>\n";

View File

@ -170,8 +170,8 @@ class Members extends DolibarrApi
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
$member->$field = $value; $member->$field = $value;
} }
if($member->create(DolibarrApiAccess::$user) < 0) { if ($member->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(503, 'Error when create member : '.$member->error); throw new RestException(500, 'Error creating member', array_merge(array($member->error), $member->errors));
} }
return $member->id; return $member->id;
} }

View File

@ -162,8 +162,8 @@ class Subscriptions extends DolibarrApi
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
$subscription->$field = $value; $subscription->$field = $value;
} }
if($subscription->create(DolibarrApiAccess::$user) < 0) { if ($subscription->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(503, 'Error when create subscription : '.$subscription->error); throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors));
} }
return $subscription->id; return $subscription->id;
} }

View File

@ -293,7 +293,6 @@ class Subscription extends CommonObject
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
* @param int $statut Id statut * @param int $statut Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut) function LibStatut($statut)

View File

@ -1274,6 +1274,7 @@ if ($id)
// Title line with search boxes // Title line with search boxes
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
$filterfound=0;
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
$showfield=1; // By defaut $showfield=1; // By defaut
@ -1284,21 +1285,25 @@ if ($id)
{ {
if ($value == 'country') if ($value == 'country')
{ {
print '<td>'; print '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
print '</td>'; print '</td>';
$filterfound++;
} }
else else
{ {
print '<td></td>'; print '<td class="liste_titre"></td>';
} }
} }
} }
if ($id == 4) print '<td></td>'; if ($id == 4) print '<td></td>';
print '<td></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre" colspan="2" align="right">'; print '<td class="liste_titre" colspan="2" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0); if ($filterfound)
print $searchpitco; {
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -1314,19 +1319,17 @@ if ($id)
print '<tr '.$bc[$var].' id="rowid-'.$obj->rowid.'">'; print '<tr '.$bc[$var].' id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
{ {
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
$tmpaction='edit'; $tmpaction='edit';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors; $error=$hookmanager->error; $errors=$hookmanager->errors;
// Show fields
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
print '<td colspan="3" align="center">'; print '<td colspan="3" align="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>'; print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';

View File

@ -619,6 +619,12 @@ else
print '</div>'; print '</div>';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
$text = $langs->trans("WarningPHPMail");
print info_admin($text);
}
// Run the test to connect // Run the test to connect
if ($action == 'testconnect') if ($action == 'testconnect')
{ {

View File

@ -269,8 +269,8 @@ class Categories extends DolibarrApi
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
$this->category->$field = $value; $this->category->$field = $value;
} }
if($this->category->create(DolibarrApiAccess::$user) < 0) { if ($this->category->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(503, 'Error when create category : '.$this->category->error); throw new RestException(500, 'Error when creating category', array_merge(array($this->category->error), $this->category->errors));
} }
return $this->category->id; return $this->category->id;
} }

View File

@ -395,7 +395,7 @@ class CategoryApi extends DolibarrApi
$this->category->$field = $value; $this->category->$field = $value;
} }
if($this->category->create(DolibarrApiAccess::$user) < 0) { if($this->category->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(503, 'Error when create category : '.$this->category->error); throw new RestException(500, 'Error when create category : '.$this->category->error);
} }
return $this->category->id; return $this->category->id;
} }

View File

@ -94,7 +94,7 @@ class AgendaEvents extends DolibarrApi
* @param int $limit Limit for list * @param int $limit Limit for list
* @param int $page Page number * @param int $page Page number
* @param string $user_ids User ids filter field (owners of event). Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param string $user_ids User ids filter field (owners of event). Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.date_creation:<:'20160101')"
* @return array Array of Agenda Events objects * @return array Array of Agenda Events objects
*/ */
function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 0, $page = 0, $user_ids = 0, $sqlfilters = '') { function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 0, $page = 0, $user_ids = 0, $sqlfilters = '') {
@ -194,9 +194,8 @@ class AgendaEvents extends DolibarrApi
} }
$this->expensereport->lines = $lines; $this->expensereport->lines = $lines;
}*/ }*/
if ($this->actioncomm->create(DolibarrApiAccess::$user) <= 0) { if ($this->actioncomm->create(DolibarrApiAccess::$user) < 0) {
$errormsg = $this->actioncomm->error; throw new RestException(500, "Error creating event", array_merge(array($this->actioncomm->error), $this->actioncomm->errors));
throw new RestException(500, $errormsg ? $errormsg : "Error while creating actioncomm");
} }
return $this->actioncomm->id; return $this->actioncomm->id;

View File

@ -247,12 +247,6 @@ if ($id > 0)
print '</tr>'; print '</tr>';
} }
// Skype
if (! empty($conf->skype->enabled))
{
print '<td>'.$langs->trans('Skype').'</td><td>'.dol_print_skype($object->skype,0,$object->id,'AC_SKYPE').'</td></tr>';
}
// Assujeti a TVA ou pas // Assujeti a TVA ou pas
print '<tr>'; print '<tr>';
print '<td class="nowrap">'.$langs->trans('VATIsUsed').'</td><td>'; print '<td class="nowrap">'.$langs->trans('VATIsUsed').'</td><td>';

View File

@ -756,8 +756,9 @@ else
$sendingmode=$conf->global->MAIN_MAIL_SENDMODE; $sendingmode=$conf->global->MAIN_MAIL_SENDMODE;
if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function
// MAILING_NO_USING_PHPMAIL may be defined or not // MAILING_NO_USING_PHPMAIL may be defined or not.
// MAILING_LIMIT_SENDBYWEB is always defined to something != 0, MAILING_LIMIT_SENDBYCLI may be defined ot not. // MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden).
// MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0=no limit).
if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
{ {
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
@ -797,7 +798,7 @@ else
} }
$text.=$langs->trans('ConfirmSendingEmailing').'<br>'; $text.=$langs->trans('ConfirmSendingEmailing').'<br>';
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,270); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,300);
} }
} }
@ -844,23 +845,28 @@ else
print $langs->trans("TotalNbOfDistinctRecipients"); print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">'; print '</td><td colspan="3">';
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>'); $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
if ($object->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) if ($object->statut != 3 && is_numeric($nbemail))
{ {
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) $text='';
{ if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); {
print $form->textwithpicto($nbemail,$text,1,'warning'); if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
} {
else $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
{ }
$text=$langs->trans('NotEnoughPermissions'); else
print $form->textwithpicto($nbemail,$text,1,'warning'); {
} $text.=$langs->trans('NotEnoughPermissions');
}
} }
else if ($text)
{ {
print $nbemail; print $form->textwithpicto($nbemail,$text,1,'warning');
}
else
{
print $nbemail;
}
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -190,9 +190,8 @@ class Proposals extends DolibarrApi
} }
$this->propal->lines = $lines; $this->propal->lines = $lines;
}*/ }*/
if ($this->propal->create(DolibarrApiAccess::$user) <= 0) { if ($this->propal->create(DolibarrApiAccess::$user) < 0) {
$errormsg = $this->propal->error; throw new RestException(500, "Error creating order", array_merge(array($this->propal->error), $this->propal->errors));
throw new RestException(500, $errormsg ? $errormsg : "Error while creating order");
} }
return $this->propal->id; return $this->propal->id;

View File

@ -132,9 +132,9 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print '</div>';
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -195,9 +195,8 @@ class Orders extends DolibarrApi
} }
$this->commande->lines = $lines; $this->commande->lines = $lines;
}*/ }*/
if ($this->commande->create(DolibarrApiAccess::$user) <= 0) { if ($this->commande->create(DolibarrApiAccess::$user) < 0) {
$errormsg = $this->commande->error; throw new RestException(500, "Error creating order", array_merge(array($this->commande->error), $this->commande->errors));
throw new RestException(500, $errormsg ? $errormsg : "Error while creating order");
} }
return $this->commande->id; return $this->commande->id;

View File

@ -99,7 +99,7 @@ if (! $sortfield) $sortfield='c.ref';
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
// Initialize technical object to manage context to save list fields // Initialize technical object to manage context to save list fields
$contextpage='orderlist'; $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'orderlist';
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array($contextpage)); $hookmanager->initHooks(array($contextpage));
@ -653,6 +653,7 @@ if ($resql)
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);

View File

@ -160,7 +160,7 @@ class BankAccounts extends DolibarrApi
$account->courant = $account->type; $account->courant = $account->type;
if ($account->create(DolibarrApiAccess::$user) < 0) { if ($account->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(503, 'Error when creating account: ' . $account->error); throw new RestException(500, 'Error creating bank account', array_merge(array($account->error), $account->errors));
} }
return $account->id; return $account->id;
} }

View File

@ -203,9 +203,8 @@ class Invoices extends DolibarrApi
$this->invoice->lines = $lines; $this->invoice->lines = $lines;
}*/ }*/
if ($this->invoice->create(DolibarrApiAccess::$user) <= 0) { if ($this->invoice->create(DolibarrApiAccess::$user) < 0) {
$errormsg = $this->invoice->error; throw new RestException(500, "Error creating invoice", array_merge(array($this->invoice->error), $this->invoice->errors));
throw new RestException(500, $errormsg ? $errormsg : "Error while creating order");
} }
return $this->invoice->id; return $this->invoice->id;
} }

View File

@ -867,18 +867,20 @@ if ($resql)
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut; $facturestatic->statut=$obj->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$facturestatic->type=$obj->type;
$facturestatic->note_public=$obj->note_public; $facturestatic->note_public=$obj->note_public;
$facturestatic->note_private=$obj->note_private; $facturestatic->note_private=$obj->note_private;
$paiement = $facturestatic->getSommePaiement();
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
$totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
$remaintopay = $obj->total_ttc - $totalpay;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['f.facnumber']['checked'])) if (! empty($arrayfields['f.facnumber']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';
$paiement = $facturestatic->getSommePaiement();
$remaintopay = $obj->total_ttc - $paiement;
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
@ -1028,10 +1030,10 @@ if ($resql)
if (! empty($arrayfields['dynamount_payed']['checked'])) if (! empty($arrayfields['dynamount_payed']['checked']))
{ {
print '<td align="right">'.(! empty($paiement)?price($paiement,0,$langs):'&nbsp;').'</td>'; // TODO Use a denormalized field print '<td align="right">'.(! empty($totalpay)?price($totalpay,0,$langs):'&nbsp;').'</td>'; // TODO Use a denormalized field
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
$totalarray['totalam'] += $paiement; $totalarray['totalam'] += $totalpay;
} }
if (! empty($arrayfields['rtp']['checked'])) if (! empty($arrayfields['rtp']['checked']))

View File

@ -269,8 +269,9 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
$form = new Form($db); $form = new Form($db);
$formsocialcontrib = new FormSocialContrib($db); $formsocialcontrib = new FormSocialContrib($db);
$title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Card");
$help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)'; $help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
llxHeader("",$langs->trans("SocialContribution"),$help_url); llxHeader("",$title,$help_url);
// Mode creation // Mode creation

View File

@ -75,6 +75,13 @@ $modulepart='tax';
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
if ($action == 'setlib' && $user->rights->tax->charges->creer)
{
$object->fetch($id);
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
/* /*
* View * View
@ -82,8 +89,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
$form = new Form($db); $form = new Form($db);
$title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Documents");
$help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)'; $help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
llxHeader("",$langs->trans("SocialContribution"),$help_url); llxHeader("",$title,$help_url);
if ($object->id) if ($object->id)
{ {
@ -93,6 +101,20 @@ if ($object->id)
dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill'); dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
$morehtmlref='<div class="refidno">';
// Label of social contribution
$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
$morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/index.php">' . $langs->trans("BackToList") . '</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
// Construit liste des fichiers // Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
@ -105,62 +127,15 @@ if ($object->id)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object,'id');
print "</td></tr>";
// Label
if ($action == 'edit')
{
print '<tr><td>'.$langs->trans("Label").'</td><td>';
print '<input type="text" name="label" size="40" value="'.$object->lib.'">';
print '</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->lib.'</td></tr>';
}
// Type
print "<tr><td>".$langs->trans("Type")."</td><td>".$object->type_libelle."</td></tr>";
// Period end date
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
print "<td>";
if ($action == 'edit')
{
print $form->select_date($object->periode, 'period', 0, 0, 0, 'charge', 1);
}
else
{
print dol_print_date($object->periode,"day");
}
print "</td>";
print "</tr>";
// Due date
if ($action == 'edit')
{
print '<tr><td>'.$langs->trans("DateDue")."</td><td>";
print $form->select_date($object->date_ech, 'ech', 0, 0, 0, 'charge', 1);
print "</td></tr>";
}
else {
print "<tr><td>".$langs->trans("DateDue")."</td><td>".dol_print_date($object->date_ech,'day')."</td></tr>";
}
// Amount
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4,$alreadypayed).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
$modulepart = 'tax'; $modulepart = 'tax';
$permission = $user->rights->tax->charges->creer; $permission = $user->rights->tax->charges->creer;

View File

@ -37,25 +37,52 @@ $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges'); $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
/*
* Actions
*/
if ($action == 'setlib' && $user->rights->tax->charges->creer)
{
$object->fetch($id);
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
/* /*
* View * View
*/ */
$title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Info");
$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
llxHeader("",$title,$help_url);
$help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)'; $object = new ChargeSociales($db);
llxHeader("",$langs->trans("SocialContribution"),$help_url); $object->fetch($id);
$object->info($id);
$chargesociales = new ChargeSociales($db); $head = tax_prepare_head($object);
$chargesociales->fetch($id);
$chargesociales->info($id);
$head = tax_prepare_head($chargesociales);
dol_fiche_head($head, 'info', $langs->trans("SocialContribution"), 0, 'bill'); dol_fiche_head($head, 'info', $langs->trans("SocialContribution"), 0, 'bill');
$morehtmlref='<div class="refidno">';
// Label of social contribution
$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
$morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/index.php">' . $langs->trans("BackToList") . '</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($chargesociales); dol_print_object_info($object);
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>'; print '</div>';

View File

@ -250,11 +250,16 @@ $dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore';
$dolibarr_nocsrfcheck='0'; $dolibarr_nocsrfcheck='0';
// dolibarr_mailing_limit_sendbyweb // dolibarr_mailing_limit_sendbyweb
// Can set a limit for mailing send by web. Can be used for a restricted mode. // Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
// Default value: 0 (use database value if exist) // Default value: '25'
// Examples: // Examples: '-1' (sending by web is forbidden)
// $dolibarr_mailing_limit_sendbyweb='0'; // $dolibarr_mailing_limit_sendbyweb='25';
// dolibarr_mailing_limit_sendbycli
// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level.
// Default value: '0' (no hard limit, use soft database value if exists)
// Examples: '-1' (sending by cli is forbidden)
// $dolibarr_mailing_limit_sendbycli='0';
//################## //##################
@ -273,18 +278,6 @@ $dolibarr_nocsrfcheck='0';
// Examples: // Examples:
// $dolibarr_main_limit_users='0'; // $dolibarr_main_limit_users='0';
// dolibarr_mailing_limit_sendbyweb
// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
// Default value: '0' (no overwrite, use database value if exists)
// Examples: '-1' (sending by web is forbidden)
// $dolibarr_mailing_limit_sendbyweb='0';
// dolibarr_mailing_limit_sendbycli
// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level.
// Default value: '0' (no overwrite, use database value if exists)
// Examples: '-1' (sending by cli is forbidden)
// $dolibarr_mailing_limit_sendbycli='0';
// dolibarr_strict_mode // dolibarr_strict_mode
// Set this to 1 to enable the PHP strict mode. For dev environment only. // Set this to 1 to enable the PHP strict mode. For dev environment only.
// Default value: 0 (use database value if exist) // Default value: 0 (use database value if exist)

View File

@ -488,28 +488,35 @@ class CMailFile
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10;
$tmparray = explode(',', $this->addr_to); $tmparray1 = explode(',', $this->addr_to);
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)
{ {
$this->error = 'Too much recipients in to:'; $this->error = 'Too much recipients in to:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false; return false;
} }
$tmparray = explode(',', $this->addr_cc); $tmparray2 = explode(',', $this->addr_cc);
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)
{ {
$this->error = 'Too much recipients in cc:'; $this->error = 'Too much recipients in cc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false; return false;
} }
$tmparray = explode(',', $this->addr_bcc); $tmparray3 = explode(',', $this->addr_bcc);
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)
{ {
$this->error = 'Too much recipients in bcc:'; $this->error = 'Too much recipients in bcc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false; return false;
} }
if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in to:, cc:, bcc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
// Action according to choosed sending method // Action according to choosed sending method
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{ {
@ -538,25 +545,28 @@ class CMailFile
} }
else else
{ {
$bounce = ''; // By default $additionnalparam = ''; // By default
if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F))
{ {
// le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA // le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA
// Le forcage de la valeur grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie. // Le forcage de la valeur grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie.
// La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse) // Having this variable defined may create problems with some sendmail (option -f refused)
$bounce .= ($bounce?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') ); // Having this variable not defined may create problems with some other sendmail (option -f required)
$additionnalparam .= ($additionnalparam?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') );
} }
if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender
{ {
$bounce .= ($bounce?' ':'').'-ba'; $additionnalparam .= ($additionnalparam?' ':'').'-ba';
} }
dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG); if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) $additionnalparam .= ($additionnalparam?' ':'').'-U '.$additionnalparam; // Use -U to add additionnal params
dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$additionnalparam, LOG_DEBUG);
$this->message=stripslashes($this->message); $this->message=stripslashes($this->message);
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
if (! empty($bounce)) $res = mail($dest,$this->encodetorfc2822($this->subject),$this->message,$this->headers, $bounce); if (! empty($additionnalparam)) $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers, $additionnalparam);
else $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers); else $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers);
if (! $res) if (! $res)

View File

@ -282,6 +282,7 @@ class Conf
// Define default dir_output and dir_temp for directories of modules // Define default dir_output and dir_temp for directories of modules
foreach($this->modules as $module) foreach($this->modules as $module)
{ {
//var_dump($module);
// For multicompany sharings // For multicompany sharings
$this->$module->multidir_output = array($this->entity => $rootfordata."/".$module); $this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
$this->$module->multidir_temp = array($this->entity => $rootfordata."/".$module."/temp"); $this->$module->multidir_temp = array($this->entity => $rootfordata."/".$module."/temp");

View File

@ -5633,18 +5633,18 @@ class Form
* Return a HTML area with the reference of object and a navigation bar for a business object * Return a HTML area with the reference of object and a navigation bar for a business object
* To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria. * To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria.
* *
* @param object $object Object to show * @param object $object Object to show.
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link * @param string $paramid Name of parameter to use to name the id into the URL next/previous link.
* @param string $morehtml More html content to output just before the nav bar * @param string $morehtml More html content to output just before the nav bar.
* @param int $shownav Show Condition (navigation is shown if value is 1) * @param int $shownav Show Condition (navigation is shown if value is 1).
* @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field) * @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field).
* @param string $fieldref Name of field ref of object (object->ref) to show or 'none' to not show ref. * @param string $fieldref Name of field ref of object (object->ref) to show or 'none' to not show ref.
* @param string $morehtmlref More html to show after ref * @param string $morehtmlref More html to show after ref.
* @param string $moreparam More param to add in nav link url. * @param string $moreparam More param to add in nav link url. Must start with '&...'.
* @param int $nodbprefix Do not include DB prefix to forge table name * @param int $nodbprefix Do not include DB prefix to forge table name.
* @param string $morehtmlleft More html code to show before ref * @param string $morehtmlleft More html code to show before ref.
* @param string $morehtmlstatus More html code to show under navigation arrows (status place) * @param string $morehtmlstatus More html code to show under navigation arrows (status place).
* @param string $morehtmlright More html code to show after ref * @param string $morehtmlright More html code to show after ref.
* @return string Portion HTML with ref + navigation buttons * @return string Portion HTML with ref + navigation buttons
*/ */
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='') function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='')
@ -5657,7 +5657,7 @@ class Form
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
//$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):'&nbsp;').'</a>':''; //$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):'&nbsp;').'</a>':'';
//$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):'&nbsp;').'</a>':''; //$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):'&nbsp;').'</a>':'';
$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(($conf->dol_use_jmobile != 4)?'&lt;':'&nbsp;').'</a>':'<span class="inactive">'.(($conf->dol_use_jmobile != 4)?'&lt;':'&nbsp;').'</span>'; $previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(($conf->dol_use_jmobile != 4)?'&lt;':'&nbsp;').'</a>':'<span class="inactive">'.(($conf->dol_use_jmobile != 4)?'&lt;':'&nbsp;').'</span>';

View File

@ -810,7 +810,7 @@ class DoliDBMysqli extends DoliDB
/** /**
* Create a user and privileges to connect to database (even if database does not exists yet) * Create a user and privileges to connect to database (even if database does not exists yet)
* *
* @param string $dolibarr_main_db_host Ip serveur * @param string $dolibarr_main_db_host Ip server or '%'
* @param string $dolibarr_main_db_user Nom user a creer * @param string $dolibarr_main_db_user Nom user a creer
* @param string $dolibarr_main_db_pass Mot de passe user a creer * @param string $dolibarr_main_db_pass Mot de passe user a creer
* @param string $dolibarr_main_db_name Database name where user must be granted * @param string $dolibarr_main_db_name Database name where user must be granted

View File

@ -239,7 +239,7 @@ function show_array_actions_to_do($max=5)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("LastActionsToDo",$max).'</td>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("LastActionsToDo",$max).'</td>';
print '<td colspan="2" align="right"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=todo">'.$langs->trans("FullList").'</a>'; print '<td colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=todo">'.$langs->trans("FullList").'</a>';
print '</tr>'; print '</tr>';
$var = true; $var = true;
@ -336,7 +336,7 @@ function show_array_last_actions_done($max=5)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("LastDoneTasks",$max).'</td>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("LastDoneTasks",$max).'</td>';
print '<td colspan="2" align="right"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=done">'.$langs->trans("FullList").'</a>'; print '<td colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=done">'.$langs->trans("FullList").'</a>';
print '</tr>'; print '</tr>';
$var = true; $var = true;
$i = 0; $i = 0;

View File

@ -1071,6 +1071,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
$morehtmlstatus.=$tmptxt; $morehtmlstatus.=$tmptxt;
} }
elseif ($object->element == 'loan')
{
$tmptxt=$object->getLibStatut(6, $object->totalpaye);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
$morehtmlstatus.=$tmptxt;
}
elseif ($object->element == 'contrat') elseif ($object->element == 'contrat')
{ {
if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2); if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2);
@ -1082,7 +1088,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$morehtmlstatus.=$tmptxt; $morehtmlstatus.=$tmptxt;
} }
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>'; // For product if ($object->element == 'product' && ! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>';
if ($object->element != 'product') if ($object->element != 'product')
{ {
$morehtmlref.='<div class="refidno">'; $morehtmlref.='<div class="refidno">';
@ -1096,7 +1103,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$morehtmlref.='</div>'; $morehtmlref.='</div>';
} }
print '<div class="'.($onlybanner?'':'arearef ').'heightref valignmiddle" width="100%">'; print '<div class="'.($onlybanner?'arearefnobottom ':'arearef ').'heightref valignmiddle" width="100%">';
print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
print '</div>'; print '</div>';
print '<div class="underrefbanner clearboth"></div>'; print '<div class="underrefbanner clearboth"></div>';

View File

@ -2007,13 +2007,14 @@ function getElementProperties($element_type)
/** /**
* Fetch an object from its id and element_type * Fetch an object from its id and element_type
* Inclusion classes is automatic * Inclusion of classes is automatic
* *
* @param int $element_id Element id * @param int $element_id Element id
* @param string $element_type Element type * @param string $element_type Element type
* @param ref $element_ref Element ref (Use this if element_id but not both)
* @return int|object object || 0 || -1 if error * @return int|object object || 0 || -1 if error
*/ */
function fetchObjectByElement($element_id, $element_type) function fetchObjectByElement($element_id, $element_type, $element_ref='')
{ {
global $conf; global $conf;
global $db,$conf; global $db,$conf;
@ -2023,11 +2024,11 @@ function fetchObjectByElement($element_id, $element_type)
{ {
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php'); dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
$objectstat = new $element_prop['classname']($db); $objecttmp = new $element_prop['classname']($db);
$ret = $objectstat->fetch($element_id); $ret = $objecttmp->fetch($element_id, $element_ref);
if ($ret >= 0) if ($ret >= 0)
{ {
return $objectstat; return $objecttmp;
} }
} }
return 0; return 0;

View File

@ -844,7 +844,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
$langs->load("orders"); $langs->load("orders");
if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&amp;viewstatut=-3&amp;billed=0", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&amp;viewstatut=-3&amp;billed=0&amp;contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
// if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); // if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
} }

View File

@ -129,6 +129,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->posxtva-=20; $this->posxtva-=20;
$this->posxup-=20; $this->posxup-=20;
$this->posxqty-=20; $this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20; $this->posxdiscount-=20;
$this->postotalht-=20; $this->postotalht-=20;
} }

View File

@ -135,12 +135,14 @@ class pdf_crabe extends ModelePDFFactures
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
$this->posxpicture-=20; $this->posxpicture-=20;
$this->posxtva-=20; $this->posxtva-=20;
$this->posxup-=20; $this->posxup-=20;
$this->posxqty-=20; $this->posxqty-=20;
$this->posxdiscount-=20; $this->posxunit-=20;
$this->postotalht-=20; $this->posxdiscount-=20;
$this->posxprogress-=20;
$this->postotalht-=20;
} }
$this->tva=array(); $this->tva=array();
@ -297,7 +299,7 @@ class pdf_crabe extends ModelePDFFactures
$this->atleastonediscount++; $this->atleastonediscount++;
} }
} }
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS)) if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS)) // retreive space not used by discount
{ {
$this->posxpicture+=($this->postotalht - $this->posxdiscount); $this->posxpicture+=($this->postotalht - $this->posxdiscount);
$this->posxtva+=($this->postotalht - $this->posxdiscount); $this->posxtva+=($this->postotalht - $this->posxdiscount);
@ -527,9 +529,9 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($this->posxprogress-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); $pdf->MultiCell($this->posxprogress-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
} }
// Situation progress
if ($this->situationinvoice) if ($this->situationinvoice)
{ {
// Situation progress
$progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxprogress, $curY); $pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R'); $pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R');

View File

@ -44,12 +44,12 @@ class ModeleImports
public $version_lib; // Version of external lib used by driver public $version_lib; // Version of external lib used by driver
// Array of all drivers // Array of all drivers
public $_driverlabel=array(); public $driverlabel=array();
public $_driverdesc=array(); public $driverdesc=array();
public $_driverversion=array(); public $driverversion=array();
public $_liblabel=array(); public $liblabel=array();
public $_libversion=array(); public $libversion=array();
/** /**
@ -166,19 +166,19 @@ class ModeleImports
// Picto // Picto
$this->picto[$module->id]=$module->picto; $this->picto[$module->id]=$module->picto;
// Driver properties // Driver properties
$this->_driverlabel[$module->id]=$module->getDriverLabel(''); $this->driverlabel[$module->id]=$module->getDriverLabel('');
$this->_driverdesc[$module->id]=$module->getDriverDesc(''); $this->driverdesc[$module->id]=$module->getDriverDesc('');
$this->_driverversion[$module->id]=$module->getDriverVersion(''); $this->driverversion[$module->id]=$module->getDriverVersion('');
// If use an external lib // If use an external lib
$this->_liblabel[$module->id]=$module->getLibLabel(''); $this->liblabel[$module->id]=$module->getLibLabel('');
$this->_libversion[$module->id]=$module->getLibVersion(''); $this->libversion[$module->id]=$module->getLibVersion('');
$i++; $i++;
} }
} }
} }
return array_keys($this->_driverlabel); return array_keys($this->driverlabel);
} }
@ -201,7 +201,7 @@ class ModeleImports
*/ */
function getDriverLabelForKey($key) function getDriverLabelForKey($key)
{ {
return $this->_driverlabel[$key]; return $this->driverlabel[$key];
} }
/** /**
@ -212,7 +212,7 @@ class ModeleImports
*/ */
function getDriverDescForKey($key) function getDriverDescForKey($key)
{ {
return $this->_driverdesc[$key]; return $this->driverdesc[$key];
} }
/** /**
@ -223,7 +223,7 @@ class ModeleImports
*/ */
function getDriverVersionForKey($key) function getDriverVersionForKey($key)
{ {
return $this->_driverversion[$key]; return $this->driverversion[$key];
} }
/** /**
@ -234,7 +234,7 @@ class ModeleImports
*/ */
function getLibLabelForKey($key) function getLibLabelForKey($key)
{ {
return $this->_liblabel[$key]; return $this->liblabel[$key];
} }
/** /**
@ -245,7 +245,7 @@ class ModeleImports
*/ */
function getLibVersionForKey($key) function getLibVersionForKey($key)
{ {
return $this->_libversion[$key]; return $this->libversion[$key];
} }
} }

View File

@ -287,12 +287,12 @@ class modFournisseur extends DolibarrModules
$this->export_label[$r]='Factures fournisseurs et lignes de facture'; $this->export_label[$r]='Factures fournisseurs et lignes de facture';
$this->export_icon[$r]='bill'; $this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("fournisseur","facture","export")); $this->export_permission[$r]=array(array("fournisseur","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId', $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>'DateMaxPayment','f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId',
'p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_buy'=>'ProductAccountancyBuyCode','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel'); 'p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_buy'=>'ProductAccountancyBuyCode','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.total_tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.total_tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.total_tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label', $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>'Date','f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.total_tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label',
'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text'); 'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product', $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>'invoice','f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product',
'p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project'); 'p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object // Add extra fields object

View File

@ -127,6 +127,7 @@ class pdf_azur extends ModelePDFPropales
$this->posxtva-=20; $this->posxtva-=20;
$this->posxup-=20; $this->posxup-=20;
$this->posxqty-=20; $this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20; $this->posxdiscount-=20;
$this->postotalht-=20; $this->postotalht-=20;
} }

View File

@ -113,6 +113,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->posxtva-=20; $this->posxtva-=20;
$this->posxup-=20; $this->posxup-=20;
$this->posxqty-=20; $this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20; $this->posxdiscount-=20;
$this->postotalht-=20; $this->postotalht-=20;
} }

View File

@ -127,6 +127,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->posxtva-=20; $this->posxtva-=20;
$this->posxup-=20; $this->posxup-=20;
$this->posxqty-=20; $this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20; $this->posxdiscount-=20;
$this->postotalht-=20; $this->postotalht-=20;
} }

View File

@ -115,6 +115,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->posxtva-=20; $this->posxtva-=20;
$this->posxup-=20; $this->posxup-=20;
$this->posxqty-=20; $this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20; $this->posxdiscount-=20;
$this->postotalht-=20; $this->postotalht-=20;
} }

View File

@ -22,6 +22,9 @@
* *
* $cols * $cols
*/ */
?>
<!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php -->
<?php
//$res = $object->fetch_optionals($object->id, $extralabels); //$res = $object->fetch_optionals($object->id, $extralabels);
$parameters = array('colspan' => ' colspan="'.$cols.'"', 'cols' => $cols, 'socid' => $object->fk_soc); $parameters = array('colspan' => ' colspan="'.$cols.'"', 'cols' => $cols, 'socid' => $object->fk_soc);
@ -47,7 +50,9 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
if (!empty($extrafields->attribute_hidden[$key])) print '<tr class="hideobject"><td>'; if (!empty($extrafields->attribute_hidden[$key])) print '<tr class="hideobject"><td>';
else print '<tr><td>'; else print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td'; print '<table width="100%" class="nobordernopadding">';
print '<tr>';
print '<td';
//var_dump($action);exit; //var_dump($action);exit;
if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"'; if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>' . $langs->trans($label) . '</td>'; print '>' . $langs->trans($label) . '</td>';
@ -100,3 +105,5 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
} }
} }
} }
?>
<!-- END PHP TEMPLATE admin_extrafields_view.tpl.php -->

View File

@ -10,21 +10,21 @@ print '<div class="tagtable centpercent noborder allwidth">';
if($mode == 'edit' ) if($mode == 'edit' )
{ {
print '<form class="tagtr liste_titre">'; print '<form class="tagtr liste_titre">';
print '<div class="tagtd">'.$langs->trans('Resource').'</div>'; print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd">'.$langs->trans('Type').'</div>'; print '<div class="tagtd liste_titre">'.$langs->trans('Type').'</div>';
print '<div class="tagtd" align="center">'.$langs->trans('Busy').'</div>'; print '<div class="tagtd liste_titre" align="center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd" align="center">'.$langs->trans('Mandatory').'</div>'; print '<div class="tagtd liste_titre" align="center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd"></div>'; print '<div class="tagtd liste_titre"></div>';
print '</form>'; print '</form>';
} }
else else
{ {
print '<form class="tagtr liste_titre">'; print '<form class="tagtr liste_titre">';
print '<div class="tagtd">'.$langs->trans('Resource').'</div>'; print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd">'.$langs->trans('Type').'</div>'; print '<div class="tagtd liste_titre">'.$langs->trans('Type').'</div>';
print '<div class="tagtd" align="center">'.$langs->trans('Busy').'</div>'; print '<div class="tagtd liste_titre" align="center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd" align="center">'.$langs->trans('Mandatory').'</div>'; print '<div class="tagtd liste_titre" align="center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd"></div>'; print '<div class="tagtd liste_titre"></div>';
print '</form>'; print '</form>';
} }
@ -66,7 +66,7 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print '<div class="tagtd">'; print '<div class="tagtd">';
print $object_resource->getNomUrl(1); print $object_resource->getNomUrl(1);
print '</div class="tagtd">'; print '</div>';
print '<div class="tagtd">'; print '<div class="tagtd">';
print $object_resource->type_label; print $object_resource->type_label;

View File

@ -49,7 +49,7 @@ $action=GETPOST('action','alpha');
$cancel=GETPOST('cancel'); $cancel=GETPOST('cancel');
$amount=GETPOST('amount'); $amount=GETPOST('amount');
$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$projectid=GETPOST('projectid')?GETPOST('projectid','int'):GETPOST("fk_projet",'int'); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
$object = new Don($db); $object = new Don($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
@ -109,7 +109,7 @@ if ($action == 'update')
$object->email = GETPOST("email"); $object->email = GETPOST("email");
$object->date = $donation_date; $object->date = $donation_date;
$object->public = GETPOST("public"); $object->public = GETPOST("public");
$object->fk_projet = GETPOST("fk_projet"); $object->fk_project = GETPOST("fk_project");
$object->note_private= GETPOST("note_private"); $object->note_private= GETPOST("note_private");
$object->note_public = GETPOST("note_public"); $object->note_public = GETPOST("note_public");
@ -164,7 +164,7 @@ if ($action == 'add')
$object->note_private= GETPOST("note_private"); $object->note_private= GETPOST("note_private");
$object->note_public = GETPOST("note_public"); $object->note_public = GETPOST("note_public");
$object->public = GETPOST("public"); $object->public = GETPOST("public");
$object->fk_projet = GETPOST("fk_projet"); $object->fk_project = GETPOST("fk_project");
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@ -230,6 +230,11 @@ if ($action == 'set_paid')
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
else if ($action == 'classin' && $user->rights->don->creer)
{
$object->fetch($id);
$object->setProject($projectid);
}
// Remove file in doc form // Remove file in doc form
if ($action == 'remove_file') if ($action == 'remove_file')
{ {
@ -361,7 +366,7 @@ if ($action == 'create')
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print "<tr><td>".$langs->trans("Project")."</td><td>"; print "<tr><td>".$langs->trans("Project")."</td><td>";
$formproject->select_projects(-1, $projectid,'fk_projet', 0, 0, 1, 1); $formproject->select_projects(-1, $projectid,'fk_project', 0, 0, 1, 1);
print "</td></tr>\n"; print "</td></tr>\n";
} }
@ -486,7 +491,7 @@ if (! empty($id) && $action == 'edit')
$langs->load('projects'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td>'; print '<tr><td>'.$langs->trans('Project').'</td><td>';
$formproject->select_projects(-1, $object->fk_projet,'fk_projet', 0, 0, 1, 1); $formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 0, 1, 1);
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -363,7 +363,7 @@ class Don extends CommonObject
$sql.= ", '".$this->db->escape($this->town)."'"; $sql.= ", '".$this->db->escape($this->town)."'";
$sql.= ", ".$this->country_id; $sql.= ", ".$this->country_id;
$sql.= ", ".$this->public; $sql.= ", ".$this->public;
$sql.= ", ".($this->fk_projet > 0?$this->fk_projet:"null"); $sql.= ", ".($this->fk_project > 0?$this->fk_project:"null");
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql.= ", ".$user->id; $sql.= ", ".$user->id;
@ -459,7 +459,7 @@ class Don extends CommonObject
$sql .= ",town='".$this->db->escape($this->town)."'"; $sql .= ",town='".$this->db->escape($this->town)."'";
$sql .= ",fk_country = ".$this->country_id; $sql .= ",fk_country = ".$this->country_id;
$sql .= ",public=".$this->public; $sql .= ",public=".$this->public;
$sql .= ",fk_projet=".($this->fk_projet>0?$this->fk_projet:'null'); $sql .= ",fk_projet=".($this->fk_project>0?$this->fk_project:'null');
$sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql .= ",datedon='".$this->db->idate($this->date)."'"; $sql .= ",datedon='".$this->db->idate($this->date)."'";

View File

@ -48,6 +48,7 @@ $id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
@ -79,6 +80,11 @@ $modulepart='don';
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
if ($action == 'classin' && $user->rights->don->creer)
{
$object->fetch($id);
$object->setProject($projectid);
}
/* /*
* View * View
@ -87,7 +93,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
$form = new Form($db); $form = new Form($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
llxHeader("",$langs->trans("Donation")); $title = $langs->trans('Donation') . " - " . $langs->trans('Documents');
$helpurl = "";
llxHeader('', $title, $helpurl);
if ($object->id) if ($object->id)

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> /* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@zendsi.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -25,37 +25,101 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
$langs->load("donations"); $langs->load("donations");
// Security check
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref=GETPOST('ref','alpha');
$action=GETPOST('action','alpha');
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'don', $id, ''); $result = restrictedArea($user, 'don', $id, '');
$object = new Don($db);
$object->fetch($id);
/*
* Actions
*/
if ($action == 'classin' && $user->rights->don->creer)
{
$object->fetch($id);
$object->setProject($projectid);
}
/* /*
* View * View
*/ */
$title = $langs->trans('Donation') . " - " . $langs->trans('Info');
$helpurl = "";
llxHeader('', $title, $helpurl);
llxHeader("",$langs->trans("Donation")); $form = new Form($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
if ($id) $object->info($id);
$head = donation_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Donation"), 0, 'generic');
$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Project
if (! empty($conf->projet->enabled))
{ {
$object = new Don($db); $langs->load("projects");
$object->fetch($id); $morehtmlref.=$langs->trans('Project') . ' ';
$object->info($id); if ($user->rights->don->creer)
{
$head = donation_prepare_head($object); if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
dol_fiche_head($head, 'info', $langs->trans("Donation"), 0, 'generic'); if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
print '<table width="100%"><tr><td>'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
dol_print_object_info($object); $morehtmlref.='<input type="hidden" name="action" value="classin">';
print '</td></tr></table>'; $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
print '</div>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
} }
$morehtmlref.='</div>';
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
dol_fiche_end();
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -2,7 +2,8 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,15 +20,20 @@
*/ */
/** /**
* \file htdocs/compta/facture/note.php * \file htdocs/don/note.php
* \ingroup facture * \ingroup donations
* \brief Fiche de notes sur une facture * \brief Page to show a donation notes
*/ */
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
$langs->load("companies"); $langs->load("companies");
$langs->load("bills"); $langs->load("bills");
@ -36,6 +42,7 @@ $langs->load("donations");
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
$ref=GETPOST('ref','alpha'); $ref=GETPOST('ref','alpha');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check // Security check
$socid=0; $socid=0;
@ -51,10 +58,13 @@ $permissionnote=$user->rights->don->creer; // Used by the include of actions_set
/* /*
* Actions * Actions
*/ */
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once if ($action == 'classin' && $user->rights->don->creer)
{
$object->fetch($id);
$object->setProject($projectid);
}
/* /*
* View * View
@ -65,35 +75,65 @@ $helpurl = "";
llxHeader('', $title, $helpurl); llxHeader('', $title, $helpurl);
$form = new Form($db); $form = new Form($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$object = new Don($db); $object = new Don($db);
$object->fetch($id,$ref); $object->fetch($id,$ref);
$head = donation_prepare_head($object); $head = donation_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("Donation"), 0, 'generic'); dol_fiche_head($head, 'note', $langs->trans("Donation"), 0, 'generic');
$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php">'.$langs->trans("BackToList").'</a>';
print '<table class="border" width="100%">';
// Ref $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '</td></tr>';
print "</table>"; $morehtmlref='<div class="refidno">';
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.=$langs->trans('Project') . ' ';
if ($user->rights->don->creer)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
print '<br>'; dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
dol_fiche_end(); dol_fiche_end();
} }
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -97,22 +97,19 @@ $form = new Form($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$soc = new Societe($db);
$soc->fetch($object->socid);
$head=shipping_prepare_head($object); $head=shipping_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("Shipment"), 0, 'sending'); dol_fiche_head($head, 'note', $langs->trans("Shipment"), 0, 'sending');
// Shipment card // Shipment card
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer shipment // Ref customer shipment
$morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project // Project
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
$langs->load("projects"); $langs->load("projects");

View File

@ -177,9 +177,8 @@ class ExpenseReports extends DolibarrApi
} }
$this->expensereport->lines = $lines; $this->expensereport->lines = $lines;
}*/ }*/
if ($this->expensereport->create(DolibarrApiAccess::$user) <= 0) { if ($this->expensereport->create(DolibarrApiAccess::$user) < 0) {
$errormsg = $this->expensereport->error; throw new RestException(500, "Error creating expensereport", array_merge(array($this->expensereport->error), $this->expensereport->errors));
throw new RestException(500, $errormsg ? $errormsg : "Error while creating expensereport");
} }
return $this->expensereport->id; return $this->expensereport->id;

View File

@ -1395,10 +1395,12 @@ else if ($id > 0 || ! empty($ref))
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Description').'</td>'; print '<td class="liste_titre">'.$langs->trans('Description').'</td>';
print '<td align="center">'.$langs->trans('Date').'</td>'; print '<td class="liste_titre" align="center">'.$langs->trans('Date').'</td>';
print '<td align="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').'</td>'; print '<td class="liste_titre" align="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').'</td>';
print '<td width="48" colspan="3">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }
$var=true; $var=true;

View File

@ -383,7 +383,7 @@ class Fichinter extends CommonObject
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }

View File

@ -45,7 +45,11 @@ $result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
$object = new Fichinter($db); $object = new Fichinter($db);
$result = $object->fetch($id,$ref); $result = $object->fetch($id,$ref);
if (! $result)
{
print 'Record not found';
exit;
}
/* /*
* Adding a new contact * Adding a new contact
@ -166,7 +170,7 @@ if ($id > 0 || ! empty($ref))
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, 0, 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_fiche_end(); dol_fiche_end();

View File

@ -253,7 +253,7 @@ if ($result)
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">'; print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder); if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre('',$_SERVER["PHP_SELF"],''); if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre('',$_SERVER["PHP_SELF"],'');
@ -407,10 +407,11 @@ if ($result)
print $warnornote; print $warnornote;
print '</td>'; print '</td>';
} }
// Other picto tool // Other picto tool
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">'; print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->fichinter->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->ficheinter->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -203,9 +203,8 @@ class SupplierInvoices extends DolibarrApi
$this->invoice->lines = $lines; $this->invoice->lines = $lines;
}*/ }*/
if ($this->invoice->create(DolibarrApiAccess::$user) <= 0) { if ($this->invoice->create(DolibarrApiAccess::$user) < 0) {
$errormsg = $this->invoice->error; throw new RestException(500, "Error creating order", array_merge(array($this->invoice->error), $this->invoice->errors));
throw new RestException(500, $errormsg ? $errormsg : "Error while creating order");
} }
return $this->invoice->id; return $this->invoice->id;
} }

View File

@ -15,55 +15,35 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
.minwidth100 { min-width: 100px; }
.minwidth200 { min-width: 200px; }
.minwidth300 { min-width: 300px; }
.minwidth400 { min-width: 400px; }
.minwidth500 { min-width: 500px; }
.minwidth50imp { min-width: 50px !important; }
.minwidth100imp { min-width: 100px !important; }
.minwidth200imp { min-width: 200px !important; }
.minwidth300imp { min-width: 300px !important; }
.minwidth400imp { min-width: 400px !important; }
.minwidth500imp { min-width: 500px !important; }
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
{
input, input[type=text], input[type=password], select, textarea {
min-width: 20px;
min-height: 1.4em;
line-height: 1.4em;
padding: .4em .1em;
border: 1px solid #BBB;
/* max-width: inherit; why this ? */
}
.hideonsmartphone { display: none; }
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
.maxwidthonsmartphone { max-width: 100px; }
.maxwidth50onsmartphone { max-width: 40px; }
.maxwidth75onsmartphone { max-width: 50px; }
.maxwidth100onsmartphone { max-width: 70px; }
.maxwidth150onsmartphone { max-width: 120px; }
.maxwidth200onsmartphone { max-width: 200px; }
.maxwidth300onsmartphone { max-width: 300px; }
.maxwidth400onsmartphone { max-width: 400px; }
.minwidth50imp { min-width: 50px !important; }
.minwidth100imp { min-width: 50px !important; }
.minwidth200imp { min-width: 50px !important; }
.minwidth300imp { min-width: 50px !important; }
.minwidth400imp { min-width: 50px !important; }
.minwidth500imp { min-width: 50px !important; }
}
body { body {
font-size:13px; font-size:14px;
font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif; font-family: roboto,arial,tahoma,verdana,helvetica;
background: #fcfcfc; /* background: #fcfcfc; */
margin: 15px 30px 10px; margin: 15px 30px 10px;
} }
table.main-inside {
padding-left: 10px;
padding-right: 10px;
padding-bottom: 10px;
margin-bottom: 10px;
margin-top: 10px;
color: #000000;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
line-height: 22px;
}
table.main {
padding-left: 6px;
padding-right: 6px;
padding-top: 12px;
padding-bottom: 12px;
background-color: #fff;
}
div.titre { div.titre {
padding: 5px 5px 5px 5px; padding: 5px 5px 5px 5px;
margin: 0 0 0 0; margin: 0 0 0 0;
@ -90,6 +70,75 @@ div.soustitre {
text-align: right; text-align: right;
} }
.minwidth100 { min-width: 100px; }
.minwidth200 { min-width: 200px; }
.minwidth300 { min-width: 300px; }
.minwidth400 { min-width: 400px; }
.minwidth500 { min-width: 500px; }
.minwidth50imp { min-width: 50px !important; }
.minwidth100imp { min-width: 100px !important; }
.minwidth200imp { min-width: 200px !important; }
.minwidth300imp { min-width: 300px !important; }
.minwidth400imp { min-width: 400px !important; }
.minwidth500imp { min-width: 500px !important; }
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
{
body {
margin: 15px 4px 4px;
}
input, input[type=text], input[type=password], select, textarea {
min-width: 20px;
min-height: 1.4em;
line-height: 1.4em;
padding: .4em .1em;
border: 1px solid #BBB;
/* max-width: inherit; why this ? */
}
.hideonsmartphone { display: none; }
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
.maxwidthonsmartphone { max-width: 100px; }
.maxwidth50onsmartphone { max-width: 40px; }
.maxwidth75onsmartphone { max-width: 50px; }
.maxwidth100onsmartphone { max-width: 70px; }
.maxwidth150onsmartphone { max-width: 120px; }
.maxwidth200onsmartphone { max-width: 200px; }
.maxwidth300onsmartphone { max-width: 300px; }
.maxwidth400onsmartphone { max-width: 400px; }
.minwidth50imp { min-width: 50px !important; }
.minwidth100imp { min-width: 50px !important; }
.minwidth200imp { min-width: 50px !important; }
.minwidth300imp { min-width: 50px !important; }
.minwidth400imp { min-width: 50px !important; }
.minwidth500imp { min-width: 50px !important; }
table.main {
padding-left: 0;
padding-right: 0;
}
table.main-inside {
padding-left: 1px;
padding-right: 1px;
line-height: 20px;
}
span.titre {
font-size: 90%;
font-weight: normal;
background: #FFFFFF;
color: #444;
border: 1px solid #999;
padding: 5px 5px 5px 5px;
margin: 0 0 0 4px;
}
}
input:disabled input:disabled
{ {
background: #FDFDFD; background: #FDFDFD;
@ -150,33 +199,12 @@ input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 50px #FBFFEA inset; -webkit-box-shadow: 0 0 0 50px #FBFFEA inset;
} }
table.main {
padding-left: 6px;
padding-right: 6px;
padding-top: 12px;
padding-bottom: 12px;
border: 1px solid #A0A0A0;
border-radius: 8px;
border: solid 1px rgba(90,90,90,.4);
background-color: #fff;
-moz-box-shadow: 0px 1px 6px 2px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0px 1px 6px 2px rgba(0, 0, 0, 0.2);
box-shadow: 0px 1px 6px 2px rgba(0, 0, 0, 0.2);
}
table.main-inside {
padding-left: 10px;
padding-right: 10px;
margin-bottom: 10px;
margin-top: 10px;
color: #000000;
}
table.listofchoices, tr.listofchoices, td.listofchoices { table.listofchoices, tr.listofchoices, td.listofchoices {
border-collapse: collapse; border-collapse: collapse;
padding: 4px; padding: 4px;
color: #000000; color: #000000;
border: 1px solid #999 !important; border: 1px solid #ccc !important;
line-height: 18px;
} }
tr.listofchoices { tr.listofchoices {
@ -227,7 +255,7 @@ font.error {
/* Next button */ /* Next button */
div.nextbutton { div.nextbutton {
text-align: right; text-align: center;
margin-top: 10px; margin-top: 10px;
padding-top: 5px; padding-top: 5px;
padding-bottom: 5px; padding-bottom: 5px;
@ -257,7 +285,6 @@ a.titre {
div.comment { div.comment {
text-decoration:none; text-decoration:none;
color:black; color:black;
font-size: 13px;
} }
h3 { h3 {
@ -293,9 +320,6 @@ td.comment {
font-size: 12px; font-size: 12px;
border-bottom: 1px solid #CCCCDB; border-bottom: 1px solid #CCCCDB;
} }
table {
font-size: 13px;
}
.install .install
{ {
@ -319,8 +343,8 @@ ul {
.button { .button {
background: #FFFFFF bottom; background: #eee;
border: 1px solid #C0C0C0; /*border: 1px solid #C0C0C0;*/
padding: 0.3em 0.7em; padding: 0.3em 0.7em;
margin: 0 0.5em; margin: 0 0.5em;
-moz-border-radius:0 5px 0 5px; -moz-border-radius:0 5px 0 5px;

View File

@ -72,7 +72,7 @@ if (@file_exists($forcedfile)) {
session_start(); // To be able to keep info into session (used for not loosing pass during navigation. pass must not transit throug parmaeters) session_start(); // To be able to keep info into session (used for not loosing pass during navigation. pass must not transit throug parmaeters)
pHeader($langs->trans("ConfigurationFile"),"step1","set","",(empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/')); pHeader($langs->trans("ConfigurationFile"), "step1", "set", "", (empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/'), 'main-inside-bis');
// Test if we can run a first install process // Test if we can run a first install process
if (! is_writable($conffile)) if (! is_writable($conffile))

View File

@ -359,9 +359,10 @@ function conf($dolibarr_main_document_root)
* @param string $action Action code ('set' or 'upgrade') * @param string $action Action code ('set' or 'upgrade')
* @param string $param Param * @param string $param Param
* @param string $forcejqueryurl Set jquery relative URL (must end with / if defined) * @param string $forcejqueryurl Set jquery relative URL (must end with / if defined)
* @param string $csstable Css for table
* @return void * @return void
*/ */
function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='') function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='',$csstable='main-inside')
{ {
global $conf; global $conf;
global $langs; global $langs;
@ -406,10 +407,10 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='')
print '<body>'."\n"; print '<body>'."\n";
print '<div style="text-align:center">'; print '<div class="divlogoinstall" style="text-align:center">';
print '<img src="../theme/dolibarr_logo.png" alt="Dolibarr logo"><br>'; print '<img class="imglogoinstall" src="../theme/dolibarr_logo.png" alt="Dolibarr logo"><br>';
print DOL_VERSION; print DOL_VERSION;
print '</div><br><br>'; print '</div><br>';
print '<span class="titre">'.$langs->trans("DolibarrSetup"); print '<span class="titre">'.$langs->trans("DolibarrSetup");
if ($subtitle) { if ($subtitle) {
@ -423,7 +424,7 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='')
print '<table class="main" width="100%"><tr><td>'."\n"; print '<table class="main" width="100%"><tr><td>'."\n";
print '<table class="main-inside" width="100%"><tr><td>'."\n"; print '<table class="'.$csstable.'" width="100%"><tr><td>'."\n";
} }
/** /**

View File

@ -43,6 +43,6 @@ insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 7, 'TE_RE
insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 8, 'TE_PRIVATE', 'Particulier', NULL, 1); insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 8, 'TE_PRIVATE', 'Particulier', NULL, 1);
insert into llx_c_typent (id,code,libelle,fk_country,active) values (100, 'TE_OTHER', 'Autres', NULL, 1); insert into llx_c_typent (id,code,libelle,fk_country,active) values (100, 'TE_OTHER', 'Autres', NULL, 1);
-- Argentina (country 23) -- Argentina (country 23)
insert into llx_c_typent (id,code,libelle,fk_country,active) values (231, 'TE_A_RI', 'Responsable Inscripto', 23, 0); insert into llx_c_typent (id,code,libelle,fk_country,active) values (231, 'TE_A_RI', 'Responsable Inscripto (typo A)', 23, 0);
insert into llx_c_typent (id,code,libelle,fk_country,active) values (232, 'TE_B_RNI', 'Responsable No Inscripto', 23, 0); insert into llx_c_typent (id,code,libelle,fk_country,active) values (232, 'TE_B_RNI', 'Responsable No Inscripto (typo B)', 23, 0);
insert into llx_c_typent (id,code,libelle,fk_country,active) values (233, 'TE_C_FE', 'Consumidor Final/Exento', 23, 0); insert into llx_c_typent (id,code,libelle,fk_country,active) values (233, 'TE_C_FE', 'Consumidor Final/Exento (typo C)', 23, 0);

View File

@ -230,6 +230,7 @@ ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user
ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve);
ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve);
DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm);
-- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate. -- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate.
drop table tmp_links_double; drop table tmp_links_double;

View File

@ -143,6 +143,10 @@ delete from llx_element_element where sourcetype='facture' and fk_source not in
delete from llx_element_element where sourcetype='commande' and fk_source not in (select rowid from llx_commande); delete from llx_element_element where sourcetype='commande' and fk_source not in (select rowid from llx_commande);
-- Fix: delete orphelin actioncomm_resources
DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm);
UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; UPDATE llx_product SET canvas = NULL where canvas = 'default@product';
UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; UPDATE llx_product SET canvas = NULL where canvas = 'service@product';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
@ -129,7 +129,6 @@ if (@file_exists($forcedfile)) {
} }
} }
dolibarr_install_syslog("--- step1: entering step1.php page");
$error = 0; $error = 0;
@ -138,6 +137,7 @@ $error = 0;
* View * View
*/ */
dolibarr_install_syslog("--- step1: entering step1.php page");
pHeader($langs->trans("ConfigurationFile"),"step2"); pHeader($langs->trans("ConfigurationFile"),"step2");
@ -541,9 +541,20 @@ if (! $error && $db->connected && $action == "set")
{ {
if ($db->connected) if ($db->connected)
{ {
$result=$db->DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name); $resultbis = 1;
if ($result > 0) // Create user
$result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
// Create user bis
if ($databasefortest == 'mysql')
{
if (! in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local')))
{
$resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
}
}
if ($result > 0 && $resultbis > 0)
{ {
print '<tr><td>'; print '<tr><td>';

View File

@ -411,6 +411,7 @@ ModuleCompanyCodePanicum=Return an empty accountancy code.
ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code. ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code.
Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).<br>Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required. Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).<br>Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required.
UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than... UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than...
WarningPHPMail=WARNING: Some email providers (like Yahoo) does not allow you to send an email from another server than the Yahoo server if the email address used as a sender is your Yahoo email (like myemail@yahoo.com, myemail@yahoo.fr, ...). Your current setup use the server of the application to send email, so some recipients (the one compatible with the restrictive DMARC protocol), will ask Yahoo if they can accept your email and Yahoo will respond "no" because the server is not a server owned by Yahoo, so few of your sent Emails may not be accepted.<br>If your Email provider (like Yahoo) has this restriction, you must change Email setup to choose the other method "SMTP server" and enter the SMTP server and credentials provided by your Email provider (ask your EMail provider to get SMTP credentials for your account).
# Modules # Modules
Module0Name=Users & groups Module0Name=Users & groups

View File

@ -239,6 +239,10 @@ ProfId3RU=Prof Id 3 (KPP)
ProfId4RU=Prof Id 4 (OKPO) ProfId4RU=Prof Id 4 (OKPO)
ProfId5RU=- ProfId5RU=-
ProfId6RU=- ProfId6RU=-
ProfId1DZ=RC
ProfId2DZ=Art.
ProfId3DZ=NIF
ProfId4DZ=NIS
VATIntra=VAT number VATIntra=VAT number
VATIntraShort=VAT number VATIntraShort=VAT number
VATIntraSyntaxIsValid=Syntax is valid VATIntraSyntaxIsValid=Syntax is valid

View File

@ -27,7 +27,7 @@ DeleteAMailing=Delete an emailing
PreviewMailing=Preview emailing PreviewMailing=Preview emailing
CreateMailing=Create emailing CreateMailing=Create emailing
TestMailing=Test email TestMailing=Test email
ValidMailing=Valid emailing ValidMailing=Validate emailing
MailingStatusDraft=Draft MailingStatusDraft=Draft
MailingStatusValidated=Validated MailingStatusValidated=Validated
MailingStatusSent=Sent MailingStatusSent=Sent

View File

@ -239,6 +239,11 @@ ProfId3RU=Id. prof.3 (KPP)
ProfId4RU=Id. prof.4 (OKPO) ProfId4RU=Id. prof.4 (OKPO)
ProfId5RU=- ProfId5RU=-
ProfId6RU=- ProfId6RU=-
ProfId1DZ=RC
ProfId2DZ=Art.
ProfId3DZ=NIF
ProfId4DZ=NIS
VATIntra=Numéro de TVA VATIntra=Numéro de TVA
VATIntraShort=Num. TVA VATIntraShort=Num. TVA
VATIntraSyntaxIsValid=Syntaxe valide VATIntraSyntaxIsValid=Syntaxe valide

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> /* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -86,8 +86,9 @@ if ($action == 'add' && $user->rights->loan->write)
{ {
if (! $cancel) if (! $cancel)
{ {
$datestart=@dol_mktime(12,0,0, $_POST["startmonth"], $_POST["startday"], $_POST["startyear"]); $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
$dateend=@dol_mktime(12,0,0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
$capital = price2num(GETPOST('capital'));
if (! $datestart) if (! $datestart)
{ {
@ -99,20 +100,20 @@ if ($action == 'add' && $user->rights->loan->write)
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
$action = 'create'; $action = 'create';
} }
elseif (! $_POST["capital"]) elseif (! $capital)
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
$action = 'create'; $action = 'create';
} }
else else
{ {
$object->label = $_POST["label"]; $object->label = GETPOST('label');
$object->fk_bank = $_POST["accountid"]; $object->fk_bank = GETPOST('accountid');
$object->capital = $_POST["capital"]; $object->capital = $capital;
$object->datestart = $datestart; $object->datestart = $datestart;
$object->dateend = $dateend; $object->dateend = $dateend;
$object->nbterm = $_POST["nbterm"]; $object->nbterm = GETPOST('nbterm');
$object->rate = $_POST["rate"]; $object->rate = GETPOST('rate');
$object->note_private = GETPOST('note_private'); $object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public'); $object->note_public = GETPOST('note_public');
@ -147,9 +148,9 @@ else if ($action == 'update' && $user->rights->loan->write)
if ($object->fetch($id)) if ($object->fetch($id))
{ {
$object->label = GETPOST("label");
$object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int')); $object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
$object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int')); $object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
$object->capital = price2num(GETPOST("capital"));
$object->nbterm = GETPOST("nbterm"); $object->nbterm = GETPOST("nbterm");
$object->rate = GETPOST("rate"); $object->rate = GETPOST("rate");
} }
@ -173,6 +174,14 @@ else if ($action == 'update' && $user->rights->loan->write)
} }
} }
if ($action == 'setlabel' && $user->rights->loan->write)
{
$object->fetch($id);
$result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY');
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
/* /*
* View * View
*/ */
@ -180,8 +189,9 @@ else if ($action == 'update' && $user->rights->loan->write)
$form = new Form($db); $form = new Form($db);
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
$help_url='EN:Module_Loan|FR:Module_Emprunt'; $title = $langs->trans("Loan") . ' - ' . $langs->trans("Card");
llxHeader("",$langs->trans("Loan"),$help_url); $help_url = 'EN:Module_Loan|FR:Module_Emprunt';
llxHeader("",$title,$help_url);
// Create mode // Create mode
@ -203,7 +213,7 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Label // Label
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" size="40" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>'; print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Label").'</td><td><input name="label" size="40" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>';
// Bank account // Bank account
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
@ -243,7 +253,7 @@ if ($action == 'create')
// Note Private // Note Private
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top">';
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%'); $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -253,16 +263,11 @@ if ($action == 'create')
// Note Public // Note Public
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top">';
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%'); $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td></tr>'; print '</td></tr>';
print '</table>';
print '<br>';
print '<table class="border" width="100%">';
// Accountancy // Accountancy
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
@ -283,7 +288,7 @@ if ($action == 'create')
print '<td>'; print '<td>';
print $formaccountancy->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1); print $formaccountancy->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1);
print '</td></tr>'; print '</td></tr>';
} }
else // For external software else // For external software
{ {
// Accountancy_account_capital // Accountancy_account_capital
@ -300,15 +305,16 @@ if ($action == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInterestCode").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInterestCode").'</td>';
print '<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.'">'; print '<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.'">';
print '</td></tr>'; print '</td></tr>';
print '</table>';
} }
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
print '<div align="center"><input class="button" type="submit" value="'.$langs->trans("Save").'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '<div class="center">';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>';
print '</form>'; print '</form>';
} }
@ -316,12 +322,15 @@ if ($action == 'create')
// View // View
if ($id > 0) if ($id > 0)
{ {
$object = new Loan($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0) if ($result > 0)
{ {
$head=loan_prepare_head($object); $head=loan_prepare_head($object);
$totalpaid = $object->getSumPayment();
// Confirm for loan // Confirm for loan
if ($action == 'paid') if ($action == 'paid')
{ {
@ -345,27 +354,54 @@ if ($id > 0)
dol_fiche_head($head, 'card', $langs->trans("Loan"), 0, 'bill'); dol_fiche_head($head, 'card', $langs->trans("Loan"), 0, 'bill');
$morehtmlref='<div class="refidno">';
// Ref loan
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
$morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
/*
// Ref // Ref
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object,'id'); print $form->showrefnav($object,'id');
print "</td></tr>"; print "</td></tr>";
// Label // Label
if ($action == 'edit') if ($action == 'edit')
{ {
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'; print '<tr><td>'.$langs->trans("Label").'</td><td>';
print '<input type="text" name="label" size="40" value="'.$object->label.'">'; print '<input type="text" name="label" size="40" value="'.$object->label.'">';
print '</td></tr>'; print '</td></tr>';
} }
else else
{ {
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->label.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
} }
*/
// Capital // Capital
print '<tr><td>'.$langs->trans("LoanCapital").'</td><td>'.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>'; if ($action == 'edit')
{
print '<tr><td class="titlefield">'.$langs->trans("LoanCapital").'</td><td>';
print '<input name="capital" size="10" value="' . $object->capital . '"></td></tr>';
print '</td></tr>';
}
else
{
print '<tr><td class="titlefield">'.$langs->trans("LoanCapital").'</td><td>'.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
}
// Date start // Date start
print "<tr><td>".$langs->trans("DateStart")."</td>"; print "<tr><td>".$langs->trans("DateStart")."</td>";
@ -433,25 +469,13 @@ if ($id > 0)
print '</td></tr>'; print '</td></tr>';
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>'; // print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end(); print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
if ($action == 'edit')
{
print '<div align="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form><br><br>';
}
print '<table class="border" width="100%">';
print '<tr><td>';
/* /*
* Payments * Payments
@ -477,14 +501,14 @@ if ($id > 0)
$total_insurance = 0; $total_insurance = 0;
$total_interest = 0; $total_interest = 0;
$total_capital = 0; $total_capital = 0;
echo '<table class="nobordernopadding" width="100%">'; print '<table class="noborder paymenttable">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("RefPayment").'</td>'; print '<td>'.$langs->trans("RefPayment").'</td>';
print '<td>'.$langs->trans("Date").'</td>'; print '<td>'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("Type").'</td>'; print '<td>'.$langs->trans("Type").'</td>';
print '<td align="center">'.$langs->trans("Insurance").'</td>'; print '<td align="right">'.$langs->trans("Insurance").'</td>';
print '<td align="center">'.$langs->trans("Interest").'</td>'; print '<td align="right">'.$langs->trans("Interest").'</td>';
print '<td align="center">'.$langs->trans("LoanCapital").'</td>'; print '<td align="right">'.$langs->trans("LoanCapital").'</td>';
print '</tr>'; print '</tr>';
$var=True; $var=True;
@ -508,13 +532,13 @@ if ($id > 0)
if ($object->paid == 0) if ($object->paid == 0)
{ {
print '<tr><td colspan="5" align="right">'.$langs->trans("AlreadyPaid").' :</td><td align="right"><b>'.price($totalpaid, 0, $langs, 0, 0, -1, $conf->currency).'</b></td></tr>'; print '<tr><td colspan="5" align="right">'.$langs->trans("AlreadyPaid").' :</td><td align="right">'.price($totalpaid, 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>';
print '<tr><td colspan="5" align="right">'.$langs->trans("AmountExpected").' :</td><td align="right" bgcolor="#d0d0d0">'.price($object->capital, 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>'; print '<tr><td colspan="5" align="right">'.$langs->trans("AmountExpected").' :</td><td align="right">'.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
$staytopay = $object->capital - $totalpaid; $staytopay = $object->capital - $totalpaid;
print '<tr><td colspan="5" align="right">'.$langs->trans("RemainderToPay").' :</td>'; print '<tr><td colspan="5" align="right">'.$langs->trans("RemainderToPay").' :</td>';
print '<td align="right" bgcolor="#f0f0f0"><b>'.price($staytopay, 0, $langs, 0, 0, -1, $conf->currency).'</b></td></tr>'; print '<td align="right"><b>'.price($staytopay, 0, $langs, 0, 0, -1, $conf->currency).'</b></td></tr>';
} }
print "</table>"; print "</table>";
$db->free($resql); $db->free($resql);
@ -523,8 +547,25 @@ if ($id > 0)
{ {
dol_print_error($db); dol_print_error($db);
} }
print "</td></tr>";
print "</table>"; print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
if ($action == 'edit')
{
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
}
if ($action == 'edit') print "</form>\n";
/* /*
* Buttons actions * Buttons actions
@ -562,7 +603,7 @@ if ($id > 0)
} }
else else
{ {
// Loan not find // Loan not found
dol_print_error('',$object->error); dol_print_error('',$object->error);
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> /* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -32,6 +32,7 @@ class Loan extends CommonObject
public $element='loan'; public $element='loan';
public $table='loan'; public $table='loan';
public $table_element='loan'; public $table_element='loan';
public $picto = 'bill';
public $rowid; public $rowid;
public $datestart; public $datestart;
@ -278,6 +279,7 @@ class Loan extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."loan"; $sql = "UPDATE ".MAIN_DB_PREFIX."loan";
$sql.= " SET label='".$this->db->escape($this->label)."',"; $sql.= " SET label='".$this->db->escape($this->label)."',";
$sql.= " capital='".price2num($this->db->escape($this->capital))."',";
$sql.= " datestart='".$this->db->idate($this->datestart)."',"; $sql.= " datestart='".$this->db->idate($this->datestart)."',";
$sql.= " dateend='".$this->db->idate($this->dateend)."',"; $sql.= " dateend='".$this->db->idate($this->dateend)."',";
$sql.= " fk_user_modif = ".$user->id; $sql.= " fk_user_modif = ".$user->id;
@ -378,6 +380,12 @@ class Loan extends CommonObject
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
} }
if ($mode == 6)
{
if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}
return "Error, mode/status not found"; return "Error, mode/status not found";
} }

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> /* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@zendsi.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -75,17 +75,33 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
$form = new Form($db); $form = new Form($db);
$help_url='EN:Module_Loan|FR:Module_Emprunt'; $title = $langs->trans("Loan") . ' - ' . $langs->trans("Documents");
llxHeader("",$langs->trans("Loan"),$help_url); $help_url = 'EN:Module_Loan|FR:Module_Emprunt';
llxHeader("",$title,$help_url);
if ($object->id) if ($object->id)
{ {
$alreadypayed=$object->getSumPayment(); $totalpaid=$object->getSumPayment();
$head = loan_prepare_head($object); $head = loan_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans("Loan"), 0, 'bill'); dol_fiche_head($head, 'documents', $langs->trans("Loan"), 0, 'bill');
$morehtmlref='<div class="refidno">';
// Ref loan
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
$morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
// Construit liste des fichiers // Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
@ -97,63 +113,13 @@ if ($object->id)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td>'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print "</table>\n";
// Ref print "</div>\n";
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object,'id');
print "</td></tr>";
// Label dol_fiche_end();
if ($action == 'edit')
{
print '<tr><td>'.$langs->trans("Label").'</td><td>';
print '<input type="text" name="label" size="40" value="'.$object->label.'">';
print '</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
}
// Amount
print '<tr><td>'.$langs->trans("LoanCapital").'</td><td>'.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
// Date start
print "<tr><td>".$langs->trans("DateStart")."</td>";
print "<td>";
if ($action == 'edit')
{
print $form->select_date($object->datestart, 'start', 0, 0, 0, 'loan', 1, 0, 1);
}
else
{
print dol_print_date($object->datestart,"day");
}
print "</td>";
print "</tr>";
// Date end
print "<tr><td>".$langs->trans("DateEnd")."</td>";
print "<td>";
if ($action == 'edit')
{
print $form->select_date($object->dateend, 'end', 0, 0, 0, 'loan', 1, 0, 1);
}
else
{
print dol_print_date($object->dateend,"day");
}
print "</td>";
print "</tr>";
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4,$alreadypayed).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
$modulepart = 'loan'; $modulepart = 'loan';
$permission = $user->rights->loan->write; $permission = $user->rights->loan->write;

View File

@ -43,29 +43,38 @@ $result = restrictedArea($user, 'loan', $id, '','');
* View * View
*/ */
$help_url='EN:Module_Loan|FR:Module_Emprunt'; $title = $langs->trans("Loan") . ' - ' . $langs->trans("Info");
llxHeader("",$langs->trans("Loan"),$help_url); $help_url = 'EN:Module_Loan|FR:Module_Emprunt';
llxHeader("",$title,$help_url);
if ($id > 0) { $object = new Loan($db);
$loan = new Loan($db); $object->fetch($id);
$loan->fetch($id); $object->info($id);
$loan->info($id);
$head = loan_prepare_head($loan); $head = loan_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Loan"), 0, 'bill'); dol_fiche_head($head, 'info', $langs->trans("Loan"), 0, 'bill');
print '<table width="100%"><tr><td>'; $morehtmlref='<div class="refidno">';
dol_print_object_info($loan); // Ref loan
print '</td></tr></table>'; $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
$morehtmlref.='</div>';
print '</div>'; $linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
}
else $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
{
// $id ? dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
}
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,8 +22,8 @@
/** /**
* \file htdocs/loan/note.php * \file htdocs/loan/note.php
* \brief Tab for notes on loan
* \ingroup loan * \ingroup loan
* \brief Tab for notes on loan
*/ */
require '../main.inc.php'; require '../main.inc.php';
@ -56,43 +57,40 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
$form = new Form($db); $form = new Form($db);
llxHeader('',$langs->trans("Loan"),''); $title = $langs->trans("Loan") . ' - ' . $langs->trans("Notes");
$help_url = 'EN:Module_Loan|FR:Module_Emprunt';
llxHeader("",$title,$help_url);
if ($id > 0) if ($id > 0)
{ {
/* /*
* Affichage onglets * Affichage onglets
*/ */
$totalpaid=$object->getSumPayment();
$head = loan_prepare_head($object); $head = loan_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("Loan"), 0, 'bill'); dol_fiche_head($head, 'note', $langs->trans("Loan"), 0, 'bill');
$morehtmlref='<div class="refidno">';
// Ref loan
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
$morehtmlref.='</div>';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; $linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">'; $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
// Ref dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $form->showrefnav($object,'id','',1,'rowid','ref');
print '</td></tr>';
// Name
print '<tr><td>'.$langs->trans("Name").'</td>';
print '<td colspan="3">'.$object->label.'</td></tr>';
print "</table>"; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
//$colwidth='25';
$cssclass='titlefield'; $cssclass='titlefield';
$permission = $user->rights->loan->write; // Used by the include of notes.tpl.php $permission = $user->rights->loan->write; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
dol_fiche_end(); dol_fiche_end();
} }

View File

@ -275,7 +275,7 @@ class ProductApi extends DolibarrApi
} }
$result = $this->product->create(DolibarrApiAccess::$user); $result = $this->product->create(DolibarrApiAccess::$user);
if($result < 0) { if($result < 0) {
throw new RestException(503,'Error when creating product : '.$this->product->error); throw new RestException(500,'Error when creating product : '.$this->product->error);
} }
return $this->product->id; return $this->product->id;

View File

@ -182,9 +182,8 @@ class Products extends DolibarrApi
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
$this->product->$field = $value; $this->product->$field = $value;
} }
$result = $this->product->create(DolibarrApiAccess::$user); if ($this->product->create(DolibarrApiAccess::$user) < 0) {
if($result < 0) { throw new RestException(500, "Error creating product", array_merge(array($this->product->error), $this->product->errors));
throw new RestException(503,'Error when creating product : '.$this->product->error);
} }
return $this->product->id; return $this->product->id;

View File

@ -169,8 +169,8 @@ class Warehouses extends DolibarrApi
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
$this->warehouse->$field = $value; $this->warehouse->$field = $value;
} }
if($this->warehouse->create(DolibarrApiAccess::$user) <= 0) { if ($this->warehouse->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(503, 'Error when create warehouse : '.$this->warehouse->error); throw new RestException(500, "Error creating warehouse", array_merge(array($this->warehouse->error), $this->warehouse->errors));
} }
return $this->warehouse->id; return $this->warehouse->id;
} }

View File

@ -196,9 +196,8 @@ class Projects extends DolibarrApi
} }
$this->project->lines = $lines; $this->project->lines = $lines;
}*/ }*/
if ($this->project->create(DolibarrApiAccess::$user) <= 0) { if ($this->project->create(DolibarrApiAccess::$user) < 0) {
$errormsg = $this->project->error; throw new RestException(500, "Error creating project", array_merge(array($this->project->error), $this->project->errors));
throw new RestException(500, $errormsg ? $errormsg : "Error while creating project");
} }
return $this->project->id; return $this->project->id;

View File

@ -203,9 +203,8 @@ class Tasks extends DolibarrApi
} }
$this->project->lines = $lines; $this->project->lines = $lines;
}*/ }*/
if ($this->task->create(DolibarrApiAccess::$user) <= 0) { if ($this->task->create(DolibarrApiAccess::$user) < 0) {
$errormsg = $this->task->error; throw new RestException(500, "Error creating task", array_merge(array($this->task->error), $this->task->errors));
throw new RestException(500, $errormsg ? $errormsg : "Error while creating task");
} }
return $this->task->id; return $this->task->id;

View File

@ -51,13 +51,13 @@ $hookmanager->initHooks(array('element_resource'));
$object->available_resources = array('dolresource'); $object->available_resources = array('dolresource');
// Get parameters // Get parameters
$id = GETPOST('id','int'); $id = GETPOST('id','int'); // resource id
$ref = GETPOST('ref','alpha'); $element_id = GETPOST('element_id','int'); // element_id
$element_ref = GETPOST('ref','alpha'); // element ref
$element = GETPOST('element','alpha'); // element_type
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$mode = GETPOST('mode','alpha'); $mode = GETPOST('mode','alpha');
$lineid = GETPOST('lineid','int'); $lineid = GETPOST('lineid','int');
$element = GETPOST('element','alpha'); // element_type
$element_id = GETPOST('element_id','int');
$resource_id = GETPOST('fk_resource','int'); $resource_id = GETPOST('fk_resource','int');
$resource_type = GETPOST('resource_type','alpha'); $resource_type = GETPOST('resource_type','alpha');
$busy = GETPOST('busy','int'); $busy = GETPOST('busy','int');
@ -66,7 +66,7 @@ $cancel = GETPOST('cancel','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
if ($socid > 0) if ($socid > 0) // Special for thirdparty
{ {
$element_id = $socid; $element_id = $socid;
$element = 'societe'; $element = 'societe';
@ -183,11 +183,11 @@ else
// Specific to agenda module // Specific to agenda module
if ($element_id && $element == 'action') if (($element_id || $element_ref) && $element == 'action')
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
$act = fetchObjectByElement($element_id,$element); $act = fetchObjectByElement($element_id,$element, $element_ref);
if (is_object($act)) if (is_object($act))
{ {
@ -212,16 +212,10 @@ else
$linkback.=$out; $linkback.=$out;
dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '', "&element=".$element); dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '', '&element='.$element, 0, '', '');
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
// Ref
/*print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
print '</td></tr>';*/
// Affichage fiche action en mode visu
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Type // Type
@ -248,11 +242,6 @@ else
if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
print '</td></tr>'; print '</td></tr>';
// Status
/*print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="2">';
print $act->getLibStatut(4);
print '</td></tr>';*/
// Location // Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) if (empty($conf->global->AGENDA_DISABLE_LOCATION))
{ {
@ -301,9 +290,9 @@ else
} }
// Specific to thirdparty module // Specific to thirdparty module
if ($element_id && $element == 'societe') if (($element_id || $element_ref) && $element == 'societe')
{ {
$socstatic = fetchObjectByElement($element_id, $element); $socstatic = fetchObjectByElement($element_id, $element, $element_ref);
if (is_object($socstatic)) { if (is_object($socstatic)) {
$savobject = $object; $savobject = $object;
@ -314,7 +303,7 @@ else
dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), 0, 'company'); dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), 0, 'company');
dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '&element='.$element);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
@ -337,12 +326,12 @@ else
} }
// Specific to fichinter module // Specific to fichinter module
if ($element_id && $element == 'fichinter') if (($element_id || $element_ref) && $element == 'fichinter')
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($element_id); $fichinter->fetch($element_id, $element_ref);
$fichinter->fetch_thirdparty(); $fichinter->fetch_thirdparty();
if (is_object($fichinter)) if (is_object($fichinter))
@ -395,7 +384,7 @@ else
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
dol_banner_tab($fichinter, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($fichinter, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '&element='.$element, 0, '', '', 1);
dol_fiche_end(); dol_fiche_end();
} }
@ -403,7 +392,7 @@ else
// hook for other elements linked // hook for other elements linked
$parameters=array('element'=>$element, 'element_id'=>$element_id ); $parameters=array('element'=>$element, 'element_id'=>$element_id, 'element_ref'=>$element_ref);
$reshook=$hookmanager->executeHooks('printElementTab',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('printElementTab',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@ -192,7 +192,10 @@ class Contacts extends DolibarrApi
{ {
$this->contact->$field = $value; $this->contact->$field = $value;
} }
return $this->contact->create(DolibarrApiAccess::$user); if ($this->contact->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating contact", array_merge(array($this->contact->error), $this->contact->errors));
}
return $this->contact->id;
} }
/** /**

View File

@ -192,7 +192,10 @@ class Thirdparties extends DolibarrApi
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
$this->company->$field = $value; $this->company->$field = $value;
} }
return $this->company->create(DolibarrApiAccess::$user); if ($this->company->create(DolibarrApiAccess::$user) < 0)
throw new RestException(500, 'Error creating thirdparty', array_merge(array($this->company->error), $this->company->errors));
return $this->company->id;
} }
/** /**

View File

@ -496,9 +496,9 @@ class Societe extends CommonObject
} }
else else
{ {
dol_syslog(get_class($this)."::Create echec update ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::Create echec update ".$this->error." ".join(',',$this->errors), LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -4;
} }
} }
else else
@ -520,7 +520,7 @@ class Societe extends CommonObject
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
dol_syslog(get_class($this)."::Create fails verify ".join(',',$this->errors), LOG_WARNING); dol_syslog(get_class($this)."::Create fails verify ".join(',',$this->errors), LOG_WARNING);
return -3; return -3;

View File

@ -1408,17 +1408,6 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref
/*
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td><td colspan="5">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
// Company
print '<tr><td>' . $langs->trans('Supplier') . '</td><td colspan="5">' . $soc->getNomUrl(1) . '</td>';
print '</tr>';
*/
// Payment term // Payment term
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';

View File

@ -93,26 +93,70 @@ if ($object->id > 0)
$totalsize+=$file['size']; $totalsize+=$file['size'];
} }
// Supplier proposal card
$linkback = '<a href="' . DOL_URL_ROOT . '/supplier_proposal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
// Ref supplier
//$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
//$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->supplier_proposal->creer)
{
if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border"width="100%">'; print '<table class="border"width="100%">';
$linkback='<a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td>'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
// Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
print '</td></tr>';
// Supplier
print "<tr><td>".$langs->trans("Supplier")."</td>";
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
dol_fiche_end();
$modulepart = 'supplier_proposal'; $modulepart = 'supplier_proposal';
$permission = $user->rights->supplier_proposal->creer; $permission = $user->rights->supplier_proposal->creer;
$permtoedit = $user->rights->supplier_proposal->creer; $permtoedit = $user->rights->supplier_proposal->creer;

View File

@ -49,10 +49,65 @@ $object = new SupplierProposal($db);
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$object->info($object->id);
$head = supplier_proposal_prepare_head($object); $head = supplier_proposal_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans('CommRequest'), 0, 'supplier_proposal'); dol_fiche_head($head, 'info', $langs->trans('CommRequest'), 0, 'supplier_proposal');
$object->info($object->id); // Supplier proposal card
$linkback = '<a href="' . DOL_URL_ROOT . '/supplier_proposal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
// Ref supplier
//$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
//$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->supplier_proposal->creer)
{
if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($object); dol_print_object_info($object);
@ -60,6 +115,7 @@ print '</td></tr></table>';
print '</div>'; print '</div>';
dol_fiche_end();
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -45,19 +45,18 @@ $object = new SupplierProposal($db);
/******************************************************************************/ /*
/* Actions */ * Actions
/******************************************************************************/ */
$permissionnote=$user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php $permissionnote=$user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
/*
/******************************************************************************/ * View
/* Affichage fiche */ */
/******************************************************************************/
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur'); llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
@ -71,47 +70,71 @@ if ($id > 0 || ! empty($ref))
if ($object->fetch($id, $ref)) if ($object->fetch($id, $ref))
{ {
$object->fetch_thirdparty();
$societe = new Societe($db); $societe = new Societe($db);
if ( $societe->fetch($object->socid) ) if ( $societe->fetch($object->socid) )
{ {
$head = supplier_proposal_prepare_head($object); $head = supplier_proposal_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans('CommRequest'), 0, 'supplier_proposal'); dol_fiche_head($head, 'note', $langs->trans('CommRequest'), 0, 'supplier_proposal');
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans('BackToList').'</a>'; // Supplier proposal card
$linkback = '<a href="' . DOL_URL_ROOT . '/supplier_proposal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
print '</td></tr>';
// Customer
if ( is_null($object->thirdparty) )
$object->fetch_thirdparty();
print "<tr><td>".$langs->trans("Supplier")."</td>";
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
// Payment term $morehtmlref='<div class="refidno">';
print '<tr><td>'; // Ref supplier
print '<table class="nobordernopadding" width="100%"><tr><td>'; //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
print $langs->trans('PaymentConditionsShort'); //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
print '</td>'; // Thirdparty
print '</tr></table>'; $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
print '</td><td colspan="3">'; // Project
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none', 1); if (! empty($conf->projet->enabled))
print '</td>'; {
print '</tr>'; $langs->load("projects");
print '<tr><td>'.$langs->trans('SupplierProposalDate').'</td><td colspan="3">'; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
print dol_print_date($object->date_livraison,'daytext'); if ($user->rights->supplier_proposal->creer)
print '</td>'; {
print '</tr>'; if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
print "</table>";
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<br>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print '</div>';
dol_fiche_end(); dol_fiche_end();
} }

View File

@ -254,6 +254,7 @@ a.tab { font-weight: bold !important; }
a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; } a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; }
a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); } a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); }
a.commonlink { color: rgb(<?php print $colortextlink; ?>) !important; text-decoration: none; }
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {
background-color: #FFF; background-color: #FFF;
@ -967,12 +968,13 @@ div.attacharea {
} }
div.arearef { div.arearef {
/*border-bottom: 1px solid #bbb;*/
padding-top: 2px; padding-top: 2px;
padding-bottom: 5px;
/*padding-right: 3px;
padding-left: 2px;*/
margin-bottom: 10px; margin-bottom: 10px;
padding-bottom: 7px;
}
div.arearefnobottom {
padding-top: 2px;
padding-bottom: 4px;
} }
div.heightref { div.heightref {
min-height: 80px; min-height: 80px;
@ -1961,15 +1963,8 @@ div.tabBar {
color: #<?php echo $colortextbacktab; ?>; color: #<?php echo $colortextbacktab; ?>;
padding-top: 16px; padding-top: 16px;
padding-left: 0px; padding-right: 0px; padding-left: 0px; padding-right: 0px;
/*padding-left: 18px;
padding-right: 18px;*/
padding-bottom: 14px; padding-bottom: 14px;
margin: 0px 0px 14px 0px; margin: 0px 0px 14px 0px;
/*-moz-border-radius:4px;
-webkit-border-radius: 4px;
border-radius: 4px;
border-right: 1px solid #AAA;
border-left: 1px solid #AAA; */
border-top: 1px solid #BBB; border-top: 1px solid #BBB;
border-bottom: 1px solid #AAA; border-bottom: 1px solid #AAA;
width: auto; width: auto;
@ -2456,11 +2451,16 @@ table.liste tr, table.noborder tr, div.noborder form {
table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td { table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td {
padding: 8px 2px 8px 3px; /* t r b l */ padding: 8px 2px 8px 3px; /* t r b l */
} }
tr.box_titre .nobordernopadding td { padding: 0px ! important; } table.liste td, table.noborder td, div.noborder form div {
table.liste td, table.noborder td, div.noborder form, div.noborder form div { padding: 8px 2px 8px 3px; /* t r b l */
padding: 5px 2px 5px 3px; /* t r b l */ }
div.liste_titre_bydiv .divsearchfield {
padding: 2px 1px 2px 0px; /* t r b l */
} }
tr.box_titre .nobordernopadding td {
padding: 0px ! important;
}
table.nobordernopadding { table.nobordernopadding {
border-collapse: collapse !important; border-collapse: collapse !important;
border: 0px; border: 0px;
@ -2725,7 +2725,7 @@ tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair
padding: 5px 2px 5px 3px; padding: 5px 2px 5px 3px;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td { form.tagtr:last-of-type div.tagtd, tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td {
border-bottom: 0px !important; border-bottom: 0px !important;
} }
tr.even td .nobordernopadding tr td, tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td, tr.odd td .nobordernopadding tr td { tr.even td .nobordernopadding tr td, tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td, tr.odd td .nobordernopadding tr td {
@ -2737,26 +2737,18 @@ td.nobottom, td.nobottom {
div.liste_titre .tagtd { div.liste_titre .tagtd {
vertical-align: middle; vertical-align: middle;
} }
div.liste_titre { /*div.liste_titre {
box-shadow: 2px 2px 4px #CCC; box-shadow: 2px 2px 4px #CCC;
} }*/
div.liste_titre { div.liste_titre {
min-height: 26px !important; /* We cant use height because it's a div and it should be higher if content is more. but min-height does not work either for div */ min-height: 26px !important; /* We cant use height because it's a div and it should be higher if content is more. but min-height does not work either for div */
padding-top: 2px; padding-top: 2px;
padding-bottom: 2px; padding-bottom: 2px;
/*border-right-width: 1px; /* border-top-width: 1px;
border-right-color: #BBB;
border-right-style: solid;
border-left-width: 1px;
border-left-color: #BBB;
border-left-style: solid;*/
border-top-width: 1px;
border-top-color: #BBB; border-top-color: #BBB;
border-top-style: solid; border-top-style: solid;*/
} }
div.liste_titre_bydiv { div.liste_titre_bydiv {
border-top-width: <?php echo $borderwith ?>px; border-top-width: <?php echo $borderwith ?>px;
@ -2773,7 +2765,7 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl
{ {
height: 26px !important; height: 26px !important;
} }
div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr
{ {
<?php if ($usegradienttitle) { ?> <?php if ($usegradienttitle) { ?>
background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(<?php echo $colorbacktitle1; ?>,0.4) 100%); background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(<?php echo $colorbacktitle1; ?>,0.4) 100%);
@ -2791,11 +2783,11 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list
border-bottom: 1px solid #FDFFFF; border-bottom: 1px solid #FDFFFF;
text-align: <?php echo $left; ?>; text-align: <?php echo $left; ?>;
} }
tr.liste_titre th, tr.liste_titre td, th.liste_titre, form.liste_titre div, div.liste_titre tr.liste_titre th, tr.liste_titre td, th.liste_titre
{ {
border-bottom: 1px solid #<?php echo ($colorbacktitle1 == '255,255,255'?'BBBBBB':'FDFFFF'); ?>; border-bottom: 1px solid #<?php echo ($colorbacktitle1 == '255,255,255'?'BBBBBB':'FDFFFF'); ?>;
} }
tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div
{ {
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>; font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
@ -2819,7 +2811,7 @@ tr.liste_titre_topborder td {
.liste_titre td a.notasortlink:hover { .liste_titre td a.notasortlink:hover {
background: transparent; background: transparent;
} }
tr.liste_titre td.liste_titre { /* For last line of table headers only */ tr.liste_titre td.liste_titre, form.liste_titre div.tagtd { /* For last line of table headers only */
border-bottom: 1px solid rgb(<?php echo $colortopbordertitle1 ?>); border-bottom: 1px solid rgb(<?php echo $colortopbordertitle1 ?>);
} }

View File

@ -254,6 +254,7 @@ a.tab { font-weight: bold !important; }
a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; } a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; }
a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); } a:hover { text-decoration: underline; color: rgb(<?php print $colortextlink; ?>); }
a.commonlink { color: rgb(<?php print $colortextlink; ?>) !important; text-decoration: none; }
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {
background-color: #FDFDFD; background-color: #FDFDFD;
@ -1016,13 +1017,14 @@ div.attacharea {
padding-bottom: 10px; padding-bottom: 10px;
} }
div.arearef { div.arearef {
/*border-bottom: 1px solid #bbb;*/
padding-top: 2px; padding-top: 2px;
padding-bottom: 5px; padding-bottom: 5px;
/*padding-right: 3px;
padding-left: 2px;*/
margin-bottom: 10px; margin-bottom: 10px;
} }
div.arearefnobottom {
padding-top: 2px;
padding-bottom: 4px;
}
div.heightref { div.heightref {
min-height: 80px; min-height: 80px;
} }
@ -2379,6 +2381,13 @@ table.noborder td, div.noborder form, div.noborder form div {
padding: 4px 2px 4px 3px; /* t r b l */ padding: 4px 2px 4px 3px; /* t r b l */
} }
table.liste td, table.noborder td, div.noborder form div {
padding: 8px 2px 8px 3px; /* t r b l */
}
div.liste_titre_bydiv .divsearchfield {
padding: 2px 1px 2px 0px; /* t r b l */
}
table.nobordernopadding { table.nobordernopadding {
border-collapse: collapse !important; border-collapse: collapse !important;
border: 0px; border: 0px;

View File

@ -174,19 +174,16 @@ class Users extends DolibarrApi
if (!isset($request_data["lastname"])) if (!isset($request_data["lastname"]))
throw new RestException(400, "lastname field missing");*/ throw new RestException(400, "lastname field missing");*/
//assign field values //assign field values
$xxx=var_export($request_data, true);
dol_syslog("xxx=".$xxx);
foreach ($request_data as $field => $value) foreach ($request_data as $field => $value)
{ {
$this->useraccount->$field = $value; $this->useraccount->$field = $value;
} }
$result = $this->useraccount->create(DolibarrApiAccess::$user); if ($this->useraccount->create(DolibarrApiAccess::$user) < 0) {
if ($result <=0) { throw new RestException(500, 'Error creating', array_merge(array($this->useraccount->error), $this->useraccount->errors));
throw new RestException(500, "User not created : ".$this->useraccount->error);
} }
return array('id'=>$result); return $this->useraccount->id;
} }
/** /**

View File

@ -33,7 +33,6 @@
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/** /**
* Class to manage Dolibarr users * Class to manage Dolibarr users
*/ */
@ -43,90 +42,90 @@ class User extends CommonObject
public $table_element='user'; public $table_element='user';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id=0; public $id=0;
var $ldap_sid; public $ldap_sid;
var $search_sid; public $search_sid;
var $employee; public $employee;
var $gender; public $gender;
var $email; public $email;
var $skype; public $skype;
var $job; public $job;
var $signature; public $signature;
var $address; public $address;
var $zip; public $zip;
var $town; public $town;
var $state_id; public $state_id;
var $state_code; public $state_code;
var $state; public $state;
var $office_phone; public $office_phone;
var $office_fax; public $office_fax;
var $user_mobile; public $user_mobile;
var $admin; public $admin;
var $login; public $login;
var $api_key; public $api_key;
var $entity; public $entity;
//! Clear password in memory //! Clear password in memory
var $pass; public $pass;
//! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) //! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
var $pass_indatabase; public $pass_indatabase;
//! Encrypted password in database (always defined) //! Encrypted password in database (always defined)
var $pass_indatabase_crypted; public $pass_indatabase_crypted;
var $datec; public $datec;
var $datem; public $datem;
//! If this is defined, it is an external user //! If this is defined, it is an external user
/** /**
* @deprecated * @deprecated
* @see socid * @see socid
*/ */
var $societe_id; public $societe_id;
/** /**
* @deprecated * @deprecated
* @see contactid * @see contactid
*/ */
var $contact_id; public $contact_id;
var $socid; public $socid;
var $contactid; public $contactid;
var $fk_member; public $fk_member;
var $fk_user; public $fk_user;
var $clicktodial_url; public $clicktodial_url;
var $clicktodial_login; public $clicktodial_login;
var $clicktodial_password; public $clicktodial_password;
var $clicktodial_poste; public $clicktodial_poste;
var $datelastlogin; public $datelastlogin;
var $datepreviouslogin; public $datepreviouslogin;
var $statut; public $statut;
var $photo; public $photo;
var $lang; public $lang;
var $rights; // Array of permissions user->rights->permx public $rights; // Array of permissions user->rights->permx
var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */ public $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */
private $_tab_loaded=array(); // Array of cache of already loaded permissions private $_tab_loaded=array(); // Array of cache of already loaded permissions
var $nb_rights; // Number of rights granted to the user public $nb_rights; // Number of rights granted to the user
var $conf; // To store personal config public $conf; // To store personal config
var $oldcopy; // To contains a clone of this when we need to save old properties of object var $oldcopy; // To contains a clone of this when we need to save old properties of object
var $users; // To store all tree of users hierarchy public $users; // To store all tree of users hierarchy
var $parentof; // To store an array of all parents for all ids. public $parentof; // To store an array of all parents for all ids.
var $accountancy_code; // Accountancy code in prevision of the complete accountancy module public $accountancy_code; // Accountancy code in prevision of the complete accountancy module
var $thm; // Average cost of employee - Used for valuation of time spent public $thm; // Average cost of employee - Used for valuation of time spent
var $tjm; // Average cost of employee public $tjm; // Average cost of employee
var $salary; // Monthly salary - Denormalized value from llx_user_employment public $salary; // Monthly salary - Denormalized value from llx_user_employment
var $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment
var $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment
var $color; // Define background color for user in agenda public $color; // Define background color for user in agenda
var $dateemployment; // Define date of employment by company public $dateemployment; // Define date of employment by company
/** /**
* Constructor de la classe * Constructor de la classe

View File

@ -207,9 +207,9 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; print __METHOD__." Result code for creating user ".var_export($result, true)."\n";
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
$this->assertEquals($result['curl_error_no'],''); $this->assertEquals($result['curl_error_no'],'');
$object=json_decode($result['content'], true); $resid=json_decode($result['content'], true);
$this->assertNotNull($object, "Parsing of json result must no be null"); $this->assertNotNull($resid, "Parsing of json result must no be null");
$this->assertGreaterThan(0, $object['id'], $object['error']['code'].' '.$object['error']['message']); $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']);
// attempt to create duplicated user // attempt to create duplicated user
print __METHOD__." Request POST url=".$url."\n"; print __METHOD__." Request POST url=".$url."\n";