review
This commit is contained in:
commit
5dce64c811
@ -646,7 +646,7 @@ class AccountancyCategory // extends CommonObject
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
|
||||
//if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date';
|
||||
$sql .= " WHERE t.entity = ".$conf->entity;
|
||||
$sql .= " WHERE t.entity = ".((int) $conf->entity);
|
||||
if (is_array($cpt)) {
|
||||
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")";
|
||||
} else {
|
||||
|
||||
@ -128,8 +128,8 @@ if ($action == 'validatehistory') {
|
||||
|
||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||
// Customer Invoice lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.situation_cycle_ref, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.situation_percent, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
|
||||
@ -312,6 +312,10 @@ print '<span class="opacitymedium">'.$langs->trans("DescVentilCustomer").'</span
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")).'<br>';
|
||||
print '</span><br>';
|
||||
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
@ -386,6 +390,11 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
// TODO When INVOICE_USE_SITUATION = 1, values here are wrong. There is no compensation on bad stored amounts
|
||||
//$situation_ratio = 1;
|
||||
//if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
//}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
@ -519,6 +528,11 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
// TODO When INVOICE_USE_SITUATION = 1, values here are wrong. There is no compensation on bad stored amounts
|
||||
//$situation_ratio = 1;
|
||||
//if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
//}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
@ -630,7 +644,6 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
if (isModEnabled('margin')) {
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -644,22 +657,41 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
|
||||
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
// With old situation invoice setup
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
|
||||
} else {
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").") as total";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
|
||||
|
||||
@ -189,8 +189,8 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.situation_cycle_ref, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc, fd.situation_percent,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta_client,";
|
||||
@ -502,8 +502,33 @@ if ($result) {
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right nowraponall amount">'.price($objp->total_ht).'</td>';
|
||||
// Amount
|
||||
print '<td class="right nowraponall amount">';
|
||||
|
||||
// Create a compensation rate for old situation invoice feature.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($objp->situation_cycle_ref) {
|
||||
// Avoid divide by 0
|
||||
if ($objp->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($objp->rowid);
|
||||
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($objp->facid);
|
||||
|
||||
$situation_ratio = ($objp->situation_percent - $prev_progress) / $objp->situation_percent;
|
||||
}
|
||||
}
|
||||
print price($objp->total_ht * $situation_ratio);
|
||||
} else {
|
||||
print price($objp->total_ht);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Vat rate
|
||||
print '<td class="right">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
|
||||
|
||||
// Thirdparty
|
||||
|
||||
@ -228,8 +228,8 @@ if (empty($chartaccountcode)) {
|
||||
}
|
||||
|
||||
// Customer Invoice lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype, f.situation_cycle_ref, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.situation_percent, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
|
||||
@ -655,8 +655,30 @@ if ($result) {
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
|
||||
print '</td>';
|
||||
|
||||
// Amount
|
||||
print '<td class="right nowraponall amount">';
|
||||
print price($objp->total_ht);
|
||||
|
||||
// Create a compensation rate for old situation invoice feature.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($objp->situation_cycle_ref) {
|
||||
// Avoid divide by 0
|
||||
if ($objp->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($objp->rowid);
|
||||
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($objp->facid);
|
||||
|
||||
$situation_ratio = ($objp->situation_percent - $prev_progress) / $objp->situation_percent;
|
||||
}
|
||||
}
|
||||
print price($objp->total_ht * $situation_ratio);
|
||||
} else {
|
||||
print price($objp->total_ht);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Vat rate
|
||||
|
||||
@ -83,12 +83,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup';
|
||||
|
||||
llxHeader('', $langs->trans("AccountancyArea"), $help_url);
|
||||
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) {
|
||||
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."</span>\n";
|
||||
print "<br>";
|
||||
} elseif (isModEnabled('accounting')) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$step = 0;
|
||||
|
||||
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
|
||||
@ -106,7 +106,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
}
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
@ -206,21 +206,23 @@ if ($result) {
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
|
||||
}
|
||||
|
||||
if ($obj->type == Facture::TYPE_SITUATION) {
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->fdid);
|
||||
// Create a compensation rate.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($obj->situation_cycle_ref) {
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->fdid);
|
||||
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid);
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid);
|
||||
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$situation_ratio = 1;
|
||||
}
|
||||
|
||||
// Invoice lines
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021-2023 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
|
||||
@ -1015,7 +1015,7 @@ $i = 0;
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $maxinloop) {
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$datefin = $db->jdate($obj->datefin);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -946,6 +946,8 @@ if ($rowid > 0) {
|
||||
|
||||
print '<tr>';
|
||||
// Date start subscription
|
||||
$currentyear = dol_print_date(time(), "%Y");
|
||||
$currentmonth = dol_print_date(time(), "%m");
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
|
||||
if (GETPOST('reday')) {
|
||||
$datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
@ -955,7 +957,7 @@ if ($rowid > 0) {
|
||||
if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) {
|
||||
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
|
||||
} else {
|
||||
$datefrom = dol_get_first_day(dol_print_date(time(), "%Y"));
|
||||
$datefrom = dol_get_first_day($currentyear);
|
||||
}
|
||||
}
|
||||
print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);
|
||||
@ -966,7 +968,13 @@ if ($rowid > 0) {
|
||||
$dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
}
|
||||
if (!$dateto) {
|
||||
$dateto = -1; // By default, no date is suggested
|
||||
if (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH')) {
|
||||
$dateto = dol_get_last_day($currentyear, $currentmonth);
|
||||
} elseif (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) {
|
||||
$dateto = dol_get_last_day($currentyear);
|
||||
} else {
|
||||
$dateto = -1; // By default, no date is suggested
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
|
||||
print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0);
|
||||
|
||||
@ -35,8 +35,6 @@ include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectorfilter.class
|
||||
include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectoraction.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
|
||||
|
||||
// use Webklex\PHPIMAP;
|
||||
require DOL_DOCUMENT_ROOT.'/includes/webklex/php-imap/vendor/autoload.php';
|
||||
use Webklex\PHPIMAP\ClientManager;
|
||||
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException;
|
||||
@ -403,6 +401,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
if ($action == 'scan') {
|
||||
if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/webklex/php-imap/vendor/autoload.php';
|
||||
|
||||
if ($object->acces_type == 1) {
|
||||
// Mode OAUth2 with PHP-IMAP
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // define $supportedoauth2array
|
||||
@ -448,8 +448,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// We have to save the token because Google give it only once
|
||||
$refreshtoken = $tokenobj->getRefreshToken();
|
||||
|
||||
//var_dump($tokenobj);
|
||||
$tokenobj = $apiService->refreshAccessToken($tokenobj);
|
||||
try {
|
||||
$tokenobj = $apiService->refreshAccessToken($tokenobj);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception("Failed to refresh access token: ".$e->getMessage());
|
||||
}
|
||||
|
||||
$tokenobj->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj);
|
||||
@ -496,6 +501,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
'authentication' => "login",
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
try {
|
||||
// To emulate the command connect, you can run
|
||||
@ -569,7 +575,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
}
|
||||
|
||||
$morehtml = $form->textwithpicto($langs->trans("NbOfEmailsInInbox"), 'connect string '.$connectstringserver).': '.($morehtml ? $morehtml : '?');
|
||||
$morehtml = $form->textwithpicto($langs->trans("NbOfEmailsInInbox"), 'Connect string = '.$connectstringserver.'<br>Option MAIN_IMAP_USE_PHPIMAP = '.getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')).': '.($morehtml ? $morehtml : '?');
|
||||
$morehtml .= '<a class="flat paddingleft marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'<div class="refidno">'.$morehtml.'</div>', '', 0, '', '', 0, '');
|
||||
|
||||
@ -629,7 +629,7 @@ if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) { // Hidden conf
|
||||
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
|
||||
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
|
||||
);
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION)) {
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION')) {
|
||||
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 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
|
||||
@ -307,13 +307,7 @@ if (empty($reshook)) {
|
||||
$ok = 1;
|
||||
foreach ($listfield as $f => $value) {
|
||||
// Not mandatory fields
|
||||
if ($value == 'joinfiles') {
|
||||
continue;
|
||||
}
|
||||
if ($value == 'content') {
|
||||
continue;
|
||||
}
|
||||
if ($value == 'content_lines') {
|
||||
if (in_array($value, ['joinfiles', 'content', 'content_lines', 'module'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -974,7 +974,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
}
|
||||
|
||||
// Picto + Name of module
|
||||
print ' <td class="tdoverflowmax300" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
||||
print ' <td class="tdoverflowmax300 maxwidth300" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
||||
$alttext = '';
|
||||
//if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
|
||||
//if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
|
||||
|
||||
@ -176,7 +176,7 @@ if ($elemid && $action == 'addintocategory' &&
|
||||
($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) ||
|
||||
($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) ||
|
||||
($type == Categorie::TYPE_MEMBER && $user->rights->projet->creer) ||
|
||||
($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) ||
|
||||
($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_USER && $user->rights->user->user->creer) ||
|
||||
($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
|
||||
|
||||
@ -1469,7 +1469,7 @@ if ($action == 'create') {
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#projectid").change(function () {
|
||||
var url = "'.DOL_URL_ROOT.'/projet/ajax/projects.php?mode=gettasks&socid="+$("#projectid").val()+"&projectid="+$("#projectid").val();
|
||||
var url = "'.DOL_URL_ROOT.'/projet/ajax/projects.php?mode=gettasks&socid="+$("#search_socid").val()+"&projectid="+$("#projectid").val();
|
||||
console.log("Call url to get new list of tasks: "+url);
|
||||
$.get(url, function(data) {
|
||||
console.log(data);
|
||||
|
||||
@ -415,7 +415,7 @@ if ($usergroup > 0) {
|
||||
}
|
||||
$sql .= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,";
|
||||
$sql .= " a.id, a.code, a.label, a.note, a.datep as dp, a.datep2 as dp2, a.fulldayevent, a.location,";
|
||||
$sql .= ' a.fk_user_author,a.fk_user_action,';
|
||||
$sql .= " a.fk_user_author, a.fk_user_action,";
|
||||
$sql .= " a.fk_contact, a.note, a.percent as percent,";
|
||||
$sql .= " a.fk_element, a.elementtype, a.datec, a.tms as datem,";
|
||||
$sql .= " c.code as type_code, c.libelle as type_label, c.color as type_color, c.type as type_type, c.picto as type_picto,";
|
||||
@ -933,6 +933,7 @@ while ($i < $imaxinloop) {
|
||||
$actionstatic->note_private = dol_htmlentitiesbr($obj->note);
|
||||
$actionstatic->datep = $db->jdate($obj->dp);
|
||||
$actionstatic->percentage = $obj->percent;
|
||||
$actionstatic->authorid = $obj->fk_user_author;
|
||||
|
||||
// Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
|
||||
// but only if we need it
|
||||
|
||||
@ -1806,7 +1806,7 @@ if ($action == 'create') {
|
||||
//$warehouse_id = $soc->warehouse_id;
|
||||
} else {
|
||||
print '<td class="valuefieldcreate">';
|
||||
print img_picto('', 'company').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
@ -1829,7 +1829,7 @@ if ($action == 'create') {
|
||||
if ($socid > 0) {
|
||||
// Contacts (ask contact only if thirdparty already defined).
|
||||
print '<tr class="field_contactid"><td class="titlefieldcreate">'.$langs->trans("DefaultContact").'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'contact');
|
||||
print img_picto('', 'contact', 'class="pictofixedwidth"');
|
||||
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, '', '', 0, 'minwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1847,22 +1847,26 @@ if ($action == 'create') {
|
||||
|
||||
// Date
|
||||
print '<tr class="field_addprop"><td class="titlefieldcreate fieldrequired">'.$langs->trans('DatePropal').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate('', '', '', '', '', "addprop", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Validaty duration
|
||||
print '<tr class="field_duree_validitee"><td class="titlefieldcreate fieldrequired">'.$langs->trans("ValidityDuration").'</td><td class="valuefieldcreate">'.img_picto('', 'clock', 'class="paddingright"').'<input name="duree_validite" class="width50" value="'.(GETPOSTISSET('duree_validite') ? GETPOST('duree_validite', 'alphanohtml') : $conf->global->PROPALE_VALIDITY_DURATION).'"> '.$langs->trans("days").'</td></tr>';
|
||||
print '<tr class="field_duree_validitee"><td class="titlefieldcreate fieldrequired">'.$langs->trans("ValidityDuration").'</td><td class="valuefieldcreate">'.img_picto('', 'clock', 'class="pictofixedwidth"').'<input name="duree_validite" class="width50" value="'.(GETPOSTISSET('duree_validite') ? GETPOST('duree_validite', 'alphanohtml') : $conf->global->PROPALE_VALIDITY_DURATION).'"> '.$langs->trans("days").'</td></tr>';
|
||||
|
||||
// Terms of payment
|
||||
print '<tr class="field_cond_reglement_id"><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'paiment');
|
||||
print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
// at last resort we take the payment term id which may be filled by default values set (if not getpostisset)
|
||||
$paymentTermId = (GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : GETPOST('cond_reglement_id', 'int'));
|
||||
print $form->getSelectConditionsPaiements($paymentTermId, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode of payment
|
||||
print '<tr class="field_mode_reglement_id"><td class="titlefieldcreate">'.$langs->trans('PaymentMode').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
print $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') != 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
$paymentMethod = (GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') != 0) ? GETPOST('mode_reglement_id', 'int') : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : GETPOST('mode_reglement_id', 'int'));
|
||||
print $form->select_types_paiements($paymentMethod, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
@ -1894,7 +1898,7 @@ if ($action == 'create') {
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
}
|
||||
print '<tr class="field_shipping_method_id"><td class="titlefieldcreate">'.$langs->trans('SendingMethod').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"');
|
||||
print img_picto('', 'dolly', 'class="pictofixedwidth"');
|
||||
$form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1911,6 +1915,7 @@ if ($action == 'create') {
|
||||
// Delivery date (or manufacturing)
|
||||
print '<tr class="field_date_livraison"><td class="titlefieldcreate">'.$langs->trans("DeliveryDate").'</td>';
|
||||
print '<td class="valuefieldcreate">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
if (isset($conf->global->DATE_LIVRAISON_WEEK_DELAY) && is_numeric($conf->global->DATE_LIVRAISON_WEEK_DELAY)) {
|
||||
$tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
|
||||
$syear = date("Y", $tmpdte);
|
||||
@ -1938,6 +1943,7 @@ if ($action == 'create') {
|
||||
print '<tr class="field_incoterm_id">';
|
||||
print '<td class="titlefieldcreate"><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->label_incoterms, 1).'</label></td>';
|
||||
print '<td class="valuefieldcreate maxwidthonsmartphone">';
|
||||
print img_picto('', 'incoterm', 'class="pictofixedwidth"');
|
||||
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms) ? $soc->location_incoterms : ''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -246,13 +246,12 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
$sql .= " FROM ".$this->from." INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid";
|
||||
$sql .= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql .= " GROUP BY product.ref";
|
||||
$sql .= $this->db->order('nb', 'DESC');
|
||||
|
||||
@ -1785,7 +1785,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
print img_picto('', 'company').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
@ -1828,6 +1828,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
|
||||
// Date
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1835,6 +1836,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date);
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1);
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
@ -1867,7 +1869,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
// Shipping Method
|
||||
if (isModEnabled('expedition')) {
|
||||
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
|
||||
print img_picto('', 'object_dolly', 'class="pictofixedwidth"');
|
||||
print img_picto('', 'dolly', 'class="pictofixedwidth"');
|
||||
$form->selectShippingMethod((GETPOSTISSET('shipping_method_id')?GETPOST('shipping_method_id'):$shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1911,6 +1913,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
$incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms);
|
||||
$incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms);
|
||||
}
|
||||
print img_picto('', 'incoterm', 'class="pictofixedwidth"');
|
||||
print $form->select_incoterms($incoterm_id, $incoterm_location);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -3200,7 +3200,7 @@ if ($action == 'create') {
|
||||
} else {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print img_picto('', 'company').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
// Option to reload page to retrieve customer informations.
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
@ -3656,18 +3656,21 @@ if ($action == 'create') {
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($newdateinvoice ? $newdateinvoice : $dateinvoice, '', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date point of tax
|
||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -3724,7 +3727,7 @@ if ($action == 'create') {
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -3740,7 +3743,7 @@ if ($action == 'create') {
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -3756,6 +3759,7 @@ if ($action == 'create') {
|
||||
$incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms);
|
||||
$incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms);
|
||||
}
|
||||
print img_picto('', 'incoterm', 'class="pictofixedwidth"');
|
||||
print $form->select_incoterms($incoterm_id, $incoterm_location);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -6501,9 +6501,9 @@ class FactureLigne extends CommonInvoiceLine
|
||||
* Returns situation_percent of the previous line.
|
||||
* Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line.
|
||||
*
|
||||
* @param int $invoiceid Invoice id
|
||||
* @param int $invoiceid Invoice id
|
||||
* @param bool $include_credit_note Include credit note or not
|
||||
* @return int >= 0
|
||||
* @return int >= 0
|
||||
*/
|
||||
public function get_prev_progress($invoiceid, $include_credit_note = true)
|
||||
{
|
||||
|
||||
@ -141,8 +141,23 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Make payment with Direct Debit Stripe
|
||||
if ($action == 'sepastripepayment' && $usercancreate) {
|
||||
if ($action == 'sepastripedirectdebit' && $usercancreate) {
|
||||
$result = $object->makeStripeSepaRequest($user, GETPOST('did', 'int'), 'direct-debit', 'facture');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
// We refresh object data
|
||||
$ret = $object->fetch($id, $ref);
|
||||
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
||||
if ($ret > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make payment with Direct Debit Stripe
|
||||
if ($action == 'sepastripecredittransfer' && $usercancreate) {
|
||||
$result = $object->makeStripeSepaRequest($user, GETPOST('did', 'int'), 'bank-transfer', 'supplier_invoice');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
@ -886,12 +901,22 @@ if ($object->id > 0) {
|
||||
print $withdrawreceipt->getNomUrl(1);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
$langs->load("stripe");
|
||||
if ($obj->fk_prelevement_bons > 0) {
|
||||
print ' ';
|
||||
if ($type != 'bank-transfer') {
|
||||
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
$langs->load("stripe");
|
||||
if ($obj->fk_prelevement_bons > 0) {
|
||||
print ' ';
|
||||
}
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=sepastripedirectdebit&paymentservice=stripesepa&token='.newToken().'&did='.$obj->rowid.'&id='.$object->id.'&type='.urlencode($type).'">'.img_picto('', 'stripe', 'class="pictofixedwidth"').$langs->trans("RequestDirectDebitWithStripe").'</a>';
|
||||
}
|
||||
} else {
|
||||
if (!empty($conf->global->STRIPE_SEPA_CREDIT_TRANSFER)) {
|
||||
$langs->load("stripe");
|
||||
if ($obj->fk_prelevement_bons > 0) {
|
||||
print ' ';
|
||||
}
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=sepastripecredittransfer&paymentservice=stripesepa&token='.newToken().'&did='.$obj->rowid.'&id='.$object->id.'&type='.urlencode($type).'">'.img_picto('', 'stripe', 'class="pictofixedwidth"').$langs->trans("RequestDirectDebitWithStripe").'</a>';
|
||||
}
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=sepastripepayment&paymentservice=stripesepa&token='.newToken().'&did='.$obj->rowid.'&id='.$object->id.'&type='.urlencode($type).'">'.img_picto('', 'stripe', 'class="pictofixedwidth"').$langs->trans("RequestDirectDebitWithStripe").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -275,9 +275,8 @@ class Paiement extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
if (empty($currencyofpayment)) {
|
||||
$currencyofpayment = $this->multicurrency_code[$key];
|
||||
}
|
||||
if ($currencyofpayment != $this->multicurrency_code[$key]) {
|
||||
$currencyofpayment = isset($this->multicurrency_code[$key]) ? $this->multicurrency_code[$key] : "";
|
||||
} elseif ($currencyofpayment != $this->multicurrency_code[$key]) {
|
||||
// If we have invoices with different currencies in the payment, we stop here
|
||||
$this->error = 'ErrorYouTryToPayInvoicesWithDifferentCurrenciesInSamePayment';
|
||||
return -1;
|
||||
|
||||
@ -697,7 +697,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
print '<tr><td><label for="socid">'.$langs->trans("ThirdParty").'</label></td><td colspan="3" class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'company').$form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@ -749,7 +749,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Country
|
||||
print '<tr><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
|
||||
print img_picto('', 'globe-americas', 'class="pictofixedwidth"');
|
||||
print $form->select_country((GETPOST("country_id", 'alpha') ? GETPOST("country_id", 'alpha') : $object->country_id), 'country_id');
|
||||
if ($user->admin) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
@ -783,26 +783,26 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Phone / Fax
|
||||
print '<tr><td>'.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'object_phoning');
|
||||
print img_picto('', 'object_phoning', 'class="pictofixedwidth"');
|
||||
print '<input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" value="'.(GETPOSTISSET('phone_pro') ? GETPOST('phone_pro', 'alpha') : $object->phone_pro).'"></td>';
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
print '</tr><tr>';
|
||||
}
|
||||
print '<td>'.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'object_phoning');
|
||||
print img_picto('', 'object_phoning', 'class="pictofixedwidth"');
|
||||
print '<input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" value="'.(GETPOSTISSET('phone_perso') ? GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'object_phoning_mobile');
|
||||
print img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"');
|
||||
print '<input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td>';
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
print '</tr><tr>';
|
||||
}
|
||||
print '<td>'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'object_phoning_fax');
|
||||
print img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"');
|
||||
print '<input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ? GETPOST('fax', 'alpha') : $object->fax).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -813,7 +813,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Email
|
||||
print '<tr><td>'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'object_email');
|
||||
print img_picto('', 'object_email', 'class="pictofixedwidth"');
|
||||
print '<input type="text" name="email" id="email" value="'.(GETPOSTISSET('email') ? GETPOST('email', 'alpha') : $object->email).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -869,7 +869,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
print '<tr><td>'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).'</td><td colspan="3">';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1);
|
||||
print img_picto('', 'category').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%');
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
@ -1166,7 +1166,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print img_picto('', 'category').$form->multiselectarray('contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%');
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@ -1209,6 +1209,7 @@ if ($action == 'create') {
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td>';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($datecontrat, '', 0, 0, '', "contrat");
|
||||
print "</td></tr>";
|
||||
|
||||
@ -1219,6 +1220,7 @@ if ($action == 'create') {
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"');
|
||||
$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, "projectid", 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print "</td></tr>";
|
||||
|
||||
@ -877,8 +877,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Create a payment order for a prelevement_demande
|
||||
* Then send the payment order to Stripe (for a direct debit order or a credit transfer order).
|
||||
* Create a payment order into prelevement_demande then send the payment order to Stripe (for a direct debit order or a credit transfer order).
|
||||
*
|
||||
* @param User $fuser User asking the direct debit transfer
|
||||
* @param int $did ID of unitary payment request to pay
|
||||
@ -890,8 +889,10 @@ abstract class CommonInvoice extends CommonObject
|
||||
{
|
||||
global $conf, $mysoc, $user, $langs;
|
||||
|
||||
if (empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
//exit
|
||||
if ($type != 'bank-transfer' && empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
return 0;
|
||||
}
|
||||
if ($type != 'direct-debit' && empty($conf->global->STRIPE_SEPA_CREDIT_TRANSFER)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -915,7 +916,12 @@ abstract class CommonInvoice extends CommonObject
|
||||
$sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_prelevement_bons";
|
||||
$sql .= " FROM ".$this->db->prefix()."prelevement_demande";
|
||||
$sql .= " WHERE rowid = ".((int) $did);
|
||||
$sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one
|
||||
if ($type != 'direct-debit') {
|
||||
$sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one
|
||||
}
|
||||
if ($type != 'credit-transfer') {
|
||||
$sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one
|
||||
}
|
||||
$sql .= " AND traite = 0"; // Add a protection to not process twice
|
||||
|
||||
dol_syslog(get_class($this)."::makeStripeSepaRequest load requests to process", LOG_DEBUG);
|
||||
@ -936,7 +942,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$companypaymentmode->fetch($bac->id);
|
||||
|
||||
// Start code for Stripe
|
||||
// TODO This must come from a parameter ? or the method may not work as expected when used from a batch ?
|
||||
// TODO We may have this coming as a parameter from the caller.
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
|
||||
@ -974,7 +980,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$amountstripe = $amountstripe * 100;
|
||||
}
|
||||
|
||||
$fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS');
|
||||
$fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'); // Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr.
|
||||
if (!($fk_bank_account > 0)) {
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
@ -989,7 +995,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
if (!$error) {
|
||||
if (empty($obj->fk_prelevement_bons)) {
|
||||
// This create record into llx_prelevment_bons and update link with llx_prelevement_demande
|
||||
$nbinvoices = $bon->create(0, 0, 'real', 'ALL', '', 0, 'direct-debit', $did, $fk_bank_account);
|
||||
$nbinvoices = $bon->create(0, 0, 'real', 'ALL', '', 0, $type, $did, $fk_bank_account);
|
||||
if ($nbinvoices <= 0) {
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
@ -1052,14 +1058,15 @@ abstract class CommonInvoice extends CommonObject
|
||||
|
||||
if ($resultthirdparty > 0 && !empty($customer)) {
|
||||
if (!$error) { // Payment was not canceled
|
||||
$sepaMode = false;
|
||||
$stripecard = null;
|
||||
if ($companypaymentmode->type == 'ban') {
|
||||
$sepaMode = true;
|
||||
// Check into societe_rib if a payment mode for Stripe and ban payment exists
|
||||
// To make a Stripe SEPA payment request, we must have the payment mode source already saved into societe_rib and retreived with ->sepaStripe
|
||||
// The payment mode source is created when we create the bank account on Stripe with paymentmodes.php?action=create
|
||||
$stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = 'The payment mode type is not "ban"';
|
||||
}
|
||||
|
||||
if ($stripecard) { // Can be src_... (for sepa) or pm_... (new card mode). Note that card_... (old card mode) should not happen here.
|
||||
@ -1153,9 +1160,9 @@ abstract class CommonInvoice extends CommonObject
|
||||
$postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
$this->errors[] = $errmsg;
|
||||
} else {
|
||||
dol_syslog('Successfuly request direct debit ' . $stripecard->id);
|
||||
dol_syslog('Successfuly request '.$type.' '.$stripecard->id);
|
||||
|
||||
$postactionmessages[] = 'Success to request direct debit (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
$postactionmessages[] = 'Success to request '.$type.' (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
|
||||
// Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments
|
||||
// even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit.
|
||||
@ -1180,12 +1187,12 @@ abstract class CommonInvoice extends CommonObject
|
||||
} else {
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
dol_syslog("No direct debit payment method found for this stripe customer " . $customer->id, LOG_WARNING);
|
||||
dol_syslog("No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING);
|
||||
$this->errors[] = 'Failed to get direct debit payment method for stripe customer = ' . $customer->id;
|
||||
|
||||
$description = 'Failed to find or use the payment mode - no credit card defined for the customer account';
|
||||
$description = 'Failed to find or use the payment mode - no ban defined for the thirdparty account';
|
||||
$stripefailurecode = 'BADPAYMENTMODE';
|
||||
$stripefailuremessage = 'Failed to find or use the payment mode - no credit card defined for the customer account';
|
||||
$stripefailuremessage = 'Failed to find or use the payment mode - no ban defined for the thirdparty account';
|
||||
$postactionmessages[] = $description . ' (' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
|
||||
$object = $this;
|
||||
@ -1207,10 +1214,10 @@ abstract class CommonInvoice extends CommonObject
|
||||
} else { // Else of the if ($resultthirdparty > 0 && ! empty($customer)) {
|
||||
if ($resultthirdparty <= 0) {
|
||||
dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING);
|
||||
$this->errors[] = 'Failed to load customer for thirdparty_id = ' . $thirdparty->id;
|
||||
$this->errors[] = 'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id;
|
||||
} else { // $customer stripe not found
|
||||
dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING);
|
||||
$this->errors[] = 'Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'];
|
||||
$this->errors[] = 'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'];
|
||||
}
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
|
||||
@ -4171,7 +4171,7 @@ class Form
|
||||
public function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '', $deposit_percent = -1)
|
||||
{
|
||||
// phpcs:enable
|
||||
print $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, $noinfoadmin, $morecss, $deposit_percent = -1);
|
||||
print $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, $noinfoadmin, $morecss, $deposit_percent);
|
||||
}
|
||||
|
||||
|
||||
@ -8992,6 +8992,12 @@ class Form
|
||||
);
|
||||
}
|
||||
|
||||
if ($object->table_element == 'commande_fournisseur') {
|
||||
$possiblelinks['mo']['sql'] = "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix().'mrp_mo as t ON t.fk_soc = s.rowid WHERE t.entity IN ('.getEntity('mo').')';
|
||||
} elseif ($object->table_element == 'mrp_mo') {
|
||||
$possiblelinks['order_supplier']['sql'] = "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix().'commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.entity IN ('.getEntity('commande_fournisseur').')';
|
||||
}
|
||||
|
||||
if (!empty($listofidcompanytoscan)) { // If empty, we don't have criteria to scan the object we can link to
|
||||
// Can complete the possiblelink array
|
||||
$hookmanager->initHooks(array('commonobject'));
|
||||
|
||||
@ -1277,7 +1277,7 @@ class FormTicket
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('other', 'mails'));
|
||||
$langs->loadLangs(array('other', 'mails', 'ticket'));
|
||||
|
||||
// Clear temp files. Must be done at beginning, before call of triggers
|
||||
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
|
||||
@ -1467,11 +1467,13 @@ class FormTicket
|
||||
print '</td></tr>';
|
||||
|
||||
// Recipients / adressed-to
|
||||
print '<tr class="email_line"><td>'.$langs->trans('MailRecipients').'</td><td>';
|
||||
print '<tr class="email_line"><td>'.$langs->trans('MailRecipients');
|
||||
print ' '.$form->textwithpicto('', $langs->trans("TicketMessageRecipientsHelp"), 1, 'help');
|
||||
print '</td><td>';
|
||||
if ($res) {
|
||||
// Retrieve email of all contacts (internal and external)
|
||||
$contacts = $ticketstat->getInfosTicketInternalContact();
|
||||
$contacts = array_merge($contacts, $ticketstat->getInfosTicketExternalContact());
|
||||
$contacts = $ticketstat->getInfosTicketInternalContact(1);
|
||||
$contacts = array_merge($contacts, $ticketstat->getInfosTicketExternalContact(1));
|
||||
|
||||
$sendto = array();
|
||||
|
||||
|
||||
@ -1125,6 +1125,7 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$regs = array();
|
||||
preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?'
|
||||
if (!empty($regs[1])) {
|
||||
//print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'<br>'."\n";
|
||||
|
||||
@ -250,7 +250,9 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$urltouse = DOL_MAIN_URL_ROOT;
|
||||
$urltouse = DOL_MAIN_URL_ROOT; // Should be "https://www.mydomain.com/mydolibarr" for example
|
||||
//dol_syslog("getOnlinePaymentUrl DOL_MAIN_URL_ROOT=".DOL_MAIN_URL_ROOT);
|
||||
|
||||
if ($localorexternal) {
|
||||
$urltouse = $urlwithroot;
|
||||
}
|
||||
|
||||
@ -1683,7 +1683,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
|
||||
// Multi journal
|
||||
$sql = "SELECT rowid, code, label, nature";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$sql .= " WHERE entity = ".((int) $conf->entity);
|
||||
$sql .= " AND active = 1";
|
||||
$sql .= " ORDER BY nature ASC, label DESC";
|
||||
|
||||
@ -1734,11 +1734,12 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
|
||||
$langs->load('accountancy');
|
||||
$journallabel = '';
|
||||
if ($objp->label) {
|
||||
$journallabelwithoutspan = $langs->transnoentities($objp->label);
|
||||
$journallabel = '<span class="opacitymedium">('.$langs->transnoentities($objp->label).')</span>'; // Label of bank account in llx_accounting_journal
|
||||
}
|
||||
|
||||
$key = $langs->trans("AccountingJournalType".strtoupper($objp->nature));
|
||||
$transferlabel = ($objp->nature && $key != "AccountingJournalType".strtoupper($langs->trans($objp->nature)) ? $key.($journallabel != $key ? ' '.$journallabel : ''): $journallabel);
|
||||
$key = $langs->trans("AccountingJournalType".$objp->nature); // $objp->nature is 1, 2, 3 ...
|
||||
$transferlabel = (($objp->nature && $key != "AccountingJournalType".$objp->nature) ? $key.($journallabelwithoutspan != $key ? ' '.$journallabel : ''): $journallabel);
|
||||
|
||||
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $transferlabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
|
||||
}
|
||||
|
||||
@ -44,9 +44,6 @@ require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php'; // Holidays (leave request)
|
||||
|
||||
|
||||
// use Webklex\PHPIMAP;
|
||||
require DOL_DOCUMENT_ROOT .'/includes/webklex/php-imap/vendor/autoload.php';
|
||||
|
||||
use Webklex\PHPIMAP\ClientManager;
|
||||
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
|
||||
use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException;
|
||||
@ -1040,6 +1037,9 @@ class EmailCollector extends CommonObject
|
||||
//$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/webklex/php-imap/vendor/autoload.php';
|
||||
}
|
||||
|
||||
dol_syslog("EmailCollector::doCollectOneCollector start for id=".$this->id." - ".$this->ref, LOG_DEBUG);
|
||||
|
||||
|
||||
@ -47,7 +47,8 @@ $cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothattendeecard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||
//$lineid = GETPOST('lineid', 'int');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
$conf_or_booth_id = GETPOST('conforboothid', 'int');
|
||||
$fk_project = GETPOST('fk_project', 'int');
|
||||
@ -233,7 +234,7 @@ if (!empty($withproject)) {
|
||||
// Title
|
||||
$morehtmlref .= $projectstatic->title;
|
||||
// Thirdparty
|
||||
if ($projectstatic->thirdparty->id > 0) {
|
||||
if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
|
||||
$morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
@ -384,7 +385,7 @@ if (!empty($withproject)) {
|
||||
//print '</span>';
|
||||
print '</td><td>';
|
||||
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
|
||||
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
|
||||
$encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.$projectstatic->id, 'md5');
|
||||
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
|
||||
//print '<div class="urllink">';
|
||||
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
|
||||
@ -401,7 +402,7 @@ if (!empty($withproject)) {
|
||||
//print '</span>';
|
||||
print '</td><td>';
|
||||
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.$projectstatic->id.'&type=global';
|
||||
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
|
||||
$encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.$projectstatic->id, 'md5');
|
||||
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
|
||||
//print '<div class="urllink">';
|
||||
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
|
||||
@ -563,7 +564,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1'.($confOrBooth->id > 0 ? '&conforboothid='.((int) $confOrBooth->id) : '').$moreparam.'">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1'.(!empty($confOrBooth->id) && $confOrBooth->id > 0 ? '&conforboothid='.((int) $confOrBooth->id) : '').$moreparam.'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
|
||||
@ -610,7 +611,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit&token='.newToken(), '', $permissiontoadd);
|
||||
|
||||
// Clone
|
||||
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:''), '', $permissiontoadd);
|
||||
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken().(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:''), '', $permissiontoadd);
|
||||
|
||||
// Delete (need delete permission, or if draft, just need create/modify permission)
|
||||
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:''), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
|
||||
|
||||
@ -57,6 +57,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selec
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothattendeelist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$conf_or_booth_id = GETPOST('conforboothid', 'int');
|
||||
@ -239,11 +240,6 @@ $now = dol_now();
|
||||
|
||||
//$help_url="EN:Module_ConferenceOrBoothAttendee|FR:Module_ConferenceOrBoothAttendee_FR|ES:Módulo_ConferenceOrBoothAttendee";
|
||||
$help_url = '';
|
||||
if ($confOrBooth->id > 0) {
|
||||
$title = $langs->trans('ListOfAttendeesPerConference');
|
||||
} else {
|
||||
$title = $langs->trans('ListOfAttendeesOfEvent');
|
||||
}
|
||||
$morejs = array();
|
||||
$morecss = array();
|
||||
|
||||
@ -377,7 +373,11 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if ($confOrBooth->id > 0) {
|
||||
$title = $langs->trans('ListOfAttendeesPerConference');
|
||||
} else {
|
||||
$title = $langs->trans('ListOfAttendeesOfEvent');
|
||||
}
|
||||
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
|
||||
|
||||
@ -412,7 +412,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
|
||||
// Title
|
||||
$morehtmlref .= $projectstatic->title;
|
||||
// Thirdparty
|
||||
if ($projectstatic->thirdparty->id > 0) {
|
||||
if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
|
||||
$morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
@ -591,7 +591,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
|
||||
//print '</span>';
|
||||
print '</td><td>';
|
||||
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
|
||||
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
|
||||
$encodedsecurekey = dol_hash(getDolUserString("EVENTORGANIZATION_SECUREKEYEVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.$projectstatic->id, 'md5');
|
||||
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
|
||||
//print '<div class="urllink">';
|
||||
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
|
||||
@ -608,7 +608,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
|
||||
//print '</span>';
|
||||
print '</td><td>';
|
||||
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.$projectstatic->id.'&type=global';
|
||||
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
|
||||
$encodedsecurekey = dol_hash(getDolUserString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.$projectstatic->id, 'md5');
|
||||
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
|
||||
//print '<div class="urllink">';
|
||||
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
|
||||
@ -630,7 +630,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
|
||||
if (empty($confOrBooth->id)) {
|
||||
$head = conferenceorboothProjectPrepareHead($projectstatic);
|
||||
$tab = 'attendees';
|
||||
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', 'reposition');
|
||||
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, (!empty($project->public) ? 'projectpub' : 'project'), 0, '', 'reposition');
|
||||
}
|
||||
}
|
||||
|
||||
@ -797,11 +797,11 @@ foreach ($object->fields as $key => $val) {
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.(isset($search[$key]) ? dol_escape_htmltag($search[$key]) : "").'">';
|
||||
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
@ -872,6 +872,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
@ -880,7 +881,6 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
|
||||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
|
||||
@ -944,7 +944,7 @@ if ($action == 'create') {
|
||||
$langs->load("projects");
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Project").'</td><td colspan="2">';
|
||||
print img_picto('', 'project');
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"');
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
|
||||
print ' <a class="paddingleft" href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
print '</td>';
|
||||
@ -954,6 +954,7 @@ if ($action == 'create') {
|
||||
// Date delivery planned
|
||||
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
$date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST
|
||||
print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1);
|
||||
print "</td>\n";
|
||||
@ -978,7 +979,9 @@ if ($action == 'create') {
|
||||
// Weight
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Weight");
|
||||
print '</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST('weight', 'int').'"> ';
|
||||
print '</td><td colspan="3">';
|
||||
print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"');
|
||||
print '<input name="weight" size="4" value="'.GETPOST('weight', 'int').'"> ';
|
||||
$text = $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOST('weight_units', 'int'), 0, 2);
|
||||
$htmltext = $langs->trans("KeepEmptyForAutoCalculation");
|
||||
print $form->textwithpicto($text, $htmltext);
|
||||
@ -986,7 +989,9 @@ if ($action == 'create') {
|
||||
// Dim
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Width").' x '.$langs->trans("Height").' x '.$langs->trans("Depth");
|
||||
print ' </td><td colspan="3"><input name="sizeW" size="4" value="'.GETPOST('sizeW', 'int').'">';
|
||||
print ' </td><td colspan="3">';
|
||||
print img_picto('', 'fa-ruler', 'class="pictofixedwidth"');
|
||||
print '<input name="sizeW" size="4" value="'.GETPOST('sizeW', 'int').'">';
|
||||
print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH', 'int').'">';
|
||||
print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS', 'int').'">';
|
||||
print ' ';
|
||||
@ -999,6 +1004,7 @@ if ($action == 'create') {
|
||||
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
|
||||
print '<td colspan="3">';
|
||||
$expe->fetch_delivery_methods();
|
||||
print img_picto('', 'dolly', 'class="pictofixedwidth"');
|
||||
print $form->selectarray("shipping_method_id", $expe->meths, GETPOST('shipping_method_id', 'int'), 1, 0, 0, "", 1);
|
||||
if ($user->admin) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
@ -1008,6 +1014,7 @@ if ($action == 'create') {
|
||||
// Tracking number
|
||||
print "<tr><td>".$langs->trans("TrackingNumber")."</td>";
|
||||
print '<td colspan="3">';
|
||||
print img_picto('', 'barcode', 'class="pictofixedwidth"');
|
||||
print '<input name="tracking_number" size="20" value="'.GETPOST('tracking_number', 'alpha').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
@ -1030,6 +1037,7 @@ if ($action == 'create') {
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $object->label_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'incoterm', 'class="pictofixedwidth"');
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1040,6 +1048,7 @@ if ($action == 'create') {
|
||||
if (count($list) > 1) {
|
||||
print "<tr><td>".$langs->trans("DefaultModel")."</td>";
|
||||
print '<td colspan="3">';
|
||||
print img_picto('', 'pdf', 'class="pictofixedwidth"');
|
||||
print $form->selectarray('model', $list, $conf->global->EXPEDITION_ADDON_PDF);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
@ -2566,8 +2566,8 @@ if ($action == 'create') {
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
//var_dump($object);
|
||||
print '<script javascript>
|
||||
|
||||
print '<script>
|
||||
|
||||
/* JQuery for product free or predefined select */
|
||||
jQuery(document).ready(function() {
|
||||
@ -2583,6 +2583,10 @@ if ($action == 'create') {
|
||||
jQuery("#value_unit_ht").val("");
|
||||
}
|
||||
});
|
||||
';
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
||||
print '
|
||||
|
||||
/* unit price coéf calculation */
|
||||
jQuery(".input_qty, #fk_c_type_fees, #select_fk_c_exp_tax_cat, #vatrate ").change(function(event) {
|
||||
@ -2628,6 +2632,10 @@ if ($action == 'create') {
|
||||
jQuery("#value_unit_ht").val("");
|
||||
}*/
|
||||
});
|
||||
';
|
||||
}
|
||||
|
||||
print '
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -1693,7 +1693,7 @@ if ($action == 'create') {
|
||||
print $societe->getNomUrl(1, 'supplier');
|
||||
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
||||
} else {
|
||||
print img_picto('', 'company').$form->select_company((empty($socid) ? '' : $socid), 'socid', '(s.fournisseur=1 AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company((empty($socid) ? '' : $socid), 'socid', '(s.fournisseur=1 AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE_DISABLED)) {
|
||||
print '<script>
|
||||
@ -1730,11 +1730,13 @@ if ($action == 'create') {
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
$form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1747,6 +1749,7 @@ if ($action == 'create') {
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) {
|
||||
$usehourmin = 1;
|
||||
}
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($datelivraison ? $datelivraison : -1, 'liv_', $usehourmin, $usehourmin, '', "set");
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1754,7 +1757,7 @@ if ($action == 'create') {
|
||||
if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && isModEnabled("banque")) {
|
||||
$langs->load("bank");
|
||||
print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
|
||||
print img_picto('', 'bank_account', 'class="paddingrightonly"');
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1765,7 +1768,7 @@ if ($action == 'create') {
|
||||
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
||||
print img_picto('', 'project').$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?action=create&status=1'.(!empty($societe->id) ? '&socid='.$societe->id : "").'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create'.(!empty($societe->id) ? '&socid='.$societe->id : "")).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1777,6 +1780,7 @@ if ($action == 'create') {
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $object->label_incoterms, 1).'</label></td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'incoterm', 'class="pictofixedwidth"');
|
||||
print $form->select_incoterms($fkincoterms, $locincoterms);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1786,6 +1790,7 @@ if ($action == 'create') {
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'currency', 'class="pictofixedwidth"');
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
@ -756,8 +756,8 @@ if (empty($reshook)) {
|
||||
$object->date_echeance = $datedue;
|
||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
@ -885,8 +885,12 @@ if (empty($reshook)) {
|
||||
$totalcreditnotes = $facture_source->getSumCreditNotesUsed();
|
||||
$totaldeposits = $facture_source->getSumDepositsUsed();
|
||||
$remain_to_pay = abs($facture_source->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits);
|
||||
$desc = $langs->trans('invoiceAvoirLineWithPaymentRestAmount');
|
||||
$retAddLine = $object->addline($desc, $remain_to_pay, 0, 0, 0, 1, 0, 0, '', '', 0, '', 'TTC');
|
||||
|
||||
$object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), $remain_to_pay, 0, 0, 0, 1, 0, 0, '', '', 'TTC');
|
||||
if ($retAddLine < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2175,7 +2179,7 @@ if ($action == 'create') {
|
||||
print $societe->getNomUrl(1, 'supplier');
|
||||
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
||||
} else {
|
||||
print img_picto('', 'company').$form->select_company(empty($societe->id) ? 0 : $societe->id, 'socid', '(s.fournisseur = 1 AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 widthcentpercentminusxx maxwidth500');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(empty($societe->id) ? 0 : $societe->id, 'socid', '(s.fournisseur = 1 AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 widthcentpercentminusxx maxwidth500');
|
||||
// reload page to retrieve supplier informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
@ -2517,16 +2521,19 @@ if ($action == 'create') {
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td>';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($dateinvoice, '', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ?GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
// Due date
|
||||
print '<tr><td>'.$langs->trans('DateMaxPayment').'</td><td>';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate($datedue, 'ech', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -2559,6 +2566,7 @@ if ($action == 'create') {
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->label_incoterms) ? $objectsrc->label_incoterms : '', 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'incoterm', 'class="pictofixedwidth"');
|
||||
print $form->select_incoterms(GETPOSTISSET('incoterm_id') ? GETPOST('incoterm_id', 'alphanohtml') : (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), GETPOSTISSET('location_incoterms') ? GETPOST('location_incoterms', 'alphanohtml') : (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : ''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -2568,6 +2576,7 @@ if ($action == 'create') {
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'currency', 'class="pictofixedwidth"');
|
||||
print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ?GETPOST('multicurrency_code', 'alpha') : $currency_code), 'multicurrency_code');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ global $permissiontoadd;
|
||||
if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlines') {
|
||||
$situationinvoicelinewithparent = 0;
|
||||
if ($line->fk_prev_id != null && in_array($object->element, array('facture', 'facturedet'))) {
|
||||
if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice
|
||||
if (!empty($object->situation_cycle_ref)) {
|
||||
// Set constant to disallow editing during a situation cycle
|
||||
$situationinvoicelinewithparent = 1;
|
||||
}
|
||||
|
||||
@ -26,13 +26,13 @@ if (!function_exists('preg_last_error_msg')) {
|
||||
function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
|
||||
}
|
||||
if (!function_exists('str_contains')) {
|
||||
function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
|
||||
function str_contains($haystack, $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
|
||||
}
|
||||
if (!function_exists('str_starts_with')) {
|
||||
function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
|
||||
function str_starts_with($haystack, $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
|
||||
}
|
||||
if (!function_exists('str_ends_with')) {
|
||||
function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
|
||||
function str_ends_with($haystack, $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
|
||||
}
|
||||
if (!function_exists('get_debug_type')) {
|
||||
function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
|
||||
|
||||
@ -446,7 +446,7 @@ NoJournalDefined=No journal defined
|
||||
Binded=Lines bound
|
||||
ToBind=Lines to bind
|
||||
UseMenuToSetBindindManualy=Lines not yet bound, use menu <a href="%s">%s</a> to make the binding manually
|
||||
SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices=Sorry this module is not compatible with the experimental feature of situation invoices
|
||||
SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices=Note: this module or page is not completely compatible with the experimental feature of situation invoices. Some data may be wrong.
|
||||
AccountancyErrorMismatchLetterCode=Mismatch in reconcile code
|
||||
AccountancyErrorMismatchBalanceAmount=The balance (%s) is not equal to 0
|
||||
AccountancyErrorLetteringBookkeeping=Errors have occurred concerning the transactions: %s
|
||||
|
||||
@ -247,6 +247,7 @@ TicketAssignedEmailBody=You have been assigned the ticket #%s by %s
|
||||
MarkMessageAsPrivate=Mark message as private
|
||||
TicketMessageSendEmailHelp=An email will be sent to all assigned contact (internal contacts, but also external contacts except if the option "%s" is checked)
|
||||
TicketMessagePrivateHelp=This message will not display to external users
|
||||
TicketMessageRecipientsHelp=Recipient field completed with active contacts linked to the ticket
|
||||
TicketEmailOriginIssuer=Issuer at origin of the tickets
|
||||
InitialMessage=Initial Message
|
||||
LinkToAContract=Link to a contract
|
||||
|
||||
@ -162,7 +162,7 @@ $TCats = $form->select_all_categories('product', array(), '', 64, 0, 1);
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans('Category').'</td>';
|
||||
print '<td class="maxwidthonsmartphone" colspan="4">';
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $TCats, $TSelectedCats, 0, 0, 'quatrevingtpercent widthcentpercentminusx');
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $TCats, $TSelectedCats, 0, 0, 'quatrevingtpercent widthcentpercentminusx');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ $TCats = $form->select_all_categories('product', array(), '', 64, 0, 1);
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans('Category').'</td>';
|
||||
print '<td class="maxwidthonsmartphone" colspan="4">';
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $TCats, $TSelectedCats, 0, 0, 'quatrevingtpercent widthcentpercentminusx');
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $TCats, $TSelectedCats, 0, 0, 'quatrevingtpercent widthcentpercentminusx');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -1445,6 +1445,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) {
|
||||
$tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type);
|
||||
}
|
||||
print img_picto('', 'barcode', 'class="pictofixedwidth"');
|
||||
print '<input class="maxwidth100" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1504,6 +1505,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Duration
|
||||
if ($type == 1) {
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td>';
|
||||
print img_picto('', 'clock', 'class="pictofixedwidth"');
|
||||
print '<input name="duration_value" size="4" value="'.GETPOST('duration_value', 'int').'">';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOST('duration_value', 'alpha') : 'h'), 0, 1);
|
||||
|
||||
@ -1531,6 +1533,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) {
|
||||
// Brut Weight
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||
print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"');
|
||||
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
|
||||
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
|
||||
print '</td></tr>';
|
||||
@ -1539,6 +1542,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Brut Length
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
||||
print '<tr><td>'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").'</td><td>';
|
||||
print img_picto('', 'fa-ruler', 'class="pictofixedwidth"');
|
||||
print '<input name="size" class="width50" value="'.GETPOST('size').'"> x ';
|
||||
print '<input name="sizewidth" class="width50" value="'.GETPOST('sizewidth').'"> x ';
|
||||
print '<input name="sizeheight" class="width50" value="'.GETPOST('sizeheight').'">';
|
||||
@ -1584,7 +1588,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Origin country
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
|
||||
print img_picto('', 'globe-americas', 'class="pictofixedwidth"');
|
||||
print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx maxwidth500');
|
||||
if ($user->admin) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
@ -1636,7 +1640,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Categories
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
@ -2200,7 +2204,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$arrayselected[] = $cat;
|
||||
}
|
||||
}
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@ -383,7 +383,7 @@ if ($action == 'create') {
|
||||
// Categories
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print "</td></tr>";
|
||||
}
|
||||
print '</table>';
|
||||
@ -945,7 +945,7 @@ if ($action == 'create') {
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@ -816,7 +816,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1);
|
||||
$arrayselected = GETPOST('categories', 'array');
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
@ -1196,7 +1196,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, '0');
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, '0');
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@ -793,7 +793,7 @@ foreach ($listofreferent as $key => $value) {
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
$tmp = explode('_', $elementarray[$i]);
|
||||
$idofelement = $tmp[0];
|
||||
$idofelementuser = $tmp[1];
|
||||
$idofelementuser = !empty($tmp[1]) ? $tmp[1] : "";
|
||||
|
||||
$element->fetch($idofelement);
|
||||
if ($idofelementuser) {
|
||||
|
||||
@ -755,7 +755,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
||||
|
||||
// Project
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ChildOfProjectTask").'</td><td>';
|
||||
print img_picto('', 'project');
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"');
|
||||
if ($projectoktoentertime) {
|
||||
$formother->selectProjectTasks(GETPOST('task_parent'), empty($projectid) ? $object->id : $projectid, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500 widthcentpercentminusxx');
|
||||
} else {
|
||||
@ -767,6 +767,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
||||
|
||||
// Assigned to
|
||||
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
|
||||
print img_picto('', 'user', 'class="pictofixedwidth"');
|
||||
if (is_array($contactsofproject) && count($contactsofproject)) {
|
||||
print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
} else {
|
||||
@ -780,21 +781,25 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
||||
|
||||
// Date start task
|
||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate((!empty($date_start) ? $date_start : ''), 'dateo', 1, 1, 0, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end task
|
||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
print $form->selectDate((!empty($date_end) ? $date_end : -1), 'datee', -1, 1, 0, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Planned workload
|
||||
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
|
||||
print img_picto('', 'clock', 'class="pictofixedwidth"');
|
||||
print $form->select_duration('planned_workload', !empty($planned_workload) ? $planned_workload : 0, 0, 'text');
|
||||
print '</td></tr>';
|
||||
|
||||
// Progress
|
||||
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
|
||||
print img_picto('', 'fa-percent', 'class="pictofixedwidth"');
|
||||
print $formother->select_percent($progress, 'progress', 0, 5, 0, 100, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -814,8 +819,9 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Budget").'</td>';
|
||||
print '<td><input size="5" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOSTISSET('budget_amount') ? GETPOST('budget_amount') : '').'"></td>';
|
||||
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
||||
print img_picto('', 'currency', 'class="pictofixedwidth"');
|
||||
print '<input size="8" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOSTISSET('budget_amount') ? GETPOST('budget_amount') : '').'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Other options
|
||||
|
||||
@ -46,6 +46,7 @@ $taskref = GETPOST("taskref", 'alpha'); // task ref
|
||||
$withproject = GETPOST('withproject', 'int');
|
||||
$project_ref = GETPOST('project_ref', 'alpha');
|
||||
$planned_workload = ((GETPOST('planned_workloadhour', 'int') != '' || GETPOST('planned_workloadmin', 'int') != '') ? (GETPOST('planned_workloadhour', 'int') > 0 ?GETPOST('planned_workloadhour', 'int') * 3600 : 0) + (GETPOST('planned_workloadmin', 'int') > 0 ?GETPOST('planned_workloadmin', 'int') * 60 : 0) : '');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('projecttaskcard', 'globalcard'));
|
||||
|
||||
@ -100,9 +100,19 @@ if (!empty($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS)) {
|
||||
*/
|
||||
|
||||
$payload = @file_get_contents("php://input");
|
||||
$sig_header = $_SERVER["HTTP_STRIPE_SIGNATURE"];
|
||||
$sig_header = empty($_SERVER["HTTP_STRIPE_SIGNATURE"]) ? '' : $_SERVER["HTTP_STRIPE_SIGNATURE"];
|
||||
$event = null;
|
||||
|
||||
if (getDolGlobalString('STRIPE_DEBUG')) {
|
||||
$fh = fopen(DOL_DATA_ROOT.'/dolibarr_stripe.log', 'w+');
|
||||
if ($fh) {
|
||||
fwrite($fh, dol_print_date(dol_now('gmt'), 'standard').' HTTP_STRIPE_SIGNATURE='.$sig_header."\n");
|
||||
fwrite($fh, $payload);
|
||||
fclose($fh);
|
||||
dolChmod(DOL_DATA_ROOT.'/dolibarr_stripe.log');
|
||||
}
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
try {
|
||||
@ -112,6 +122,8 @@ try {
|
||||
httponly_accessforbidden('Invalid payload', 400);
|
||||
} catch (\Stripe\Error\SignatureVerification $e) {
|
||||
httponly_accessforbidden('Invalid signature', 400);
|
||||
} catch (Exception $e) {
|
||||
httponly_accessforbidden('Error '.$e->getMessage(), 400);
|
||||
}
|
||||
|
||||
// Do something with $event
|
||||
|
||||
@ -1364,7 +1364,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
||||
|
||||
if ($nbremote == 0 && $nblocal == 0) {
|
||||
$colspan = (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD) ? 10 : 9);
|
||||
print '<tr><td colspan="'.$colspan.'"<span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
@ -232,8 +232,11 @@ if (empty($conf->stripeconnect->enabled)) {
|
||||
print '<br>';
|
||||
}
|
||||
print '<input class="minwidth300" type="text" name="STRIPE_TEST_WEBHOOK_KEY" value="'.getDolGlobalString('STRIPE_TEST_WEBHOOK_KEY').'" placeholder="'.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx">';
|
||||
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForTestWebhook").'</span> ';
|
||||
$url = dol_buildpath('/public/stripe/ipn.php?test', 3);
|
||||
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForTestWebhook").'</span> ';
|
||||
$url = dol_buildpath('/public/stripe/ipn.php', 3);
|
||||
$url .= '?test=1';
|
||||
//global $dolibarr_main_instance_unique_id;
|
||||
//$url .= '&securitykey='.dol_hash('stripeipn-'.$dolibarr_main_instance_unique_id.'-'.$conf->global->STRIPE_TEST_PUBLISHABLE_KEY, 'md5');
|
||||
$out .= '<input type="text" id="onlinetestwebhookurl" class="minwidth500" value="'.$url.'" disabled>';
|
||||
$out .= ajax_autoselect("onlinetestwebhookurl", 0);
|
||||
print '<br>'.$out;
|
||||
@ -250,7 +253,7 @@ if (empty($conf->stripeconnect->enabled)) {
|
||||
$endpoint->disabled = false;
|
||||
}
|
||||
}
|
||||
$endpoint->url = dol_buildpath('/public/stripe/ipn.php?test', 3);
|
||||
$endpoint->url = $url;
|
||||
$endpoint->save();
|
||||
if ($endpoint->status == 'enabled') {
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';
|
||||
@ -296,6 +299,8 @@ if (empty($conf->stripeconnect->enabled)) {
|
||||
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_WEBHOOK_KEY" value="'.getDolGlobalString('STRIPE_LIVE_WEBHOOK_KEY').'" placeholder="'.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx">';
|
||||
$out = img_picto('', 'globe', 'class="pictofixedwidth"').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForLiveWebhook").'</span> ';
|
||||
$url = dol_buildpath('/public/stripe/ipn.php', 3);
|
||||
//global $dolibarr_main_instance_unique_id;
|
||||
//$url .= '?securitykey='.dol_hash('stripeipn-'.$dolibarr_main_instance_unique_id.'-'.$conf->global->STRIPE_LIVE_PUBLISHABLE_KEY, 'md5');
|
||||
$out .= '<input type="text" id="onlinelivewebhookurl" class="minwidth500" value="'.$url.'" disabled>';
|
||||
$out .= ajax_autoselect("onlinelivewebhookurl", 0);
|
||||
print '<br>'.$out;
|
||||
@ -312,7 +317,7 @@ if (empty($conf->stripeconnect->enabled)) {
|
||||
$endpoint->disabled = false;
|
||||
}
|
||||
}
|
||||
$endpoint->url = dol_buildpath('/public/stripe/ipn.php', 3);
|
||||
$endpoint->url = $url;
|
||||
$endpoint->save();
|
||||
if ($endpoint->status == 'enabled') {
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';
|
||||
|
||||
@ -1269,7 +1269,7 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td colspan="2">';
|
||||
print img_picto('', 'company').$form->select_company('', 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||
// reload page to retrieve customer informations
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
|
||||
print '<script>
|
||||
@ -1303,11 +1303,13 @@ if ($action == 'create') {
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
print $form->getSelectConditionsPaiements(GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode of payment
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
$form->select_types_paiements(GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1321,7 +1323,7 @@ if ($action == 'create') {
|
||||
// Shipping Method
|
||||
if (isModEnabled("expedition")) {
|
||||
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td colspan="2">';
|
||||
print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"');
|
||||
print img_picto('', 'dolly', 'class="pictofixedwidth"');
|
||||
$form->selectShippingMethod(GETPOST('shipping_method_id') > 0 ? GETPOST('shipping_method_id', 'int') : "", 'shipping_method_id', '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1329,6 +1331,7 @@ if ($action == 'create') {
|
||||
// Delivery date (or manufacturing)
|
||||
print '<tr><td>'.$langs->trans("DeliveryDate").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print img_picto('', 'action', 'class="pictofixedwidth"');
|
||||
$datedelivery = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||
if (!empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) {
|
||||
$tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
|
||||
@ -1346,6 +1349,7 @@ if ($action == 'create') {
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print img_picto('', 'pdf', 'class="pictofixedwidth"');
|
||||
$list = ModelePDFSupplierProposal::liste_modeles($db);
|
||||
$preselected = (!empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT) ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT : $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF);
|
||||
print $form->selectarray('model', $list, $preselected, 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
@ -1363,7 +1367,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Project").'</td><td colspan="2">';
|
||||
print img_picto('', 'project').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
|
||||
print '</td>';
|
||||
@ -1375,6 +1379,7 @@ if ($action == 'create') {
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'currency', 'class="pictofixedwidth"');
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -327,76 +327,79 @@ if (empty($reshook)) {
|
||||
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
if ($invoice->type == Facture::TYPE_SITUATION) {
|
||||
$source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id
|
||||
$line->fk_prev_id = $line->id; // The new line of the new credit note we are creating must be linked to the situation invoice line it is created from
|
||||
if (!empty($invoice->tab_previous_situation_invoice)) {
|
||||
// search the last standard invoice in cycle and the possible credit note between this last and invoice
|
||||
// TODO Move this out of loop of $invoice->lines
|
||||
$tab_jumped_credit_notes = array();
|
||||
$lineIndex = count($invoice->tab_previous_situation_invoice) - 1;
|
||||
$searchPreviousInvoice = true;
|
||||
while ($searchPreviousInvoice) {
|
||||
if ($invoice->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1) {
|
||||
$searchPreviousInvoice = false; // find, exit;
|
||||
break;
|
||||
} else {
|
||||
if ($invoice->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$tab_jumped_credit_notes[$lineIndex] = $invoice->tab_previous_situation_invoice[$lineIndex]->id;
|
||||
}
|
||||
$lineIndex--; // go to previous invoice in cycle
|
||||
}
|
||||
}
|
||||
|
||||
$maxPrevSituationPercent = 0;
|
||||
foreach ($invoice->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) {
|
||||
if ($prevLine->id == $source_fk_prev_id) {
|
||||
$maxPrevSituationPercent = max($maxPrevSituationPercent, $prevLine->situation_percent);
|
||||
|
||||
//$line->subprice = $line->subprice - $prevLine->subprice;
|
||||
$line->total_ht = $line->total_ht - $prevLine->total_ht;
|
||||
$line->total_tva = $line->total_tva - $prevLine->total_tva;
|
||||
$line->total_ttc = $line->total_ttc - $prevLine->total_ttc;
|
||||
$line->total_localtax1 = $line->total_localtax1 - $prevLine->total_localtax1;
|
||||
$line->total_localtax2 = $line->total_localtax2 - $prevLine->total_localtax2;
|
||||
|
||||
$line->multicurrency_subprice = $line->multicurrency_subprice - $prevLine->multicurrency_subprice;
|
||||
$line->multicurrency_total_ht = $line->multicurrency_total_ht - $prevLine->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva = $line->multicurrency_total_tva - $prevLine->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc = $line->multicurrency_total_ttc - $prevLine->multicurrency_total_ttc;
|
||||
}
|
||||
}
|
||||
|
||||
// prorata
|
||||
$line->situation_percent = $maxPrevSituationPercent - $line->situation_percent;
|
||||
|
||||
//print 'New line based on invoice id '.$invoice->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'<br>';
|
||||
|
||||
// If there is some credit note between last situation invoice and invoice used for credit note generation (note: credit notes are stored as delta)
|
||||
$maxPrevSituationPercent = 0;
|
||||
foreach ($tab_jumped_credit_notes as $index => $creditnoteid) {
|
||||
foreach ($invoice->tab_previous_situation_invoice[$index]->lines as $prevLine) {
|
||||
if ($prevLine->fk_prev_id == $source_fk_prev_id) {
|
||||
$maxPrevSituationPercent = $prevLine->situation_percent;
|
||||
|
||||
$line->total_ht -= $prevLine->total_ht;
|
||||
$line->total_tva -= $prevLine->total_tva;
|
||||
$line->total_ttc -= $prevLine->total_ttc;
|
||||
$line->total_localtax1 -= $prevLine->total_localtax1;
|
||||
$line->total_localtax2 -= $prevLine->total_localtax2;
|
||||
|
||||
$line->multicurrency_subprice -= $prevLine->multicurrency_subprice;
|
||||
$line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION')) {
|
||||
if (!empty($invoice->situation_counter)) {
|
||||
$source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id
|
||||
$line->fk_prev_id = $line->id; // The new line of the new credit note we are creating must be linked to the situation invoice line it is created from
|
||||
if (!empty($invoice->tab_previous_situation_invoice)) {
|
||||
// search the last standard invoice in cycle and the possible credit note between this last and invoice
|
||||
// TODO Move this out of loop of $invoice->lines
|
||||
$tab_jumped_credit_notes = array();
|
||||
$lineIndex = count($invoice->tab_previous_situation_invoice) - 1;
|
||||
$searchPreviousInvoice = true;
|
||||
while ($searchPreviousInvoice) {
|
||||
if ($invoice->tab_previous_situation_invoice[$lineIndex]->situation_cycle_ref || $lineIndex < 1) {
|
||||
$searchPreviousInvoice = false; // find, exit;
|
||||
break;
|
||||
} else {
|
||||
if ($invoice->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$tab_jumped_credit_notes[$lineIndex] = $invoice->tab_previous_situation_invoice[$lineIndex]->id;
|
||||
}
|
||||
$lineIndex--; // go to previous invoice in cycle
|
||||
}
|
||||
}
|
||||
|
||||
$maxPrevSituationPercent = 0;
|
||||
foreach ($invoice->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) {
|
||||
if ($prevLine->id == $source_fk_prev_id) {
|
||||
$maxPrevSituationPercent = max($maxPrevSituationPercent, $prevLine->situation_percent);
|
||||
|
||||
//$line->subprice = $line->subprice - $prevLine->subprice;
|
||||
$line->total_ht = $line->total_ht - $prevLine->total_ht;
|
||||
$line->total_tva = $line->total_tva - $prevLine->total_tva;
|
||||
$line->total_ttc = $line->total_ttc - $prevLine->total_ttc;
|
||||
$line->total_localtax1 = $line->total_localtax1 - $prevLine->total_localtax1;
|
||||
$line->total_localtax2 = $line->total_localtax2 - $prevLine->total_localtax2;
|
||||
|
||||
$line->multicurrency_subprice = $line->multicurrency_subprice - $prevLine->multicurrency_subprice;
|
||||
$line->multicurrency_total_ht = $line->multicurrency_total_ht - $prevLine->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva = $line->multicurrency_total_tva - $prevLine->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc = $line->multicurrency_total_ttc - $prevLine->multicurrency_total_ttc;
|
||||
}
|
||||
}
|
||||
|
||||
// prorata
|
||||
$line->situation_percent = $maxPrevSituationPercent - $line->situation_percent;
|
||||
|
||||
//print 'New line based on invoice id '.$invoice->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'<br>';
|
||||
|
||||
// If there is some credit note between last situation invoice and invoice used for credit note generation (note: credit notes are stored as delta)
|
||||
$maxPrevSituationPercent = 0;
|
||||
foreach ($tab_jumped_credit_notes as $index => $creditnoteid) {
|
||||
foreach ($invoice->tab_previous_situation_invoice[$index]->lines as $prevLine) {
|
||||
if ($prevLine->fk_prev_id == $source_fk_prev_id) {
|
||||
$maxPrevSituationPercent = $prevLine->situation_percent;
|
||||
|
||||
$line->total_ht -= $prevLine->total_ht;
|
||||
$line->total_tva -= $prevLine->total_tva;
|
||||
$line->total_ttc -= $prevLine->total_ttc;
|
||||
$line->total_localtax1 -= $prevLine->total_localtax1;
|
||||
$line->total_localtax2 -= $prevLine->total_localtax2;
|
||||
|
||||
$line->multicurrency_subprice -= $prevLine->multicurrency_subprice;
|
||||
$line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// prorata
|
||||
$line->situation_percent += $maxPrevSituationPercent;
|
||||
|
||||
//print 'New line based on invoice id '.$invoice->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'<br>';
|
||||
}
|
||||
|
||||
// prorata
|
||||
$line->situation_percent += $maxPrevSituationPercent;
|
||||
|
||||
//print 'New line based on invoice id '.$invoice->tab_previous_situation_invoice[$lineIndex]->id.' fk_prev_id='.$source_fk_prev_id.' will be fk_prev_id='.$line->fk_prev_id.' '.$line->total_ht.' '.$line->situation_percent.'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -802,7 +802,7 @@ if ($action == 'create' || $action == 'presend') {
|
||||
|
||||
// Confirmation close
|
||||
if ($action == 'close') {
|
||||
$thirdparty_contacts = $object->getInfosTicketExternalContact();
|
||||
$thirdparty_contacts = $object->getInfosTicketExternalContact(1);
|
||||
$contacts_select = array(
|
||||
'-2' => $langs->trans('TicketNotifyAllTiersAtClose'),
|
||||
'-3' => $langs->trans('TicketNotNotifyTiersAtClose')
|
||||
@ -1179,7 +1179,7 @@ if ($action == 'create' || $action == 'presend') {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print '<input type="submit" class="button button-edit small" value="'.$langs->trans('Save').'">';
|
||||
print '</form>';
|
||||
print "</td>";
|
||||
|
||||
@ -2039,13 +2039,14 @@ class Ticket extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve informations about internal contacts
|
||||
* Retrieve informations about internal contacts
|
||||
*
|
||||
* @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status
|
||||
* @param int $status Status of user or company
|
||||
* @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status
|
||||
*/
|
||||
public function getInfosTicketInternalContact()
|
||||
public function getInfosTicketInternalContact($status = -1)
|
||||
{
|
||||
return $this->listeContact(-1, 'internal');
|
||||
return $this->listeContact(-1, 'internal', 0, '', $status);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2061,11 +2062,12 @@ class Ticket extends CommonObject
|
||||
/**
|
||||
* Retrieve informations about external contacts
|
||||
*
|
||||
* @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status
|
||||
* @param int $status Status of user or company
|
||||
* @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status
|
||||
*/
|
||||
public function getInfosTicketExternalContact()
|
||||
public function getInfosTicketExternalContact($status = -1)
|
||||
{
|
||||
return $this->listeContact(-1, 'external');
|
||||
return $this->listeContact(-1, 'external', 0, '', $status);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2129,13 +2131,14 @@ class Ticket extends CommonObject
|
||||
* Get array of all contacts for a ticket
|
||||
* Override method of file commonobject.class.php to add phone number
|
||||
*
|
||||
* @param int $status Status of lines to get (-1=all)
|
||||
* @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
|
||||
* @param int $list 0:Return array contains all properties, 1:Return array contains just id
|
||||
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
|
||||
* @return array|int Array of contacts
|
||||
* @param int $statusoflink Status of lines to get (-1=all)
|
||||
* @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
|
||||
* @param int $list 0:Return array contains all properties, 1:Return array contains just id
|
||||
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
|
||||
* @param int $status Status of user or company
|
||||
* @return array|int Array of contacts
|
||||
*/
|
||||
public function listeContact($status = -1, $source = 'external', $list = 0, $code = '')
|
||||
public function listeContact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -2175,10 +2178,16 @@ class Ticket extends CommonObject
|
||||
$sql .= " AND tc.element='".$this->db->escape($this->element)."'";
|
||||
if ($source == 'internal') {
|
||||
$sql .= " AND tc.source = 'internal'";
|
||||
if ($status >= 0) {
|
||||
$sql .= " AND t.statut = ".((int) $status);
|
||||
}
|
||||
}
|
||||
|
||||
if ($source == 'external' || $source == 'thirdparty') {
|
||||
$sql .= " AND tc.source = 'external'";
|
||||
if ($status >= 0) {
|
||||
$sql .= " AND t.statut = ".((int) $status);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($code)) {
|
||||
@ -2186,8 +2195,8 @@ class Ticket extends CommonObject
|
||||
}
|
||||
|
||||
$sql .= " AND tc.active=1";
|
||||
if ($status >= 0) {
|
||||
$sql .= " AND ec.statut = ".((int) $status);
|
||||
if ($statusoflink >= 0) {
|
||||
$sql .= " AND ec.statut = ".((int) $statusoflink);
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY t.lastname ASC";
|
||||
@ -2498,7 +2507,7 @@ class Ticket extends CommonObject
|
||||
*/
|
||||
if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED)) {
|
||||
// Retrieve internal contact datas
|
||||
$internal_contacts = $object->getInfosTicketInternalContact();
|
||||
$internal_contacts = $object->getInfosTicketInternalContact(1);
|
||||
|
||||
$assigned_user_dont_have_email = '';
|
||||
|
||||
@ -2588,7 +2597,7 @@ class Ticket extends CommonObject
|
||||
*/
|
||||
if ($send_email > 0) {
|
||||
// Retrieve internal contact datas
|
||||
$internal_contacts = $object->getInfosTicketInternalContact();
|
||||
$internal_contacts = $object->getInfosTicketInternalContact(1);
|
||||
|
||||
$sendto = array();
|
||||
if (is_array($internal_contacts) && count($internal_contacts) > 0) {
|
||||
@ -2657,7 +2666,7 @@ class Ticket extends CommonObject
|
||||
*/
|
||||
if (empty($object->private)) {
|
||||
// Retrieve email of all contacts (external)
|
||||
$external_contacts = $object->getInfosTicketExternalContact();
|
||||
$external_contacts = $object->getInfosTicketExternalContact(1);
|
||||
|
||||
// If no contact, get email from thirdparty
|
||||
if (is_array($external_contacts) && count($external_contacts) === 0) {
|
||||
@ -2802,8 +2811,8 @@ class Ticket extends CommonObject
|
||||
|
||||
// If no receiver defined, load all ticket linked contacts
|
||||
if (!is_array($array_receiver) || !count($array_receiver) > 0) {
|
||||
$array_receiver = $this->getInfosTicketInternalContact();
|
||||
$array_receiver = array_merge($array_receiver, $this->getInfosTicketExternalContact());
|
||||
$array_receiver = $this->getInfosTicketInternalContact(1);
|
||||
$array_receiver = array_merge($array_receiver, $this->getInfosTicketExternalContact(1));
|
||||
}
|
||||
|
||||
if ($send_internal_cc) {
|
||||
|
||||
@ -129,7 +129,7 @@ if ($user->id != $id && !$canreaduser) {
|
||||
// Define value to know what current user can do on properties of edited user
|
||||
if ($id > 0) {
|
||||
// $user is the current logged user, $id is the user we want to edit
|
||||
$canedituser = (($user->id == $id) && $user->hasRight("user", "self", "write")); // can edit myself
|
||||
$canedituser = (($user->id == $id) && $user->hasRight("user", "self", "write")) || (($user->id != $id) && $user->hasRight("user", "user", "write"));
|
||||
$caneditfield = ((($user->id == $id) && $user->hasRight("user", "self", "write")) || (($user->id != $id) && $user->hasRight("user", "user", "write")));
|
||||
$caneditpassword = ((($user->id == $id) && $user->hasRight("user", "self", "password")) || (($user->id != $id) && $user->hasRight("user", "user", "password")));
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ $mode = GETPOST('mode', 'aZ');
|
||||
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_group = GETPOST('search_group');
|
||||
$search = array();
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user