Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-03-05 21:46:40 +01:00
commit d569adea2f
4 changed files with 38 additions and 19 deletions

View File

@ -2365,9 +2365,12 @@ class Facture extends CommonInvoice
$final = ($this->lines[$i]->situation_percent == 100);
$i++;
}
if ($final) {
$this->setFinal($user);
}
if (empty($final)) $this->situation_final = 0;
else $this->situation_final = 1;
$this->setFinal($user);
}
}
}
@ -4070,7 +4073,6 @@ class Facture extends CommonInvoice
$this->db->begin();
$this->situation_final = 1;
$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id;
dol_syslog(__METHOD__, LOG_DEBUG);

View File

@ -101,8 +101,9 @@ $arrayfields=array(
'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1),
'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1),
'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1),
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1),
//'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1),
'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0),
//'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
//'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
);
@ -417,7 +418,7 @@ if (!empty($conf->projet->enabled)) $formproject=new FormProjets($db);
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type, p.entity,";
$sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,";
$sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql.= " m.batch,";
$sql.= " m.batch, m.price,";
$sql.= " pl.rowid as lotid, pl.eatby, pl.sellby,";
$sql.= " u.login, u.photo, u.lastname, u.firstname";
// Add fields from extrafields
@ -810,8 +811,17 @@ if ($resql)
print '<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).'">';
print '</td>';
}
if (! empty($arrayfields['m.price']['checked']))
{
// Price
print '<td class="liste_titre" align="left">';
print '&nbsp; ';
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
@ -849,8 +859,11 @@ if ($resql)
if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'],$_SERVER["PHP_SELF"], "m.price","",$param,'align="right"',$sortfield,$sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
@ -976,6 +989,13 @@ if ($resql)
print $objp->qty;
print '</td>';
}
if (! empty($arrayfields['m.price']['checked']))
{
// Price
print '<td align="right">';
print price($objp->price);
print '</td>';
}
// Action column
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined

View File

@ -176,11 +176,9 @@ $db->commit();
// Lecture des droits utilisateurs
$permsuser = array();
$sql = "SELECT DISTINCT r.id, r.libelle, r.module";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
$sql.= " ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= " WHERE ur.fk_id = r.id";
$sql.= " AND ur.entity = ".$entity;
$sql = "SELECT DISTINCT ur.fk_id";
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= " WHERE ur.entity = ".$entity;
$sql.= " AND ur.fk_user = ".$object->id;
dol_syslog("get user perms", LOG_DEBUG);
@ -192,7 +190,7 @@ if ($result)
while ($i < $num)
{
$obj = $db->fetch_object($result);
array_push($permsuser,$obj->id);
array_push($permsuser,$obj->fk_id);
$i++;
}
$db->free($result);
@ -205,12 +203,10 @@ else
// Lecture des droits groupes
$permsgroupbyentity = array();
$sql = "SELECT DISTINCT r.id, r.libelle, r.module, gu.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
$sql.= " ".MAIN_DB_PREFIX."usergroup_rights as gr,";
$sql = "SELECT DISTINCT gr.fk_id, gu.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu";
$sql.= " WHERE gr.fk_id = r.id";
$sql.= " AND gr.entity = ".$entity;
$sql.= " WHERE gr.entity = ".$entity;
$sql.= " AND gr.fk_usergroup = gu.fk_usergroup";
$sql.= " AND gu.fk_user = ".$object->id;
@ -225,7 +221,7 @@ if ($result)
$obj = $db->fetch_object($result);
if (! isset($permsgroupbyentity[$obj->entity]))
$permsgroupbyentity[$obj->entity] = array();
array_push($permsgroupbyentity[$obj->entity], $obj->id);
array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
$i++;
}
$db->free($result);

View File

@ -104,6 +104,7 @@ function migrate_product_photospath($product)
global $conf;
$dir = $conf->product->multidir_output[$product->entity];
$conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO = 1;
$origin = $dir .'/'. get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos";
$destin = $dir.'/'.dol_sanitizeFileName($product->ref);