Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
fd65d4b420
@ -511,7 +511,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
// Defaut
|
||||
print '<td class="center">';
|
||||
if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) {
|
||||
if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
|
||||
@ -2614,7 +2614,15 @@ class Form
|
||||
}
|
||||
|
||||
$sql = "SELECT ";
|
||||
$sql .= $selectFields . $selectFieldsGrouped;
|
||||
|
||||
// Add select from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('selectProductsListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$sql .= $selectFields.$selectFieldsGrouped.$hookmanager->resPrint;
|
||||
} else {
|
||||
$sql .= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) {
|
||||
//Product category
|
||||
@ -2660,7 +2668,13 @@ class Form
|
||||
$sql .= " DESC LIMIT 1) as price_by_qty";
|
||||
$selectFields .= ", price_rowid, price_by_qty";
|
||||
}
|
||||
$sql .= " FROM " . $this->db->prefix() . "product as p";
|
||||
|
||||
$sql .= " FROM ".$this->db->prefix()."product as p";
|
||||
// Add from (left join) from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
if (count($warehouseStatusArray)) {
|
||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
|
||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
|
||||
@ -2932,6 +2946,7 @@ class Form
|
||||
protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '', $novirtualstock = 0)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $hookmanager;
|
||||
|
||||
$outkey = '';
|
||||
$outval = '';
|
||||
@ -3217,6 +3232,14 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
$parameters = array('objp'=>$objp);
|
||||
$reshook = $hookmanager->executeHooks('constructProductListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$opt .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$opt = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$opt .= "</option>\n";
|
||||
$optJson = array(
|
||||
'key' => $outkey,
|
||||
|
||||
@ -69,6 +69,7 @@ class Notify
|
||||
'BILL_PAYED',
|
||||
'ORDER_CREATE',
|
||||
'ORDER_VALIDATE',
|
||||
'ORDER_CLOSE',
|
||||
'PROPAL_VALIDATE',
|
||||
'PROPAL_CLOSE_SIGNED',
|
||||
'PROPAL_CLOSE_REFUSED',
|
||||
@ -503,6 +504,13 @@ class Notify
|
||||
$labeltouse = $conf->global->ORDER_VALIDATE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextOrderValidated", $link);
|
||||
break;
|
||||
case 'ORDER_CLOSE':
|
||||
$link = '<a href="'.$urlwithroot.'/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
|
||||
$object_type = 'order';
|
||||
$labeltouse = $conf->global->ORDER_CLOSE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextOrderClose", $link);
|
||||
break;
|
||||
case 'PROPAL_VALIDATE':
|
||||
$link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
|
||||
@ -783,6 +791,12 @@ class Notify
|
||||
$object_type = 'order';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated", $link);
|
||||
break;
|
||||
case 'ORDER_CLOSE':
|
||||
$link = '<a href="'.$urlwithroot.'/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
|
||||
$object_type = 'order';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderClose", $link);
|
||||
break;
|
||||
case 'PROPAL_VALIDATE':
|
||||
$link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
|
||||
|
||||
@ -1936,14 +1936,14 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
|
||||
$sql .= " ORDER BY description DESC";
|
||||
|
||||
dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$resql_models = $db->query($sql);
|
||||
if ($resql_models) {
|
||||
$num = $db->num_rows($resql_models);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$found = 1;
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
$obj = $db->fetch_object($resql_models);
|
||||
|
||||
// If this generation module needs to scan a directory, then description field is filled
|
||||
// with the constant that contains list of directories to scan (COMPANY_ADDON_PDF_ODT_PATH, ...).
|
||||
|
||||
@ -96,6 +96,8 @@ class ImportCsv extends ModeleImports
|
||||
public function __construct($db, $datatoimport)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
parent::__construct();
|
||||
$this->db = $db;
|
||||
|
||||
$this->separator = (GETPOST('separator') ?GETPOST('separator') : (empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE));
|
||||
@ -870,6 +872,10 @@ class ImportCsv extends ModeleImports
|
||||
$filters[] = $col.' = '.$data[$key];
|
||||
}
|
||||
}
|
||||
if (!empty($tablewithentity_cache[$tablename])) {
|
||||
$where[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
|
||||
$filters[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
|
||||
}
|
||||
$sqlSelect .= " WHERE ".implode(' AND ', $where);
|
||||
|
||||
$resql = $this->db->query($sqlSelect);
|
||||
@ -906,6 +912,10 @@ class ImportCsv extends ModeleImports
|
||||
}
|
||||
$sqlSelect .= " WHERE ".$keyfield." = ".((int) $lastinsertid);
|
||||
|
||||
if (!empty($tablewithentity_cache[$tablename])) {
|
||||
$sqlSelect .= " AND entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sqlSelect);
|
||||
if ($resql) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
@ -951,6 +961,10 @@ class ImportCsv extends ModeleImports
|
||||
$sqlend = " WHERE " . implode(' AND ', $where);
|
||||
}
|
||||
|
||||
if (!empty($tablewithentity_cache[$tablename])) {
|
||||
$sqlend .= " AND entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
|
||||
}
|
||||
|
||||
$sql = $sqlstart.$sqlend;
|
||||
|
||||
// Run update request
|
||||
|
||||
@ -106,6 +106,8 @@ class ImportXlsx extends ModeleImports
|
||||
public function __construct($db, $datatoimport)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
parent::__construct();
|
||||
$this->db = $db;
|
||||
|
||||
// this is used as an extension from the example file code, so we have to put xlsx here !!!
|
||||
@ -916,6 +918,10 @@ class ImportXlsx extends ModeleImports
|
||||
$filters[] = $col.' = '.$data[$key];
|
||||
}
|
||||
}
|
||||
if (!empty($tablewithentity_cache[$tablename])) {
|
||||
$where[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
|
||||
$filters[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
|
||||
}
|
||||
$sqlSelect .= " WHERE " . implode(' AND ', $where);
|
||||
|
||||
$resql = $this->db->query($sqlSelect);
|
||||
@ -953,6 +959,10 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
$sqlSelect .= " WHERE ".$keyfield." = ".((int) $lastinsertid);
|
||||
|
||||
if (!empty($tablewithentity_cache[$tablename])) {
|
||||
$sqlSelect .= " AND entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sqlSelect);
|
||||
if ($resql) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
@ -998,6 +1008,10 @@ class ImportXlsx extends ModeleImports
|
||||
$sqlend = " WHERE " . implode(' AND ', $where);
|
||||
}
|
||||
|
||||
if (!empty($tablewithentity_cache[$tablename])) {
|
||||
$sqlend .= " AND entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
|
||||
}
|
||||
|
||||
$sql = $sqlstart . $sqlend;
|
||||
|
||||
// Run update request
|
||||
|
||||
@ -75,14 +75,53 @@ class ModeleImports
|
||||
|
||||
public $libversion = array();
|
||||
|
||||
/**
|
||||
* @var array Element mapping from table name
|
||||
*/
|
||||
public static $mapTableToElement = array(
|
||||
'actioncomm' => 'agenda',
|
||||
'adherent' => 'member',
|
||||
'adherent_type' => 'member_type',
|
||||
//'bank_account' => 'bank_account',
|
||||
'categorie' => 'category',
|
||||
//'commande' => 'commande',
|
||||
//'commande_fournisseur' => 'commande_fournisseur',
|
||||
'contrat' => 'contract',
|
||||
'entrepot' => 'stock',
|
||||
//'expensereport' => 'expensereport',
|
||||
'facture' => 'invoice',
|
||||
//'facture_fourn' => 'facture_fourn',
|
||||
'fichinter' => 'intervention',
|
||||
//'holiday' => 'holiday',
|
||||
//'product' => 'product',
|
||||
'product_price' => 'productprice',
|
||||
'product_fournisseur_price' => 'productsupplierprice',
|
||||
'projet' => 'project',
|
||||
//'propal' => 'propal',
|
||||
//'societe' => 'societe',
|
||||
'socpeople' => 'contact',
|
||||
//'supplier_proposal' => 'supplier_proposal',
|
||||
//'ticket' => 'ticket',
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
global $hookmanager;
|
||||
|
||||
if (is_object($hookmanager)) {
|
||||
$hookmanager->initHooks(array('import'));
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('constructModeleImports', $parameters, $this);
|
||||
if ($reshook >= 0 && !empty($hookmanager->resArray)) {
|
||||
foreach ($hookmanager->resArray as $mapList) {
|
||||
self::$mapTableToElement[$mapList['table']] = $mapList['element'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getDriverId
|
||||
@ -267,4 +306,22 @@ class ModeleImports
|
||||
{
|
||||
return $this->libversion[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element from table name with prefix
|
||||
*
|
||||
* @param string $tableNameWithPrefix Table name with prefix
|
||||
* @return string Element name or table element as default
|
||||
*/
|
||||
public function getElementFromTableWithPrefix($tableNameWithPrefix)
|
||||
{
|
||||
$tableElement = preg_replace('/^'.preg_quote($this->db->prefix(), '/').'/', '', $tableNameWithPrefix);
|
||||
$element = $tableElement;
|
||||
|
||||
if (isset(self::$mapTableToElement[$tableElement])) {
|
||||
$element = self::$mapTableToElement[$tableElement];
|
||||
}
|
||||
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,6 +362,7 @@ class PaiementFourn extends Paiement
|
||||
$newlang = '';
|
||||
$outputlangs = $langs;
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
|
||||
$invoice->fetch_thirdparty();
|
||||
$newlang = $invoice->thirdparty->default_lang;
|
||||
}
|
||||
if (!empty($newlang)) {
|
||||
|
||||
@ -41,6 +41,7 @@ notiftofixedemail=To fixed mail
|
||||
notiftouserandtofixedemail=To user and fixed mail
|
||||
Notify_ORDER_VALIDATE=Sales order validated
|
||||
Notify_ORDER_SENTBYMAIL=Sales order sent by mail
|
||||
Notify_ORDER_CLOSE=Sales order delivered
|
||||
Notify_ORDER_SUPPLIER_SENTBYMAIL=Purchase order sent by email
|
||||
Notify_ORDER_SUPPLIER_VALIDATE=Purchase order recorded
|
||||
Notify_ORDER_SUPPLIER_APPROVE=Purchase order approved
|
||||
@ -205,6 +206,7 @@ EMailTextProposalClosedSignedWeb=Proposal %s has been closed signed on portal pa
|
||||
EMailTextProposalClosedRefused=Proposal %s has been closed refused.
|
||||
EMailTextProposalClosedRefusedWeb=Proposal %s has been closed refuse on portal page.
|
||||
EMailTextOrderValidated=Order %s has been validated.
|
||||
EMailTextOrderClose=Order %s has been delivered.
|
||||
EMailTextOrderApproved=Order %s has been approved.
|
||||
EMailTextOrderValidatedBy=Order %s has been recorded by %s.
|
||||
EMailTextOrderApprovedBy=Order %s has been approved by %s.
|
||||
|
||||
@ -40,6 +40,7 @@ notiftofixedemail=aux e-mails définis
|
||||
notiftouserandtofixedemail=Aux utilisateurs et e-mails définis
|
||||
Notify_ORDER_VALIDATE=Validation commande client
|
||||
Notify_ORDER_SENTBYMAIL=Envoi commande client par email
|
||||
Notify_ORDER_CLOSE=Commande client livrée
|
||||
Notify_ORDER_SUPPLIER_SENTBYMAIL=Envoi commande fournisseur par email
|
||||
Notify_ORDER_SUPPLIER_VALIDATE=Commande fournisseur enregistrée
|
||||
Notify_ORDER_SUPPLIER_APPROVE=Commande fournisseur approuvée
|
||||
@ -217,6 +218,7 @@ EMailTextProposalClosedSignedWeb=La proposition %s a été clôturée signée vi
|
||||
EMailTextProposalClosedRefused=La proposition %s a été fermée refusée.
|
||||
EMailTextProposalClosedRefusedWeb=La proposition %s a été fermée et refusée sur la page du portail.
|
||||
EMailTextOrderValidated=La commande %s a été validée.
|
||||
EMailTextOrderClose=La commande %s a été livrée.
|
||||
EMailTextOrderApproved=La commande %s a été approuvée.
|
||||
EMailTextOrderValidatedBy=La commande %s a été enregistrée par %s
|
||||
EMailTextOrderApprovedBy=La commande %s a été approuvée par %s.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user