';
- print '';
+ print '';
print $langs->trans('DateDeliveryPlanned');
print ' ';
@@ -2008,7 +2008,7 @@ if ($action == 'create') {
// Sending method
print '';
- print '';
+ print '';
print $langs->trans('SendingMethod');
print ' ';
diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php
index cf7c5023bea..b64908d02e3 100644
--- a/htdocs/expedition/dispatch.php
+++ b/htdocs/expedition/dispatch.php
@@ -148,6 +148,7 @@ if ($action == 'updatelines' && $usercancreate) {
$ent = "entrepot_".$reg[1].'_'.$reg[2];
$fk_commandedet = "fk_commandedet_".$reg[1].'_'.$reg[2];
$idline = GETPOST("idline_".$reg[1].'_'.$reg[2]);
+ $warehouse_id = GETPOSTINT($ent);
$pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount
$lot = '';
$dDLUO = '';
@@ -159,11 +160,12 @@ if ($action == 'updatelines' && $usercancreate) {
}
$newqty = price2num(GETPOST($qty, 'alpha'), 'MS');
+ //var_dump("modebatch=".$modebatch." newqty=".$newqty." ent=".$ent." idline=".$idline);
// We ask to move a qty
if (($modebatch == "batch" && $newqty >= 0) || ($modebatch == "barcode" && $newqty != 0)) {
if ($newqty > 0) { // If we want a qty, we make test on input data
- if (!(GETPOST($ent, 'int') > 0)) {
+ if (!($warehouse_id > 0)) {
dol_syslog('No dispatch for line '.$key.' as no warehouse was chosen.');
$text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' '.($numline);
setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors');
@@ -200,7 +202,7 @@ if ($action == 'updatelines' && $usercancreate) {
$qtystart = 0;
if ($idline > 0) {
- $result = $expeditiondispatch->fetch($idline);
+ $result = $expeditiondispatch->fetch($idline); // get line from llx_expeditiondet
if ($result < 0) {
setEventMessages($expeditiondispatch->error, $expeditiondispatch->errors, 'errors');
$error++;
@@ -225,13 +227,30 @@ if ($action == 'updatelines' && $usercancreate) {
$sellby = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffixkeyfordate.'month'), GETPOST('dlc'.$suffixkeyfordate.'day'), GETPOST('dlc'.$suffixkeyfordate.'year'), '');
$eatby = dol_mktime(0, 0, 0, GETPOST('dluo'.$suffixkeyfordate.'month'), GETPOST('dluo'.$suffixkeyfordate.'day'), GETPOST('dluo'.$suffixkeyfordate.'year'));
- $sql = "UPDATE ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element." SET";
- $sql .= " eatby = ".($eatby ? "'".$db->idate($eatby)."'" : "null");
- $sql .= " , sellby = ".($sellby ? "'".$db->idate($sellby)."'" : "null");
- $sql .= " , qty = ".((float) $newqty);
- // TODO Add a column fk_warehouse
- $sql .= " WHERE fk_expeditiondet = ".((int) $idline);
- $sql .= " AND batch = '".$db->escape($lot)."'";
+ $sqlsearchdet = "SELECT rowid FROM ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element;
+ $sqlsearchdet .= " WHERE fk_expeditiondet = ".((int) $idline);
+ $sqlsearchdet .= " AND batch = '".$db->escape($lot)."'";
+ $resqlsearchdet = $db->query($sqlsearchdet);
+
+ if ($resqlsearchdet) {
+ $objsearchdet = $db->fetch_object($resqlsearchdet);
+ } else {
+ dol_print_error($db);
+ }
+
+ if ($objsearchdet) {
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element." SET";
+ $sql .= " eatby = ".($eatby ? "'".$db->idate($eatby)."'" : "null");
+ $sql .= " , sellby = ".($sellby ? "'".$db->idate($sellby)."'" : "null");
+ $sql .= " , qty = ".((float) $newqty);
+ $sql .= " , fk_warehouse = ".((int) $warehouse_id);
+ $sql .= " WHERE rowid = ".((int) $objsearchdet->rowid);
+ } else {
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element." (";
+ $sql .= "fk_expeditiondet, eatby, sellby, batch, qty, fk_origin_stock, fk_warehouse)";
+ $sql .= " VALUES (".((int) $idline).", ".($eatby ? "'".$db->idate($eatby)."'" : "null").", ".($sellby ? "'".$db->idate($sellby)."'" : "null").", ";
+ $sql .= " '".$db->escape($lot)."', ".((float) $newqty).", 0, ".((int) $warehouse_id).")";
+ }
} else {
$sql = " DELETE FROM ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element;
$sql .= " WHERE fk_expeditiondet = ".((int) $idline);
@@ -239,7 +258,7 @@ if ($action == 'updatelines' && $usercancreate) {
}
$resql = $db->query($sql);
- if (!$db->query($sql)) {
+ if (!$resql) {
dol_print_error($db);
$error++;
}
@@ -317,6 +336,7 @@ if ($action == 'updatelines' && $usercancreate) {
}
}
}
+
if ($error > 0) {
$db->rollback();
setEventMessages($error, $errors, 'errors');
@@ -446,7 +466,7 @@ if ($object->id > 0 || !empty($object->ref)) {
print '';
print '
';
- print '
';
+ print '';
// Linked documents
if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) {
@@ -605,11 +625,11 @@ if ($object->id > 0 || !empty($object->ref)) {
}
print ''.$langs->trans("QtyOrdered").' ';
if ($object->status == Expedition::STATUS_DRAFT) {
- print ''.$langs->trans("QtyToDispatchShort"); // Qty to dispatch (sum for all lines of batch detail if there is)
+ print ' '.$langs->trans("QtyToShip"); // Qty to dispatch (sum for all lines of batch detail if there is)
} else {
print ' '.$langs->trans("QtyDispatchedShort").' ';
}
- print ''.$langs->trans("QtyToDispatchShort");
+ print ' '.$langs->trans("Details");
print ' ';
if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
@@ -745,7 +765,12 @@ if ($object->id > 0 || !empty($object->ref)) {
print ''; // Dispatch column
print ' '; // Warehouse column
- $sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot, eb.batch, eb.eatby, eb.sellby, cd.fk_product FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
+ /*$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product";
+ $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
+ $sql .= " WHERE cfd.fk_commandefourndet = ".(int) $objp->rowid;*/
+
+ $sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot, eb.batch, eb.eatby, eb.sellby, cd.fk_product";
+ $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet";
$sql .= " JOIN ".MAIN_DB_PREFIX."commandedet as cd on ed.fk_origin_line = cd.rowid";
$sql .= " WHERE ed.fk_origin_line =".(int) $objp->rowid;
@@ -761,7 +786,7 @@ if ($object->id > 0 || !empty($object->ref)) {
$suffix = "_".$j."_".$i;
$objd = $db->fetch_object($resultsql);
- if (isModEnabled('productbatch') && !empty($objd->batch)) {
+ if (isModEnabled('productbatch') && (!empty($objd->batch) || (is_null($objd->batch) && $tmpproduct->status_batch > 0))) {
$type = 'batch';
// Enable hooks to append additional columns
@@ -798,7 +823,7 @@ if ($object->id > 0 || !empty($object->ref)) {
print '';
print '';
- print ' ';
+ print ' ';
//print ' ';
print ' ';
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php
index d110660b6f5..cfad9f838b1 100644
--- a/htdocs/filefunc.inc.php
+++ b/htdocs/filefunc.inc.php
@@ -80,7 +80,7 @@ $result = @include_once $conffile; // Keep @ because with some error reporting t
// Disable some not used PHP stream
$listofwrappers = stream_get_wrappers();
-// We need '.phar' for geoip2. TODO Replace phar with explode files so we can disable phar.
+// We need '.phar' for geoip2. TODO Replace phar in geoip with exploded files so we can disable phar.
$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftps', 'glob', 'data', 'expect', 'ftp', 'ogg', 'rar', 'zip', 'zlib');
foreach ($arrayofstreamtodisable as $streamtodisable) {
if (!empty($listofwrappers) && in_array($streamtodisable, $listofwrappers)) {
diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php
index 09700c58855..a09b8d4fbf6 100644
--- a/htdocs/fourn/class/api_supplier_invoices.class.php
+++ b/htdocs/fourn/class/api_supplier_invoices.class.php
@@ -18,8 +18,8 @@
use Luracast\Restler\RestException;
-require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
-require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
+require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
+require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
/**
* API class for supplier invoices
@@ -75,7 +75,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
$this->invoice->fetchObjectLinked();
@@ -123,19 +123,19 @@ class SupplierInvoices extends DolibarrApi
if (!DolibarrApiAccess::$user->hasRight("societe", "client", "voir") || $search_sale > 0) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
- $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn AS t LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
+ $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn AS t LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
// We need this table joined to the select in order to filter by sale
if (!DolibarrApiAccess::$user->hasRight("societe", "client", "voir") || $search_sale > 0) {
- $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
- $sql .= ' WHERE t.entity IN ('.getEntity('supplier_invoice').')';
+ $sql .= ' WHERE t.entity IN (' . getEntity('supplier_invoice') . ')';
if (!DolibarrApiAccess::$user->hasRight("societe", "client", "voir") || $search_sale > 0) {
$sql .= " AND t.fk_soc = sc.fk_soc";
}
if ($socids) {
- $sql .= " AND t.fk_soc IN (".$this->db->sanitize($socids).")";
+ $sql .= " AND t.fk_soc IN (" . $this->db->sanitize($socids) . ")";
}
if ($search_sale > 0) {
$sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
@@ -156,14 +156,14 @@ class SupplierInvoices extends DolibarrApi
}
// Insert sale filter
if ($search_sale > 0) {
- $sql .= " AND sc.fk_user = ".((int) $search_sale);
+ $sql .= " AND sc.fk_user = " . ((int) $search_sale);
}
// Add sql filters
if ($sqlfilters) {
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
if ($errormessage) {
- throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
+ throw new RestException(400, 'Error when validating parameter sqlfilters -> ' . $errormessage);
}
}
@@ -191,7 +191,7 @@ class SupplierInvoices extends DolibarrApi
$i++;
}
} else {
- throw new RestException(503, 'Error when retrieve supplier invoice list : '.$this->db->lasterror());
+ throw new RestException(503, 'Error when retrieve supplier invoice list : ' . $this->db->lasterror());
}
if (!count($obj_ret)) {
throw new RestException(404, 'No supplier invoice found');
@@ -257,7 +257,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
foreach ($request_data as $field => $value) {
@@ -296,7 +296,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
if ($this->invoice->delete(DolibarrApiAccess::$user) < 0) {
@@ -339,7 +339,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
@@ -347,13 +347,13 @@ class SupplierInvoices extends DolibarrApi
throw new RestException(304, 'Error nothing done. The invoice is already validated');
}
if ($result < 0) {
- throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
+ throw new RestException(500, 'Error when validating Invoice: ' . $this->invoice->error);
}
return array(
'success' => array(
'code' => 200,
- 'message' => 'Invoice validated (Ref='.$this->invoice->ref.')'
+ 'message' => 'Invoice validated (Ref=' . $this->invoice->ref . ')'
)
);
}
@@ -381,7 +381,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
$result = $this->invoice->fetch($id);
@@ -410,6 +410,7 @@ class SupplierInvoices extends DolibarrApi
* @param string $comment {@from body} Note (optional)
* @param string $chqemetteur {@from body} Payment issuer (mandatory if payment_mode_id corresponds to 'CHQ'-payment type)
* @param string $chqbank {@from body} Issuer bank name (optional)
+ * @param float $amount {@from body} Amount of payment if we don't want to use the remain to pay
*
* @url POST {id}/payments
*
@@ -418,7 +419,7 @@ class SupplierInvoices extends DolibarrApi
* @throws RestException 401
* @throws RestException 404
*/
- public function addPayment($id, $datepaye, $payment_mode_id, $closepaidinvoices, $accountid, $num_payment = '', $comment = '', $chqemetteur = '', $chqbank = '')
+ public function addPayment($id, $datepaye, $payment_mode_id, $closepaidinvoices, $accountid, $num_payment = '', $comment = '', $chqemetteur = '', $chqbank = '', $amount = null)
{
global $conf;
@@ -430,7 +431,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
if (isModEnabled("banque")) {
@@ -449,18 +450,24 @@ class SupplierInvoices extends DolibarrApi
throw new RestException(404, 'Invoice not found');
}
- // Calculate amount to pay
- $totalpaid = $this->invoice->getSommePaiement();
- $totaldeposits = $this->invoice->getSumDepositsUsed();
- $resteapayer = price2num($this->invoice->total_ttc - $totalpaid - $totaldeposits, 'MT');
+ if (null !== $amount && $amount > 0) {
+ // We use the amount given in parameter
+ $paymentamount = $amount;
+ } else {
+ // We calculate the remain to pay, and use it as amount
+ $totalpaid = $this->invoice->getSommePaiement();
+ $totaldeposits = $this->invoice->getSumDepositsUsed();
+ $paymentamount = price2num($this->invoice->total_ttc - $totalpaid - $totaldeposits, 'MT');
+ }
$this->db->begin();
$amounts = array();
$multicurrency_amounts = array();
- $resteapayer = price2num($resteapayer, 'MT');
- $amounts[$id] = $resteapayer;
+ $paymentamount = price2num($paymentamount, 'MT');
+
+ $amounts[$id] = $paymentamount;
// Multicurrency
$newvalue = price2num($this->invoice->multicurrency_total_ttc, 'MT');
@@ -479,14 +486,14 @@ class SupplierInvoices extends DolibarrApi
$paiement_id = $paiement->create(DolibarrApiAccess::$user, ($closepaidinvoices == 'yes' ? 1 : 0)); // This include closing invoices
if ($paiement_id < 0) {
$this->db->rollback();
- throw new RestException(400, 'Payment error : '.$paiement->error);
+ throw new RestException(400, 'Payment error : ' . $paiement->error);
}
if (isModEnabled("banque")) {
$result = $paiement->addPaymentToBank(DolibarrApiAccess::$user, 'payment_supplier', '(SupplierInvoicePayment)', $accountid, $chqemetteur, $chqbank);
if ($result < 0) {
$this->db->rollback();
- throw new RestException(400, 'Add payment to bank error : '.$paiement->error);
+ throw new RestException(400, 'Add payment to bank error : ' . $paiement->error);
}
}
@@ -516,7 +523,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
$this->invoice->fetch_lines();
$result = array();
@@ -552,7 +559,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
@@ -586,7 +593,7 @@ class SupplierInvoices extends DolibarrApi
);
if ($updateRes < 0) {
- throw new RestException(400, 'Unable to insert the new line. Check your inputs. '.$this->invoice->error);
+ throw new RestException(400, 'Unable to insert the new line. Check your inputs. ' . $this->invoice->error);
}
return $updateRes;
@@ -619,7 +626,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
@@ -690,7 +697,7 @@ class SupplierInvoices extends DolibarrApi
}
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
// TODO Check the lineid $lineid is a line of ojbect
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 93e1ad0c4d4..c06467d1d24 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -279,6 +279,7 @@ if (empty($reshook)) {
$object->date_debut = $date_debut;
$object->date_fin = $date_fin;
$object->halfday = $halfday;
+ $object->entity = $conf->entity;
$result = $object->create($user);
if ($result <= 0) {
@@ -657,7 +658,7 @@ if (empty($reshook)) {
$societeName = $conf->global->MAIN_APPLICATION_TITLE;
}
- $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated");
+ $subject = '['.$societeName."] ".$langs->transnoentitiesnoconv("HolidaysValidated");
// Content
$message = "".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",
\n";
diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php
index a661758dfad..c4bc55bd067 100644
--- a/htdocs/hrm/index.php
+++ b/htdocs/hrm/index.php
@@ -260,7 +260,7 @@ if (isModEnabled('holiday') && $user->hasRight('holiday', 'read')) {
$i++;
}
} else {
- print ''.$langs->trans("None").' ';
+ print ''.$langs->trans("None").' ';
}
print '
';
print '';
@@ -332,7 +332,7 @@ if (isModEnabled('expensereport') && $user->hasRight('expensereport', 'read')) {
$i++;
}
} else {
- print ''.$langs->trans("None").' ';
+ print ''.$langs->trans("None").' ';
}
print '
';
print '
';
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 9ad1dda460f..63a4c43c9b9 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -319,6 +319,8 @@ ErrorTheUrlOfYourDolInstanceDoesNotMatchURLIntoOAuthSetup=Error: The URL of you
ErrorMenuExistValue=A Menu already exist with this Title or URL
ErrorSVGFilesNotAllowedAsLinksWithout=SVG files are not allowed as external links without the option %s
ErrorTypeMenu=Impossible to add another menu for the same module on the navbar, not handle yet
+ErrorObjectNotFound = The object %s is not found, please check your url
+
ErrorTableExist=Table %s already exist
ErrorDictionaryNotFound=Dictionary %s not found
ErrorFailedToCreateSymLinkToMedias=Failed to create the symbolic link %s to point to %s
diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang
index 41ca1f5c7f0..2d25697845a 100644
--- a/htdocs/langs/fr_FR/errors.lang
+++ b/htdocs/langs/fr_FR/errors.lang
@@ -318,10 +318,12 @@ ErrorTheUrlOfYourDolInstanceDoesNotMatchURLIntoOAuthSetup=Erreur : L'URL de vot
ErrorMenuExistValue=Un menu existe déjà avec ce titre ou cette URL
ErrorSVGFilesNotAllowedAsLinksWithout=Les fichiers SVG ne sont pas autorisés en tant que liens externes sans l'option %s
ErrorTypeMenu=Impossible d'ajouter un autre menu pour le même module sur la barre de navigation, pas encore géré
+ErrorObjectNotFound=L'objet %s est introuvable verifier votre url
ErrorTableExist=La table %s existe déja
ErrorDictionaryNotFound=Le dictionnaire %s introuvable
ErrorFailedToCreateSymLinkToMedias=Failed to create the symlinks %s to point to %s
+
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Votre paramètre PHP upload_max_filesize (%s) est supérieur au paramètre PHP post_max_size (%s). Ceci n'est pas une configuration cohérente.
WarningPasswordSetWithNoAccount=Un mot de passe a été fixé pour cet adhérent. Cependant, aucun compte d'utilisateur n'a été créé. Donc, ce mot de passe est stocké, mais ne peut être utilisé pour accéder à Dolibarr. Il peut être utilisé par un module/interface externe, mais si vous n'avez pas besoin de définir ni login ni mot de passe pour un adhérent, vous pouvez désactiver l'option «Gérer un login pour chaque adhérent" depuis la configuration du module Adhérents. Si vous avez besoin de gérer un login, mais pas de mot de passe, vous pouvez laisser ce champ vide pour éviter cet avertissement. Remarque: L'email peut également être utilisé comme login si l'adhérent est lié à un utilisateur.
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 4057397c6e5..2528d402810 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1802,8 +1802,8 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
if (!defined('DISABLE_FONT_AWSOME')) {
print ''."\n";
- print ' '."\n";
- print ' '."\n";
+ $fontawesome_directory = getDolGlobalString('MAIN_FONTAWESOME_DIRECTORY', '/theme/common/fontawesome-5');
+ print ' '."\n";
}
print ''."\n";
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 06dfdb70226..86aa539fa05 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -233,7 +233,6 @@ if ($dirins && $action == 'initmodule' && $modulename) {
'mymodule'=>strtolower($modulename),
'MyModule'=>$modulename
);
-
$result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement);
//dol_mkdir($destfile);
if ($result <= 0) {
@@ -379,6 +378,11 @@ if ($dirins && $action == 'initmodule' && $modulename) {
dol_delete_file($destdir.'/README.md');
file_put_contents($destdir.'/README.md', $conf->global->MODULEBUILDER_SPECIFIC_README);
}
+ // for create file to add properties
+ // file_put_contents($destdir.'/'.strtolower($modulename).'propertycard.php','');
+ // $srcFileCard = DOL_DOCUMENT_ROOT.'/modulebuilder/card.php';
+ // $destFileCard = $dirins.'/'.strtolower($modulename).'/template/card.php';
+ // dol_copy($srcFileCard, $destdir.'/'.strtolower($modulename).'propertycard.php', 0,1, $arrayreplacement);
}
if (!$error) {
@@ -1677,10 +1681,10 @@ if ($dirins && ($action == 'droptable' || $action == 'droptableextrafields') &&
}
}
-if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && !empty($tabobj)) {
+if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && !empty(GETPOST('obj')) && $tabobj == "createproperty") {
$error = 0;
- $objectname = $tabobj;
+ $objectname = GETPOST('obj');
$dirins = $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
$moduletype = $listofmodules[strtolower($module)]['moduletype'];
@@ -1689,6 +1693,11 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$destdir = $dirins.'/'.strtolower($module);
dol_mkdir($destdir);
+ $objects = dolGetListOfObjectClasses($destdir);
+ if (!in_array($objectname, array_values($objects))) {
+ $error++;
+ setEventMessages($langs->trans("ErrorObjectNotFound", $langs->transnoentities($objectname)), null, 'errors');
+ }
// We click on add property
if (!GETPOST('regenerateclasssql') && !GETPOST('regeneratemissing')) {
if (!GETPOST('propname', 'aZ09')) {
@@ -1708,7 +1717,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'),
'label'=>GETPOST('proplabel', 'alpha'),
- 'type'=>GETPOST('proptype', 'alpha'),
+ 'type'=>strtolower(GETPOST('proptype', 'alpha')),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),
'enabled'=>GETPOST('propenabled', 'int'),
@@ -1727,8 +1736,6 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
'alwayseditable'=>intval(GETPOST('propalwayseditable', 'int')),
'validate' => GETPOST('propvalidate', 'int')
);
-
-
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
@@ -3766,6 +3773,7 @@ if ($module == 'initmodule') {
print dol_get_fiche_head($head3, $tabobj, '', -1, '', 0, '', '', 0, 'forobjectsuffix'); // Level 3
+
if ($tabobj == 'newobject') {
// New object tab
print '';
+ } elseif ($tabobj == 'createproperty') {
+ $attributesUnique = array (
+ 'propname' => $form->textwithpicto($langs->trans("Code"), $langs->trans("PropertyDesc"), 1, 'help', 'extracss', 0, 3, 'propertyhelp'),
+ 'proplabel' => $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")),
+ 'proptype' => $form->textwithpicto($langs->trans("Type"), $langs->trans("TypeOfFieldsHelpIntro").' '.$langs->trans("TypeOfFieldsHelp"), 1, 'help', 'extracss', 0, 3, 'typehelp'),
+ 'proparrayofkeyval' => $form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")),
+ 'propnotnull' => $form->textwithpicto($langs->trans("NotNull"), $langs->trans("NotNullDesc")),
+ 'propdefault' => $langs->trans("DefaultValue"),
+ 'propindex' => $langs->trans("DatabaseIndex"),
+ 'propforeignkey' => $form->textwithpicto($langs->trans("ForeignKey"), $langs->trans("ForeignKeyDesc"), 1, 'help', 'extracss', 0, 3, 'foreignkeyhelp'),
+ 'propposition' => $langs->trans("Position"),
+ 'propenabled' => $form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc"), 1, 'help', 'extracss', 0, 3, 'enabledhelp'),
+ 'propvisible' => $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").' '.$langs->trans("ItCanBeAnExpression"), 1, 'help', 'extracss', 0, 3, 'visiblehelp'),
+ 'propnoteditable' => $langs->trans("NotEditable"),
+ 'propalwayseditable' => $langs->trans("AlwaysEditable"),
+ 'propsearchall' => $form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")),
+ 'propisameasure' => $form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")),
+ 'propcss' => $langs->trans("CSSClass"),
+ 'propcssview' => $langs->trans("CSSViewClass"),
+ 'propcsslist' => $langs->trans("CSSListClass"),
+ 'prophelp' => $langs->trans("KeyForTooltip"),
+ 'propshowoncombobox' => $langs->trans("ShowOnCombobox"),
+ 'propvalidate' => $form->textwithpicto($langs->trans("Validate"), $langs->trans("ValidateModBuilderDesc")),
+ 'propcomment' => $langs->trans("Comment"),
+ );
+ print '';
+ // javascript
+ print '';
} elseif ($tabobj == 'deleteobject') {
// Delete object tab
print '