Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into NEW---Shipping-address-to-invoice

This commit is contained in:
Anthony Berton 2022-11-18 10:41:53 +01:00
commit 9d74ce7ed2
28 changed files with 376 additions and 179 deletions

View File

@ -46,7 +46,7 @@ $allow_disable_encryption = true;
*/
if ($action == 'setgeneraterule') {
if (!dolibarr_set_const($db, 'USER_PASSWORD_GENERATED', $_GET["value"], 'chaine', 0, '', $conf->entity)) {
if (!dolibarr_set_const($db, 'USER_PASSWORD_GENERATED', GETPOST("value", "alphanohtml"), 'chaine', 0, '', $conf->entity)) {
dol_print_error($db);
}
}
@ -56,7 +56,11 @@ if ($action == 'activate_encrypt') {
$db->begin();
dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
// On old version a bug created the constant into user entity, so we delete it to be sure, such entry won't exists. We want it in entity 0 or nowhere.
dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
// We set entity=0 (all) because DATABASE_PWD_ENCRYPTED is a setup into conf file, so always shared for everybody
$entityforall = 0;
dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $entityforall);
$sql = "SELECT u.rowid, u.pass, u.pass_crypted";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
@ -377,7 +381,8 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
}
// Cryptage mot de passe
// Crypt passwords in database
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -393,20 +398,20 @@ print '</tr>';
// Disable clear password in database
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>';
print '<td align="center" width="60">';
print '<td class="center" width="60">';
if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
print img_picto($langs->trans("Active"), 'tick');
}
print '</td>';
if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
print '<td align="center" width="100">';
print '<a class="reposition" href="security.php?action=activate_encrypt&token='.newToken().'">'.$langs->trans("Activate").'</a>';
print '<td class="center" width="100">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=activate_encrypt&token='.newToken().'">'.$langs->trans("Activate").'</a>';
print "</td>";
}
// Database conf file encryption
if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
print '<td align="center" width="100">';
print '<td class="center" width="100">';
if ($allow_disable_encryption) {
//On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes
//Do not allow "disable encryption" as passwords cannot be decrypted
@ -419,7 +424,8 @@ if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
print "</td>";
print '</tr>';
// Cryptage du mot de base de la base dans conf.php
// Crypt password into config file conf.php
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("MainDbPasswordFileConfEncrypted").'</td>';
@ -430,7 +436,7 @@ if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_d
print '</td>';
print '<td align="center" width="100">';
print '<td class="center" width="100">';
if (empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
$langs->load("errors");
print img_warning($langs->trans("WarningPassIsEmpty"));
@ -452,18 +458,18 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("DisableForgetPasswordLinkOnLogonPage").'</td>';
print '<td align="center" width="60">';
print '<td class="center" width="60">';
if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
print img_picto($langs->trans("Active"), 'tick');
}
print '</td>';
if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
print '<td align="center" width="100">';
print '<td class="center" width="100">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=activate_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Activate").'</a>';
print "</td>";
}
if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
print '<td align="center" width="100">';
print '<td center="center" width="100">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disable_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Disable").'</a>';
print "</td>";
}

View File

