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

View File

@ -102,6 +102,7 @@ $arrayfields=array(
'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1), 'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1),
'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1), 'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1),
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1), '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.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
//'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), '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 = "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.= " 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.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.= " pl.rowid as lotid, pl.eatby, pl.sellby,";
$sql.= " u.login, u.photo, u.lastname, u.firstname"; $sql.= " u.login, u.photo, u.lastname, u.firstname";
// Add fields from extrafields // 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 '<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['m.price']['checked']))
{
// Price
print '<td class="liste_titre" align="left">';
print '&nbsp; ';
print '</td>';
}
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook // Fields from hook
$parameters=array('arrayfields'=>$arrayfields); $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook $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['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['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.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 // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
$parameters=array('arrayfields'=>$arrayfields); $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook $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 $objp->qty;
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['m.price']['checked']))
{
// Price
print '<td align="right">';
print price($objp->price);
print '</td>';
}
// Action column // Action column
print '<td class="nowrap" align="center">'; 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 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 // Lecture des droits utilisateurs
$permsuser = array(); $permsuser = array();
$sql = "SELECT DISTINCT r.id, r.libelle, r.module"; $sql = "SELECT DISTINCT ur.fk_id";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r,"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= " ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= " WHERE ur.entity = ".$entity;
$sql.= " WHERE ur.fk_id = r.id";
$sql.= " AND ur.entity = ".$entity;
$sql.= " AND ur.fk_user = ".$object->id; $sql.= " AND ur.fk_user = ".$object->id;
dol_syslog("get user perms", LOG_DEBUG); dol_syslog("get user perms", LOG_DEBUG);
@ -192,7 +190,7 @@ if ($result)
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
array_push($permsuser,$obj->id); array_push($permsuser,$obj->fk_id);
$i++; $i++;
} }
$db->free($result); $db->free($result);
@ -205,12 +203,10 @@ else
// Lecture des droits groupes // Lecture des droits groupes
$permsgroupbyentity = array(); $permsgroupbyentity = array();
$sql = "SELECT DISTINCT r.id, r.libelle, r.module, gu.entity"; $sql = "SELECT DISTINCT gr.fk_id, gu.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r,"; $sql.= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
$sql.= " ".MAIN_DB_PREFIX."usergroup_rights as gr,";
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu"; $sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu";
$sql.= " WHERE gr.fk_id = r.id"; $sql.= " WHERE gr.entity = ".$entity;
$sql.= " AND gr.entity = ".$entity;
$sql.= " AND gr.fk_usergroup = gu.fk_usergroup"; $sql.= " AND gr.fk_usergroup = gu.fk_usergroup";
$sql.= " AND gu.fk_user = ".$object->id; $sql.= " AND gu.fk_user = ".$object->id;
@ -225,7 +221,7 @@ if ($result)
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
if (! isset($permsgroupbyentity[$obj->entity])) if (! isset($permsgroupbyentity[$obj->entity]))
$permsgroupbyentity[$obj->entity] = array(); $permsgroupbyentity[$obj->entity] = array();
array_push($permsgroupbyentity[$obj->entity], $obj->id); array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
$i++; $i++;
} }
$db->free($result); $db->free($result);

View File

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