Merge branch '15.0' of github.com:Dolibarr/dolibarr into FIX_VacantPosition
This commit is contained in:
commit
8d14d18638
@ -77,7 +77,6 @@ if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) {
|
||||
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||
}
|
||||
|
||||
|
||||
$res = 0;
|
||||
if (!$res && file_exists("../main.inc.php")) {
|
||||
$res = include '../main.inc.php';
|
||||
|
||||
@ -192,6 +192,7 @@ $limit = 5;
|
||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " WHERE p.type = 'bank-transfer'";
|
||||
$sql .= " AND p.entity IN (".getEntity('invoice').")";
|
||||
$sql .= " ORDER BY datec DESC";
|
||||
$sql .= $db->plimit($limit);
|
||||
|
||||
|
||||
@ -262,12 +262,20 @@ if ($id) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
} else {
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
}
|
||||
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
|
||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||
$sql .= " AND f.fk_soc = s.rowid";
|
||||
$sql .= " AND pf.fk_facture = f.rowid";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " AND pf.fk_facture_fourn = f.rowid";
|
||||
} else {
|
||||
$sql .= " AND pf.fk_facture = f.rowid";
|
||||
}
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql .= " AND pl.rowid = ".((int) $id);
|
||||
if ($socid) {
|
||||
|
||||
@ -189,18 +189,13 @@ if ($object->id > 0) {
|
||||
}
|
||||
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddAction").'</a>';
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||
$param = '&id='.$object->id.'&socid='.$socid;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
@ -211,7 +206,7 @@ if ($object->id > 0) {
|
||||
}
|
||||
|
||||
|
||||
//print load_fiche_titre($langs->trans("ActionsOnJob"), '', '');
|
||||
print load_fiche_titre($langs->trans("ActionsOnJob"), $newcardbutton, '');
|
||||
|
||||
// List of all actions
|
||||
$filters = array();
|
||||
|
||||
@ -42,4 +42,5 @@ HideLots=Hide lots
|
||||
#Traceability - qc status
|
||||
OutOfOrder=Out of order
|
||||
InWorkingOrder=In working order
|
||||
ToReplace=Replace
|
||||
ToReplace=Replace
|
||||
CantMoveNonExistantSerial=Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.
|
||||
|
||||
@ -79,5 +79,6 @@ NoEval=Aucune évaluation effectuée pour cet employé
|
||||
HowManyUserWithThisMaxNote=Nombre d'employés avec ce niveau
|
||||
HighestRank=Plus haut niveau
|
||||
SkillComparison=Comparaison des compétences
|
||||
ActionsOnJob=Événements sur cet emploi
|
||||
VacantPosition=Poste vacant
|
||||
VacantCheckboxHelper=Cocher cette option affichera le(s) poste(s) comme non pourvu(s)
|
||||
|
||||
@ -43,3 +43,4 @@ HideLots=Masquer les lots
|
||||
OutOfOrder=Hors d'usage
|
||||
InWorkingOrder=En état de marche
|
||||
ToReplace=Remplacer
|
||||
CantMoveNonExistantSerial=Erreur : Vous avez demandé un mouvement sur un numéro de série qui n’existe plus. Peut-être avez-vous requis le même numéro de série plusieurs fois dans une même expédition, ou il a déjà servi dans une autre expédition. Supprimez cette expédition et préparez-en une autre.
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
|
||||
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
|
||||
//if (! defined('NOSESSION')) define('NOSESSION', '1'); // Disable session
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
|
||||
@ -959,7 +959,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
|
||||
$delallowed = $usercancreate;
|
||||
$modulepart = 'stock';
|
||||
|
||||
print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
|
||||
print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
@ -851,7 +851,9 @@ class MouvementStock extends CommonObject
|
||||
*/
|
||||
private function createBatch($dluo, $qty)
|
||||
{
|
||||
global $user;
|
||||
global $user, $langs;
|
||||
|
||||
$langs->load('productbatch');
|
||||
|
||||
$pdluo = new Productbatch($this->db);
|
||||
|
||||
@ -862,7 +864,7 @@ class MouvementStock extends CommonObject
|
||||
$result = $pdluo->fetch($dluo);
|
||||
if (empty($pdluo->id)) {
|
||||
// We didn't find the line. May be it was deleted before by a previous move in same transaction.
|
||||
$this->error = 'Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.';
|
||||
$this->error = $langs->trans('CantMoveNonExistantSerial');
|
||||
$this->errors[] = $this->error;
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
@ -635,11 +635,24 @@ class Reception extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Change status of order to "reception in process"
|
||||
$ret = $this->setStatut(4, $this->origin_id, 'commande_fournisseur');
|
||||
|
||||
if (!$ret) {
|
||||
// Change status of order to "reception in process" or "totally received"
|
||||
$status = $this->getStatusDispatch();
|
||||
if ($status < 0) {
|
||||
$error++;
|
||||
} else {
|
||||
$trigger_key = '';
|
||||
if ($status == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) {
|
||||
$ret = $this->commandeFournisseur->Livraison($user, dol_now(), 'tot', '');
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
$this->errors = array_merge($this->errors, $this->commandeFournisseur->errors);
|
||||
}
|
||||
} else {
|
||||
$ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur', $trigger_key);
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
@ -707,7 +720,92 @@ class Reception extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status from all dispatched lines
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function getStatusDispatch()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php';
|
||||
|
||||
$status = CommandeFournisseur::STATUS_RECEIVED_PARTIALLY;
|
||||
|
||||
if (!empty($this->origin) && $this->origin_id > 0 && ($this->origin == 'order_supplier' || $this->origin == 'commandeFournisseur')) {
|
||||
if (empty($this->commandeFournisseur)) {
|
||||
$this->commandeFournisseur = null;
|
||||
$this->fetch_origin();
|
||||
if (empty($this->commandeFournisseur->lines)) {
|
||||
$res = $this->commandeFournisseur->fetch_lines();
|
||||
if ($res < 0) return $res;
|
||||
}
|
||||
}
|
||||
|
||||
$qty_received = array();
|
||||
$qty_wished = array();
|
||||
|
||||
$supplierorderdispatch = new CommandeFournisseurDispatch($this->db);
|
||||
$filter = array('t.fk_commande'=>$this->origin_id);
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) {
|
||||
$filter['t.status'] = 1; // Restrict to lines with status validated
|
||||
}
|
||||
|
||||
$ret = $supplierorderdispatch->fetchAll('', '', 0, 0, $filter);
|
||||
if ($ret < 0) {
|
||||
$this->error = $supplierorderdispatch->error;
|
||||
$this->errors = $supplierorderdispatch->errors;
|
||||
return $ret;
|
||||
} else {
|
||||
// build array with quantity received by product in all supplier orders (origin)
|
||||
foreach ($supplierorderdispatch->lines as $dispatch_line) {
|
||||
$qty_received[$dispatch_line->fk_product] += $dispatch_line->qty;
|
||||
}
|
||||
|
||||
// qty wished in order supplier (origin)
|
||||
foreach ($this->commandeFournisseur->lines as $origin_line) {
|
||||
// exclude lines not qualified for reception
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $origin_line->product_type > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$qty_wished[$origin_line->fk_product] += $origin_line->qty;
|
||||
}
|
||||
|
||||
// compare array
|
||||
$diff_array = array_diff_assoc($qty_received, $qty_wished); // Warning: $diff_array is done only on common keys.
|
||||
$keys_in_wished_not_in_received = array_diff(array_keys($qty_wished), array_keys($qty_received));
|
||||
$keys_in_received_not_in_wished = array_diff(array_keys($qty_received), array_keys($qty_wished));
|
||||
|
||||
if (count($diff_array) == 0 && count($keys_in_wished_not_in_received) == 0 && count($keys_in_received_not_in_wished) == 0) { // no diff => mean everything is received
|
||||
$status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY;
|
||||
} elseif (!empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED)) {
|
||||
// set totally received if more products received than ordered
|
||||
$close = 0;
|
||||
|
||||
if (count($diff_array) > 0) {
|
||||
// there are some difference between the two arrays
|
||||
// scan the array of results
|
||||
foreach ($diff_array as $key => $value) {
|
||||
// if the quantity delivered is greater or equal to ordered quantity
|
||||
if ($qty_received[$key] >= $qty_wished[$key]) {
|
||||
$close++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($close == count($diff_array)) {
|
||||
// all the products are received equal or more than the ordered quantity
|
||||
$status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an reception line.
|
||||
|
||||
@ -621,10 +621,10 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
if (is_array($val) && count($val)) {
|
||||
foreach ($val as $skey) {
|
||||
if ($skey != '') {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
$param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : "";
|
||||
}
|
||||
}
|
||||
} elseif ($search[$key] != '') {
|
||||
|
||||
@ -262,7 +262,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST(
|
||||
exit();
|
||||
}
|
||||
|
||||
$prodcomb->variation_weight = $weight_impact;
|
||||
$prodcomb->variation_weight = price2num($weight_impact);
|
||||
|
||||
// for conf PRODUIT_MULTIPRICES
|
||||
if ($conf->global->PRODUIT_MULTIPRICES) {
|
||||
|
||||
@ -230,7 +230,7 @@ $original_file = str_replace('..\\', '/', $original_file);
|
||||
$refname = basename(dirname($original_file)."/");
|
||||
|
||||
// Check that file is allowed for view with viewimage.php
|
||||
if (!dolIsAllowedForPreview($original_file)) {
|
||||
if (!empty($original_file) && !dolIsAllowedForPreview($original_file)) {
|
||||
accessforbidden('This file is not qualified for preview', 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user