@ -1399,7 +1399,6 @@ class ActionComm extends CommonObject
if (empty($user->rights->agenda->allactions->read)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm AND ar.element_type ='user' AND ar.fk_element = ".((int) $user->id);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql .= " WHERE 1 = 1";
if (empty($load_state_board)) {
$sql .= " AND a.percent >= 0 AND a.percent < 100";

View File

@ -158,7 +158,7 @@ if (empty($reshook)) {
$action = "";
}
// set accountancy code
// Set accountancy code
if ($action == 'setcustomeraccountancycode') {
$result = $object->fetch($id);
$object->code_compta_client = GETPOST("customeraccountancycode");
@ -169,7 +169,7 @@ if (empty($reshook)) {
}
}
// terms of the settlement
// Payment terms of the settlement
if ($action == 'setconditions' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha'));
@ -178,7 +178,7 @@ if (empty($reshook)) {
}
}
// mode de reglement
// Payment mode
if ($action == 'setmode' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
@ -187,7 +187,7 @@ if (empty($reshook)) {
}
}
// transport mode
// Transport mode
if ($action == 'settransportmode' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setTransportMode(GETPOST('transport_mode_id', 'alpha'));
@ -421,7 +421,7 @@ if ($object->id > 0) {
print "</td>";
print '</tr>';
// Mode de reglement par defaut
// Default payment mode
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentMode');
@ -440,7 +440,7 @@ if ($object->id > 0) {
print '</tr>';
if (isModEnabled("banque")) {
// Compte bancaire par défaut
// Default bank account for payments
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentBankAccount');

View File

@ -209,12 +209,12 @@ $checkedtypetiers = 0;
$arrayfields = array(
'p.ref'=>array('label'=>"Ref", 'checked'=>1),
'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>-1),
'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1)),
'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1)),
'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(isModEnabled('project') ? 1 : 0)),
'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(isModEnabled('project') ? 1 : 0)),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1),
's.town'=>array('label'=>"Town", 'checked'=>-1),
's.zip'=>array('label'=>"Zip", 'checked'=>1),
's.zip'=>array('label'=>"Zip", 'checked'=>-1),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
@ -1430,6 +1430,14 @@ if ($resql) {
}
print "</tr>\n";
$totalarray = array(
'nbfield' => 0,
'val' => array(
'p.total_ht' => 0,
'p.total_tva' => 0,
'p.total_ttc' => 0,
),
);
// Fields title
print '<tr class="liste_titre">';
@ -1550,14 +1558,6 @@ if ($resql) {
if (!empty($arrayfields['total_mark_rate']['checked'])) {
print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
}
$totalarray = array(
'nbfield' => 0,
'val' => array(
'p.total_ht' => 0,
'p.total_tva' => 0,
'p.total_ttc' => 0,
),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@ -1570,6 +1570,7 @@ if ($resql) {
);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['p.datec']['checked'])) {
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
@ -1614,6 +1615,7 @@ if ($resql) {
$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql);
@ -2076,7 +2078,7 @@ if ($resql) {
if (!empty($arrayfields['sale_representative']['checked'])) {
// Sales representatives
print '<td class="tdoverflowmax200">';
print '<td class="tdoverflowmax150">';
if ($obj->socid > 0) {
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) {

View File

@ -59,7 +59,10 @@ $search_number = GETPOST('search_number', 'alpha');
$search_status = GETPOST('search_status') ?GETPOST('search_status', 'alpha') : 'opened'; // 'all' or ''='opened'
$optioncss = GETPOST('optioncss', 'alpha');
$search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array");
$search_category_list ="";
if (isModEnabled('categorie')) {
$search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array");
}
$socid = 0;
// Security check

View File

@ -1756,8 +1756,8 @@ abstract class CommonInvoice extends CommonObject
if ($this->ref_client) {
$complementaryinfo .= '/20/'.$this->ref_client;
}
if ($this->thirdparty->vat_number) {
$complementaryinfo .= '/30/'.$this->thirdparty->vat_number;
if ($this->thirdparty->tva_intra) {
$complementaryinfo .= '/30/'.$this->thirdparty->tva_intra;
}
// Header

View File

@ -46,6 +46,7 @@
* {dol_print_barcode} Print barcode
* {dol_print_logo} Print logo stored on printer. Example : <print_logo>32|32
* {dol_print_logo_old} Print logo stored on printer. Must be followed by logo code. For old printers.
* {dol_print_logo_old_cf} Print logo stored on printer. Must be followed by logo code. For old printers. May help for centering image.
* {dol_print_object_lines} Print object lines
* {dol_print_object_tax} Print object total tax
* {dol_print_object_local_tax} Print object local tax
@ -63,7 +64,8 @@
* <dol_value_month> Replaced by month number
* <dol_value_day> Replaced by day number
* <dol_value_day_letters> Replaced by day number
* <dol_value_currentdate> Replaced by current date
* <dol_value_currentdate> Replaced by current date and time
* <dol_value_currentdate_notime> Replaced by current date without time
* <dol_object_id> Replaced by object id
* <dol_object_ref> Replaced by object ref
* <dol_value_customer_firstname> Replaced by customer firstname
@ -191,10 +193,18 @@ class dolReceiptPrinter extends Printer
'dol_value_day' => 'DOL_VALUE_DAY',
'dol_value_day_letters' => 'DOL_VALUE_DAY',
'dol_value_currentdate' => 'DOL_VALUE_CURRENTDATE',
'dol_value_currentdate_notime' => 'CurrentDateWithTime',
'dol_value_currentdate_letters' => 'DOL_VALUE_CURRENTDATE_LETTERS',
'dol_value_currentyear' => 'CurrentYear',
'dol_value_currentmonth_letters' => 'DOL_VALUE_CURRENT_MONTH_LETTERS',
'dol_value_currentmonth' => 'DOL_VALUE_CURRENT_MONTH',
'dol_value_currentday' => 'DOL_VALUE_CURRENT_DAY',
'dol_value_currentday_letters' => 'DOL_VALUE_CURRENT_DAY',
'dol_print_payment' => 'DOL_PRINT_PAYMENT',
'dol_print_curr_date' => 'DOL_PRINT_CURR_DATE',
'dol_print_logo' => 'DOL_PRINT_LOGO',
'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD',
'dol_print_logo_old_cf' => 'DOL_PRINT_LOGO_OLD_CF',
'dol_value_object_id' => 'InvoiceID',
'dol_value_object_ref' => 'InvoiceRef',
'dol_print_object_lines' => 'DOL_PRINT_OBJECT_LINES',
@ -577,9 +587,12 @@ class dolReceiptPrinter extends Printer
public function sendToPrinter($object, $templateid, $printerid)
{
global $conf, $mysoc, $langs, $user;
$langs->load('bills');
$error = 0;
$ret = $this->loadTemplate($templateid);
$now = dol_now('tzuser');
// tags a remplacer par leur valeur avant de parser (dol_value_xxx)
$this->template = str_replace('{dol_value_object_id}', $object->id, $this->template);
$this->template = str_replace('{dol_value_object_ref}', $object->ref, $this->template);
@ -591,7 +604,15 @@ class dolReceiptPrinter extends Printer
$this->template = str_replace('{dol_value_month}', dol_print_date($object->date, '%m'), $this->template);
$this->template = str_replace('{dol_value_day}', dol_print_date($object->date, '%d'), $this->template);
$this->template = str_replace('{dol_value_day_letters}', $langs->trans("Day".dol_print_date($object->date, '%m')[1]), $this->template);
$this->template = str_replace('{dol_value_currentdate}', dol_print_date(dol_now(), 'dayhour'), $this->template);
$this->template = str_replace('{dol_value_currentdate}', dol_print_date($now, 'dayhour'), $this->template);
$this->template = str_replace('{dol_value_currentdate_notime}', dol_print_date($now, 'day'), $this->template);
$this->template = str_replace('{dol_value_currentdate_letters}', dol_print_date($now, 'dayhourtext'), $this->template);
$this->template = str_replace('{dol_value_currentyear}', dol_print_date($now, '%Y'), $this->template);
$this->template = str_replace('{dol_value_currentmonth_letters}', $langs->trans("Month".dol_print_date($now, '%m')), $this->template);
$this->template = str_replace('{dol_value_currentmonth}', dol_print_date($now, '%m'), $this->template);
$this->template = str_replace('{dol_value_currentday}', dol_print_date($now, '%d'), $this->template);
$this->template = str_replace('{dol_value_currentday_letters}', $langs->trans("Day".dol_print_date($now, '%m')[1]), $this->template);
$this->template = str_replace('{dol_value_customer_firstname}', $object->thirdparty->firstname, $this->template);
$this->template = str_replace('{dol_value_customer_lastname}', $object->thirdparty->lastname, $this->template);
@ -759,6 +780,10 @@ class dolReceiptPrinter extends Printer
$img = EscposImage::load(DOL_DATA_ROOT.'/mycompany/logos/'.$mysoc->logo);
$this->printer->bitImage($img);
break;
case 'DOL_PRINT_LOGO_OLD_CF':
$img = EscposImage::load(DOL_DATA_ROOT.'/mycompany/logos/'.$mysoc->logo);
$this->printer->bitImageColumnFormat($img);
break;
case 'DOL_PRINT_QRCODE':
// $vals[$tplline]['value'] -> qrCode($content, $ec, $size, $model)
$this->printer->qrcode($vals[$tplline]['value']);
@ -845,9 +870,9 @@ class dolReceiptPrinter extends Printer
}
break;
case 'DOL_VALUE_PLACE':
$sql = "SELECT floor, label FROM ".$this->db->prefix()."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref)));
$resql = $this->db->query($sql);
$obj = $this->db->fetch_object($resql);
$sql = "SELECT floor, label FROM ".$this->db->prefix()."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref)));
$resql = $this->db->query($sql);
$obj = $this->db->fetch_object($resql);
if ($obj) {
$this->printer->text($obj->label);
}

View File

@ -285,7 +285,7 @@ function limitChars(textarea, limit, infodiv)
print '<input type="hidden" name="message" value="'.dol_escape_htmltag($defaultmessage).'">';
} else {
print '<textarea class="quatrevingtpercent" name="message" id="message" rows="'.ROWS_4.'" onkeyup="limitChars(this, 160, \'charlimitinfospan\')">'.$defaultmessage.'</textarea>';
print '<div id="charlimitinfo">'.$langs->trans("SmsInfoCharRemain").': <span id="charlimitinfospan">'.(160 - dol_strlen($defaultmessage)).'</span></div></td>';
print '<div id="charlimitinfo" class="opacitymedium">'.$langs->trans("SmsInfoCharRemain").': <span id="charlimitinfospan">'.(160 - dol_strlen($defaultmessage)).'</span></div></td>';
}
print "</td></tr>\n";
}

View File

@ -334,7 +334,7 @@ class FormTicket
print '</td></tr>';
// Severity => Priority
print '<tr><td><span class="none"><label for="selectseverity_code">'.$langs->trans("TicketSeverity").'</span></label></td><td>';
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">'.$langs->trans("TicketSeverity").'</span></label></td><td>';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 1);
print '</td></tr>';

View File

@ -5,7 +5,7 @@
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1567,7 +1567,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
'border-left' => false, // remove left line separator
);
if (!empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE)) {
if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) {
$this->cols['photo']['status'] = true;
}

View File

@ -84,6 +84,13 @@ class Expedition extends CommonObject
*/
public $picto = 'dolly';
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array();
public $socid;
/**

View File

@ -131,6 +131,54 @@ class ExpeditionStats extends Stats
return $this->_getNbByYear($sql);
}
/**
* Return the orders amount by month for a year
*
* @param int $year Year to scan
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array Array with amount by month
*/
public function getAmountByMonth($year, $format = 0)
{
global $user;
$sql = "SELECT date_format(c.date_valid,'%m') as dm, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
$res = $this->_getAmountByMonth($year, $sql, $format);
return $res;
}
/**
* Return the orders amount average by month for a year
*
* @param int $year year for stats
* @return array array with number by month
*/
public function getAverageByMonth($year)
{
global $user;
$sql = "SELECT date_format(c.date_valid,'%m') as dm, AVG(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
return $this->_getAverageByMonth($year, $sql);
}
/**
* Return nb, total and average
*

View File

@ -47,11 +47,12 @@ $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$mesg = '';
$mode = '';
print load_fiche_titre($langs->trans("StatisticsOfSendings").' '.$year, $mesg);
$stats = new ExpeditionStats($db);
$data = $stats->getNbExpeditionByMonth($year);
$stats = new ExpeditionStats($db, $socid, $mode);
$data = $stats->getNbByMonth($year);
dol_mkdir($conf->expedition->dir_temp);

View File

@ -106,7 +106,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// terms of the settlement
// Set payment terms of the settlement
if ($action == 'setconditions' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentTerms(GETPOST('cond_reglement_supplier_id', 'int'));
@ -114,7 +114,7 @@ if (empty($reshook)) {
dol_print_error($db, $object->error);
}
}
// mode de reglement
// Payment mode
if ($action == 'setmode' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_supplier_id', 'int'));
@ -123,6 +123,15 @@ if (empty($reshook)) {
}
}
// Bank account
if ($action == 'setbankaccount' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// update supplier order min amount
if ($action == 'setsupplier_order_min_amount') {
$object->fetch($id);
@ -276,7 +285,7 @@ if ($object->id > 0) {
print "</td>";
print '</tr>';
// Mode de reglement par defaut
// Default payment mode
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentMode');
@ -294,6 +303,26 @@ if ($object->id > 0) {
print "</td>";
print '</tr>';
if (isModEnabled("banque")) {
// Default bank account for payments
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentBankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'none');
}
print "</td>";
print '</tr>';
}
// Relative discounts (Discounts-Drawbacks-Rebates)
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';

View File

@ -55,6 +55,8 @@ ALTER TABLE llx_user DROP COLUMN idpers3;
-- v17
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_percent (percent);
UPDATE llx_c_paiement SET code = 'BANCON' WHERE code = 'BAN' AND libelle = 'Bancontact';
-- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN fk_user_creat integer NULL;

View File

@ -27,5 +27,6 @@ ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datep (datep);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datep2 (datep2);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_recurid (recurid);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_ref_ext (ref_ext);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_percent (percent);
ALTER TABLE llx_actioncomm ADD UNIQUE INDEX uk_actioncomm_ref (ref, entity);

View File

@ -44,7 +44,7 @@ create table llx_societe
town varchar(50), -- town
fk_departement integer DEFAULT 0, --
fk_pays integer DEFAULT 0, --
fk_account integer DEFAULT 0, --
fk_account integer DEFAULT 0, -- default bank account
phone varchar(20), -- phone number
fax varchar(20), -- fax number
url varchar(255), --

View File

@ -1932,7 +1932,7 @@ BackupDumpWizard=Wizard to build the database dump file
BackupZipWizard=Wizard to build the archive of documents directory
SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason:
SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is a manual process only a privileged user may perform.
InstallModuleFromWebHasBeenDisabledContactUs=Install of external modules from the application is currently locked. Please contact us if you need us to enable this feature.
InstallModuleFromWebHasBeenDisabledContactUs=Install or development of external modules from the application is currently locked for security purpose. Please contact us if you need to enable this feature.
InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file <strong>%s</strong> to allow this feature.
ConfFileMustContainCustom=Installing or building an external module from application need to save the module files into directory <strong>%s</strong>. To have this directory processed by Dolibarr, you must setup your <strong>conf/conf.php</strong> to add the 2 directive lines:<br><strong>$dolibarr_main_url_root_alt='/custom';</strong><br><strong>$dolibarr_main_document_root_alt='%s/custom';</strong>
HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over

View File

@ -240,7 +240,7 @@ OppStatusPENDING=Pending
OppStatusWON=Won
OppStatusLOST=Lost
Budget=Budget
AllowToLinkFromOtherCompany=Allow to link project from other company<br><br><u>Supported values:</u><br>- Keep empty: Can link any project of the company (default)<br>- "all": Can link any projects, even projects of other companies<br>- A list of third-party ids separated by commas: can link all projects of these third partys (Example: 123,4795,53)<br>
AllowToLinkFromOtherCompany=Allow to link an element with a project of other company<br><br><u>Supported values:</u><br>- Keep empty: Can link elements with any projects in the same company (default)<br>- "all": Can link elements with any projects, even projects of other companies<br>- A list of third-party ids separated by commas: can link elements with any projects of these third partys (Example: 123,4795,53)<br>
LatestProjects=Latest %s projects
LatestModifiedProjects=Latest %s modified projects
OtherFilteredTasks=Other filtered tasks
@ -284,7 +284,7 @@ ProfitIsCalculatedWith=Profit is calculated using
AddPersonToTask=Add also to tasks
UsageOrganizeEvent=Usage: Event Organization
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE=Classify project as closed when all its tasks are completed (100%% progress)
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with all tasks at 100%% progress won't be affected: you will have to close them manually. This option only affects open projects.
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with all tasks already set to a progress of 100%% won't be affected: you will have to close them manually. This option only affects open projects.
SelectLinesOfTimeSpentToInvoice=Select lines of time spent that are unbilled, then bulk action "Generate Invoice" to bill them
ProjectTasksWithoutTimeSpent=Project tasks without time spent
FormForNewLeadDesc=Thanks to fill the following form to contact us. You can also send us an email directly to <b>%s</b>.

View File

@ -58,10 +58,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/conf.class.php';
$conf = new Conf();
// Set properties specific to database
$conf->db->host = $dolibarr_main_db_host;
$conf->db->port = $dolibarr_main_db_port;
$conf->db->name = $dolibarr_main_db_name;
$conf->db->user = $dolibarr_main_db_user;
$conf->db->host = empty($dolibarr_main_db_host) ? '' : $dolibarr_main_db_host;
$conf->db->port = empty($dolibarr_main_db_port) ? '' : $dolibarr_main_db_port;
$conf->db->name = empty($dolibarr_main_db_name) ? '' : $dolibarr_main_db_name;
$conf->db->user = empty($dolibarr_main_db_user) ? '' : $dolibarr_main_db_user;
$conf->db->pass = empty($dolibarr_main_db_pass) ? '' : $dolibarr_main_db_pass;
$conf->db->type = $dolibarr_main_db_type;
$conf->db->prefix = $dolibarr_main_db_prefix;

View File

@ -1974,6 +1974,28 @@ if ($message) {
$infomodulesfound = '<div style="padding: 12px 9px 12px">'.$form->textwithpicto('', $langs->trans("ModuleBuilderDesc3", count($listofmodules)).'<br><br>'.$langs->trans("ModuleBuilderDesc4", $FILEFLAG).'<br>'.$textforlistofdirs).'</div>';
$dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
$allowonlineinstall = true;
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) {
$allowonlineinstall = false;
}
if (empty($allowonlineinstall)) {
if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
// Show clean message
$message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
} else {
// Show technical message
$message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'), 0, 0, 1, 'warning');
}
print $message;
llxFooter();
exit(0);
}
// Load module descriptor
$error = 0;
$moduleobj = null;

View File

@ -270,10 +270,13 @@ if (empty($reshook)) {
if ($ret == -3) {
$error++;
$object->fetch($object->product_id_already_linked);
$productLink = $object->getNomUrl(1, 'supplier');
$tmpobject = new Product($db);
$tmpobject->fetch($object->product_id_already_linked);
$productLink = $tmpobject->getNomUrl(1, 'supplier');
setEventMessages($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", $productLink), null, 'errors');
$texttoshow = $langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", '{s1}');
$texttoshow = str_replace('{s1}', $productLink, $texttoshow);
setEventMessages($texttoshow, null, 'errors');
} elseif ($ret < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
@ -995,52 +998,72 @@ END;
$param = "&id=".$object->id;
$nbfields = 0;
print '<tr class="liste_titre">';
if (!empty($arrayfields['pfp.datec']['checked'])) {
print_liste_field_titre("AppliedPricesFrom", $_SERVER["PHP_SELF"], "pfp.datec", "", $param, "", $sortfield, $sortorder, '', '', 1);
$nbfields++;
}
if (!empty($arrayfields['s.nom']['checked'])) {
print_liste_field_titre("Suppliers", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder, '', '', 1);
$nbfields++;
}
print_liste_field_titre("SupplierRef", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder, '', '', 1);
$nbfields++;
if (!empty($arrayfields['pfp.fk_availability']['checked'])) {
print_liste_field_titre("Availability", $_SERVER["PHP_SELF"], "pfp.fk_availability", "", $param, "", $sortfield, $sortorder);
$nbfields++;
}
if (!empty($arrayfields['pfp.quantity']['checked'])) {
print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "pfp.quantity", "", $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
}
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
print_liste_field_titre("PriceQtyMinHT", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
if (isModEnabled("multicurrency")) {
print_liste_field_titre("PriceQtyMinHTCurrency", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
}
if (!empty($arrayfields['pfp.unitprice']['checked'])) {
print_liste_field_titre("UnitPriceHT", $_SERVER["PHP_SELF"], "pfp.unitprice", "", $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
}
if (!empty($arrayfields['pfp.multicurrency_unitprice']['checked'])) {
print_liste_field_titre("UnitPriceHTCurrency", $_SERVER["PHP_SELF"], "pfp.multicurrency_unitprice", "", $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
}
if (isModEnabled("multicurrency")) {
print_liste_field_titre("Currency", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
}
print_liste_field_titre("DiscountQtyMin", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
if (!empty($arrayfields['pfp.delivery_time_days']['checked'])) {
print_liste_field_titre("NbDaysToDelivery", $_SERVER["PHP_SELF"], "pfp.delivery_time_days", "", $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
}
if (!empty($arrayfields['pfp.supplier_reputation']['checked'])) {
print_liste_field_titre("ReputationForThisProduct", $_SERVER["PHP_SELF"], "pfp.supplier_reputation", "", $param, '', $sortfield, $sortorder, 'center ');
$nbfields++;
}
if (!empty($arrayfields['pfp.fk_barcode_type']['checked'])) {
print_liste_field_titre("BarcodeType", $_SERVER["PHP_SELF"], "pfp.fk_barcode_type", "", $param, '', $sortfield, $sortorder, 'center ');
$nbfields++;
}
if (!empty($arrayfields['pfp.barcode']['checked'])) {
print_liste_field_titre("BarcodeValue", $_SERVER["PHP_SELF"], "pfp.barcode", "", $param, '', $sortfield, $sortorder, 'center ');
$nbfields++;
}
if (!empty($arrayfields['pfp.packaging']['checked'])) {
print_liste_field_titre("PackagingForThisProduct", $_SERVER["PHP_SELF"], "pfp.packaging", "", $param, 'align="center"', $sortfield, $sortorder);
$nbfields++;
}
if (!empty($arrayfields['pfp.tms']['checked'])) {
print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right ', '', 1);
$nbfields++;
}
// fetch optionals attributes and labels
@ -1062,6 +1085,7 @@ END;
}
if (!empty($arrayfields['ef.' . $key]['checked'])) {
print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.' . $key, '', $param, '', $sortfield, $sortorder, 'right ');
$nbfields++;
}
}
}
@ -1069,10 +1093,11 @@ END;
}
if (is_object($hookmanager)) {
$parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
$parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id, 'nbfields'=>$nbfields);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
$nbfields++;
print "</tr>\n";
if (is_array($product_fourn_list)) {
@ -1254,6 +1279,10 @@ END;
print '</tr>';
}
if (empty($product_fourn_list)) {
print '<tr><td colspan="'.$nbfields.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
} else {
dol_print_error($db);
}

View File

@ -176,7 +176,6 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'p.ref'=>"Ref",
'pfp.ref_fourn'=>"RefSupplier",
'p.label'=>"ProductLabel",
'p.description'=>"Description",
"p.note"=>"Note",
@ -190,7 +189,6 @@ if (getDolGlobalInt('MAIN_MULTILANGS')) {
}
if (isModEnabled('barcode')) {
$fieldstosearchall['p.barcode'] = 'Gencod';
$fieldstosearchall['pfp.barcode'] = 'GencodBuyPrice';
}
// Personalized search criterias. Example: $conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS = 'p.ref=ProductRef;p.label=ProductLabel;p.description=Description;p.note=Note;'
if (!empty($conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS)) {
@ -459,7 +457,16 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
$sql .= ' AND (';
$sql .= natural_search(array_keys($fieldstosearchall), $sall, 0, 1);
// Search also into a supplier reference 'pfp.ref_fourn'="RefSupplier"
$sql .= ' OR EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid';
$sql .= ' AND ('.natural_search('pfp.ref_fourn', $sall, 0, 1);
if (isModEnabled('barcode')) {
// Search also into a supplier barcode 'pfp.barcode'='GencodBuyPrice';
$sql .= ' OR '.natural_search('pfp.barcode', $sall, 0, 1);
}
$sql .= ')))';
}
// if the type is not 1, we show all products (type = 0,2,3)
if (dol_strlen($search_type) && $search_type != '-1') {
@ -1338,49 +1345,54 @@ while ($i < min($num, $limit)) {
}
}
}
$parameters = array('staticdata' => $obj);
// Note that $action and $object may have been modified by hook
// do product_static fetch in hook if wanted or anything else
$reshook = $hookmanager->executeHooks('loadStaticObject', $parameters, $product_static, $action);
if (empty($reshook)) {
$product_static->id = $obj->rowid;
$product_static->ref = $obj->ref;
$product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated
$product_static->ref_supplier = empty($obj->ref_supplier) ? '' : $obj->ref_supplier;
$product_static->label = $obj->label;
$product_static->finished = $obj->finished;
$product_static->type = $obj->fk_product_type;
$product_static->status_buy = $obj->tobuy;
$product_static->status = $obj->tosell;
$product_static->status_batch = $obj->tobatch;
$product_static->entity = $obj->entity;
$product_static->pmp = $obj->pmp;
$product_static->accountancy_code_sell = $obj->accountancy_code_sell;
$product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
$product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
$product_static->accountancy_code_buy = $obj->accountancy_code_buy;
$product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
$product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
$product_static->length = $obj->length;
$product_static->length_units = $obj->length_units;
$product_static->width = $obj->width;
$product_static->width_units = $obj->width_units;
$product_static->height = $obj->height;
$product_static->height_units = $obj->height_units;
$product_static->weight = $obj->weight;
$product_static->weight_units = $obj->weight_units;
$product_static->volume = $obj->volume;
$product_static->volume_units = $obj->volume_units;
$product_static->surface = $obj->surface;
$product_static->surface_units = $obj->surface_units;
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$product_static->fk_unit = $obj->fk_unit;
}
$product_static->id = $obj->rowid;
$product_static->ref = $obj->ref;
$product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated
$product_static->ref_supplier = empty($obj->ref_supplier) ? '' : $obj->ref_supplier;
$product_static->label = $obj->label;
$product_static->finished = $obj->finished;
$product_static->type = $obj->fk_product_type;
$product_static->status_buy = $obj->tobuy;
$product_static->status = $obj->tosell;
$product_static->status_batch = $obj->tobatch;
$product_static->entity = $obj->entity;
$product_static->pmp = $obj->pmp;
$product_static->accountancy_code_sell = $obj->accountancy_code_sell;
$product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
$product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
$product_static->accountancy_code_buy = $obj->accountancy_code_buy;
$product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
$product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
$product_static->length = $obj->length;
$product_static->length_units = $obj->length_units;
$product_static->width = $obj->width;
$product_static->width_units = $obj->width_units;
$product_static->height = $obj->height;
$product_static->height_units = $obj->height_units;
$product_static->weight = $obj->weight;
$product_static->weight_units = $obj->weight_units;
$product_static->volume = $obj->volume;
$product_static->volume_units = $obj->volume_units;
$product_static->surface = $obj->surface;
$product_static->surface_units = $obj->surface_units;
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$product_static->fk_unit = $obj->fk_unit;
}
// STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock.
if ((isModEnabled('stock') && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
if ($obj->fk_product_type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service
$option = 'nobatch';
if (empty($arrayfields['stock_virtual']['checked'])) {
$option .= ',novirtual';
// STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock.
if ((isModEnabled('stock') && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
if ($product_static->type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service
$option = 'nobatch';
if (empty($arrayfields['stock_virtual']['checked'])) {
$option .= ',novirtual';
}
$product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock()
}
$product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock()
}
}
@ -1454,7 +1466,7 @@ while ($i < min($num, $limit)) {
// Label
if (!empty($arrayfields['p.label']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).'">'.$obj->label.'</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($product_static->label).'">'.$product_static->label.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1464,7 +1476,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['p.fk_product_type']['checked'])) {
print '<td class="center">';
$s = '';
if ($obj->fk_product_type == 0) {
if ($product_static->type == 0) {
$s .= img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"');
} else {
$s .= img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"');
@ -1478,7 +1490,7 @@ while ($i < min($num, $limit)) {
// Barcode
if (!empty($arrayfields['p.barcode']['checked'])) {
print '<td>'.$obj->barcode.'</td>';
print '<td>'.$product_static->barcode.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1522,7 +1534,7 @@ while ($i < min($num, $limit)) {
// Weight
if (!empty($arrayfields['p.weight']['checked'])) {
print '<td class="center">';
print $obj->weight;
print $product_static->weight;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -1542,7 +1554,7 @@ while ($i < min($num, $limit)) {
// Length
if (!empty($arrayfields['p.length']['checked'])) {
print '<td class="center">';
print $obj->length;
print $product_static->length;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -1562,7 +1574,7 @@ while ($i < min($num, $limit)) {
// Width
if (!empty($arrayfields['p.width']['checked'])) {
print '<td align="center">';
print $obj->width;
print $product_static->width;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -1582,7 +1594,7 @@ while ($i < min($num, $limit)) {
// Height
if (!empty($arrayfields['p.height']['checked'])) {
print '<td align="center">';
print $obj->height;
print $product_static->height;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -1602,7 +1614,7 @@ while ($i < min($num, $limit)) {
// Surface
if (!empty($arrayfields['p.surface']['checked'])) {
print '<td class="center">';
print $obj->surface;
print $product_static->surface;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -1622,7 +1634,7 @@ while ($i < min($num, $limit)) {
// Volume
if (!empty($arrayfields['p.volume']['checked'])) {
print '<td class="center">';
print $obj->volume;
print $product_static->volume;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -1654,7 +1666,7 @@ while ($i < min($num, $limit)) {
// Sell price
if (!empty($arrayfields['p.sellprice']['checked'])) {
print '<td class="right nowraponall">';
if ($obj->tosell && $usercancreadprice) {
if ($product_static->status && $usercancreadprice) {
if ($obj->price_base_type == 'TTC') {
print '<span class="amount">'.price($obj->price_ttc).' '.$langs->trans("TTC").'</span>';
} else {
@ -1677,7 +1689,7 @@ while ($i < min($num, $limit)) {
$productpricescache[$obj->rowid] = array();
}
if ($obj->tosell && $usercancreadprice) {
if ($product_static->status && $usercancreadprice) {
// Make 1 request for all price levels (without filter on price_level) and saved result into an cache array
// then reuse the cache array if we need prices for other price levels
$sqlp = "SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price, p.price_base_type";
@ -1727,7 +1739,7 @@ while ($i < min($num, $limit)) {
// Better buy price
if (!empty($arrayfields['p.minbuyprice']['checked'])) {
print '<td class="right nowraponall">';
if ($obj->tobuy && $obj->bestpurchaseprice != '' && $usercancreadprice) {
if ($product_static->status_buy && $obj->bestpurchaseprice != '' && $usercancreadprice) {
if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) {
if ($product_fourn->product_fourn_price_id > 0) {
if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) {
@ -1748,7 +1760,7 @@ while ($i < min($num, $limit)) {
// Number of buy prices
if (!empty($arrayfields['p.numbuyprice']['checked'])) {
print '<td class="right">';
if ($obj->tobuy && $usercancreadprice) {
if ($product_static->status_buy && $usercancreadprice) {
if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) {
$htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList);
print $form->textwithpicto(count($productFournList), $htmltext);
@ -1788,7 +1800,7 @@ while ($i < min($num, $limit)) {
// Limit alert
if (!empty($arrayfields['p.seuil_stock_alerte']['checked'])) {
print '<td class="right">';
if ($obj->fk_product_type != 1) {
if ($product_static->type != 1) {
print $obj->seuil_stock_alerte;
}
print '</td>';
@ -1799,7 +1811,7 @@ while ($i < min($num, $limit)) {
// Desired stock
if (!empty($arrayfields['p.desiredstock']['checked'])) {
print '<td class="right">';
if ($obj->fk_product_type != 1) {
if ($product_static->type != 1) {
print $obj->desiredstock;
}
print '</td>';
@ -1810,7 +1822,7 @@ while ($i < min($num, $limit)) {
// Stock real
if (!empty($arrayfields['p.stock']['checked'])) {
print '<td class="right">';
if ($obj->fk_product_type != 1) {
if ($product_static->type != 1) {
if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
@ -1826,7 +1838,7 @@ while ($i < min($num, $limit)) {
// Stock virtual
if (!empty($arrayfields['stock_virtual']['checked'])) {
print '<td class="right">';
if ($obj->fk_product_type != 1) {
if ($product_static->type != 1) {
if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
@ -1868,38 +1880,38 @@ while ($i < min($num, $limit)) {
}
// Accountancy code sell
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['checked'])) {
print '<td>'.$obj->accountancy_code_sell.'</td>';
print '<td>'.$product_static->accountancy_code_sell.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) {
print '<td>'.$obj->accountancy_code_sell_intra.'</td>';
print '<td>'.$product_static->accountancy_code_sell_intra.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) {
print '<td>'.$obj->accountancy_code_sell_export.'</td>';
print '<td>'.$product_static->accountancy_code_sell_export.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accountancy code buy
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) {
print '<td>'.$obj->accountancy_code_buy.'</td>';
print '<td>'.$product_static->accountancy_code_buy.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) {
print '<td>'.$obj->accountancy_code_buy_intra.'</td>';
print '<td>'.$product_static->accountancy_code_buy_intra.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) {
print '<td>'.$obj->accountancy_code_buy_export.'</td>';
print '<td>'.$product_static->accountancy_code_buy_export.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1935,7 +1947,7 @@ while ($i < min($num, $limit)) {
if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
print $product_static->LibStatut($obj->tosell, 5, 0);
print $product_static->LibStatut($product_static->status, 5, 0);
}
print '</td>';
if (!$i) {
@ -1948,7 +1960,7 @@ while ($i < min($num, $limit)) {
if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
print $product_static->LibStatut($obj->tobuy, 5, 1);
print $product_static->LibStatut($product_static->status_buy, 5, 1);
}
print '</td>';
if (!$i) {

View File

@ -54,6 +54,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected i
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'timespentlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'alpha');
$id = GETPOST('id', 'int');
$projectid = GETPOST('projectid', 'int');
@ -323,10 +324,10 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
}
}
if ($action == 'confirm_deleteline' && $confirm == "yes" && $user->rights->projet->supprimer) {
$object->fetchTimeSpent(GETPOST('lineid', 'int')); // load properties like $object->timespent_id
if ($action == 'confirm_deleteline' && $confirm == "yes" && ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer'))) {
$object->fetchTimeSpent(GETPOST('lineid', 'int')); // load properties like $object->timespent_xxx
if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) {
if (in_array($object->timespent_fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
$result = $object->delTimeSpent($user); // delete line with $object->timespent_id
if ($result < 0) {
@ -2109,7 +2110,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print ' ';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
} elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks
if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) {
print '&nbsp;';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';

View File

@ -441,7 +441,7 @@ class Recruitment extends DolibarrApi
// $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->jobposition->update(DolibarrApiAccess::$user, false) > 0) {
return $this->get($id);
return $this->getJobPosition($id);
} else {
throw new RestException(500, $this->jobposition->error);
}
@ -484,7 +484,7 @@ class Recruitment extends DolibarrApi
// $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->candidature->update(DolibarrApiAccess::$user, false) > 0) {
return $this->get($id);
return $this->getCandidature($id);
} else {
throw new RestException(500, $this->candidature->error);
}

View File

@ -2702,23 +2702,24 @@ class Societe extends CommonObject
if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) {
$label2 .= '<br><b>'.$langs->trans('VATIntra').':</b> '.dol_escape_htmltag($this->tva_intra);
}
if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) {
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false) {
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false && $langs->trans('ProfId1'.$this->country_code) != '-') {
$label2 .= '<br><b>'.$langs->trans('ProfId1'.$this->country_code).':</b> '.$this->idprof1;
}
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false) {
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false && $langs->trans('ProfId2'.$this->country_code) != '-') {
$label2 .= '<br><b>'.$langs->trans('ProfId2'.$this->country_code).':</b> '.$this->idprof2;
}
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false) {
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false && $langs->trans('ProfId3'.$this->country_code) != '-') {
$label2 .= '<br><b>'.$langs->trans('ProfId3'.$this->country_code).':</b> '.$this->idprof3;
}
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false) {
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false && $langs->trans('ProfId4'.$this->country_code) != '-') {
$label2 .= '<br><b>'.$langs->trans('ProfId4'.$this->country_code).':</b> '.$this->idprof4;
}
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false) {
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false && $langs->trans('ProfId5'.$this->country_code) != '-') {
$label2 .= '<br><b>'.$langs->trans('ProfId5'.$this->country_code).':</b> '.$this->idprof5;
}
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false) {
if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false && $langs->trans('ProfId6'.$this->country_code) != '-') {
$label2 .= '<br><b>'.$langs->trans('ProfId6'.$this->country_code).':</b> '.$this->idprof6;
}
}

View File

@ -767,7 +767,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && (
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) {
if ($obj->client > 0) {
if ($companystatic->client > 0) {
header("Location: ".DOL_URL_ROOT.'/comm/card.php?socid='.$id);
exit;
}
@ -1447,27 +1447,36 @@ $totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
$parameters = array('staticdata' => $obj);
// Note that $action and $object may have been modified by hook
// do companystatic fetch in hook if wanted or anything else
$reshook = $hookmanager->executeHooks('loadStaticObject', $parameters, $companystatic, $action);
if (empty($reshook)) {
$companystatic->id = $obj->rowid;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->name_alias;
$companystatic->logo = $obj->logo;
$companystatic->barcode = $obj->barcode;
$companystatic->canvas = $obj->canvas;
$companystatic->client = $obj->client;
$companystatic->status = $obj->status;
$companystatic->email = $obj->email;
$companystatic->address = $obj->address;
$companystatic->zip = $obj->zip;
$companystatic->town = $obj->town;
$companystatic->fournisseur = $obj->fournisseur;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->tva_intra = $obj->tva_intra;
$companystatic->country_code = $obj->country_code;
$companystatic->id = $obj->rowid;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->name_alias;
$companystatic->logo = $obj->logo;
$companystatic->canvas = $obj->canvas;
$companystatic->client = $obj->client;
$companystatic->status = $obj->status;
$companystatic->email = $obj->email;
$companystatic->fournisseur = $obj->fournisseur;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->tva_intra = $obj->tva_intra;
$companystatic->country_code = $obj->country_code;
$companystatic->code_compta_client = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$companystatic->code_compta_client = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
$companystatic->fk_parent = $obj->fk_parent;
$companystatic->entity = $obj->entity;
$companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
$companystatic->fk_parent = $obj->fk_parent;
$companystatic->entity = $obj->entity;
}
print '<tr class="oddeven"';
if ($contextpage == 'poslist') {
@ -1501,7 +1510,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td'.(empty($conf->global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').' data-key="ref">';
if ($contextpage == 'poslist') {
print dol_escape_htmltag($obj->name);
print dol_escape_htmltag($companystatic->name);
} else {
print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
}
@ -1520,56 +1529,56 @@ while ($i < min($num, $limit)) {
}
// Barcode
if (!empty($arrayfields['s.barcode']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->barcode).'">'.dol_escape_htmltag($obj->barcode).'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->barcode).'">'.dol_escape_htmltag($companystatic->barcode).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Customer code
if (!empty($arrayfields['s.code_client']['checked'])) {
print '<td class="nowraponall">'.dol_escape_htmltag($obj->code_client).'</td>';
print '<td class="nowraponall">'.dol_escape_htmltag($companystatic->code_client).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Supplier code
if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
print '<td class="nowraponall">'.dol_escape_htmltag($obj->code_fournisseur).'</td>';
print '<td class="nowraponall">'.dol_escape_htmltag($companystatic->code_fournisseur).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account customer code
if (!empty($arrayfields['s.code_compta']['checked'])) {
print '<td>'.dol_escape_htmltag($obj->code_compta).'</td>';
print '<td>'.dol_escape_htmltag($companystatic->code_compta_client).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account supplier code
if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
print '<td>'.dol_escape_htmltag($obj->code_compta_fournisseur).'</td>';
print '<td>'.dol_escape_htmltag($companystatic->code_compta_fournisseur).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Address
if (!empty($arrayfields['s.address']['checked'])) {
print '<td class="tdoverflowmax250" title="'.dol_escape_htmltag($obj->address).'">'.dol_escape_htmltag($obj->address).'</td>';
print '<td class="tdoverflowmax250" title="'.dol_escape_htmltag($companystatic->address).'">'.dol_escape_htmltag($companystatic->address).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print "<td>".dol_escape_htmltag($obj->zip)."</td>\n";
print "<td>".dol_escape_htmltag($companystatic->zip)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->town).'">'.dol_escape_htmltag($obj->town)."</td>\n";
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->town).'">'.dol_escape_htmltag($companystatic->town)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -1591,7 +1600,7 @@ while ($i < min($num, $limit)) {
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="center tdoverflowmax100">';
$labelcountry = ($obj->country_code && ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code)) ? $langs->trans("Country".$obj->country_code) : $obj->country_label;
$labelcountry = ($companystatic->country_code && ($langs->trans("Country".$companystatic->country_code) != "Country".$companystatic->country_code)) ? $langs->trans("Country".$companystatic->country_code) : $obj->country_label;
print $labelcountry;
print '</td>';
if (!$i) {
@ -1638,13 +1647,13 @@ while ($i < min($num, $limit)) {
}
}
if (!empty($arrayfields['s.phone']['checked'])) {
print '<td class="nowraponall">'.dol_print_phone($obj->phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n";
print '<td class="nowraponall">'.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['s.fax']['checked'])) {
print '<td class="nowraponall">'.dol_print_phone($obj->fax, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n";
print '<td class="nowraponall">'.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -1693,11 +1702,11 @@ while ($i < min($num, $limit)) {
}
// VAT
if (!empty($arrayfields['s.tva_intra']['checked'])) {
print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->tva_intra).'">';
if ($obj->tva_intra && !isValidVATID($companystatic)) {
print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($companystatic->tva_intra).'">';
if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
print img_warning("BadVATNumber", '', 'pictofixedwidth');
}
print $obj->tva_intra;
print $companystatic->tva_intra;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;

View File

@ -1834,10 +1834,10 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<tr class="nooddeven"><td>'.$langs->trans("LastConnexion").'</td>';
print '<td>';
if ($object->datepreviouslogin) {
print dol_print_date($object->datepreviouslogin, "dayhour").' <span class="opacitymedium">('.$langs->trans("Previous").')</span>, ';
print dol_print_date($object->datepreviouslogin, "dayhour", "tzuserrel").' <span class="opacitymedium">('.$langs->trans("Previous").')</span>, ';
}
if ($object->datelastlogin) {
print dol_print_date($object->datelastlogin, "dayhour").' <span class="opacitymedium">('.$langs->trans("Currently").')</span>';
print dol_print_date($object->datelastlogin, "dayhour", "tzuserrel").' <span class="opacitymedium">('.$langs->trans("Currently").')</span>';
}
print '</td>';
print "</tr>\n";