Merge remote-tracking branch 'origin/3.9' into develop

Conflicts:
	htdocs/install/mysql/migration/repair.sql
This commit is contained in:
Laurent Destailleur 2016-05-17 01:19:49 +02:00
commit 05cbfbb38f
4 changed files with 41 additions and 44 deletions

View File

@ -328,8 +328,7 @@ if (empty($reshook))
$label = $lines[$i]->product_label;
}
if ($conf->global->PRODUIT_DESC_IN_FORM)
$desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
$desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
}
else {
$desc = dol_htmlentitiesbr($lines[$i]->desc);
@ -360,7 +359,6 @@ if (empty($reshook))
$error++;
break;
}
}
}
}

View File

@ -333,7 +333,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -390,6 +390,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id
else
{
$mesg=$mailfile->error;
setEventMessages($mesg, null, 'errors');
}
// END - Send mail
}
@ -438,7 +439,7 @@ if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $u
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -542,7 +543,7 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -583,7 +584,6 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user
else
{
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors');
$mesg="Impossible d'envoyer l'email.";
}
// END - Send mail
}
@ -627,7 +627,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -667,6 +667,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_
else
{
$mesg="Impossible d'envoyer l'email.";
setEventMessages($mesg, null, 'errors');
}
// END - Send mail
}
@ -756,7 +757,7 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -806,9 +807,8 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
endif;
else:
$mesg="Impossible d'envoyer l'email.";
$mesg="Impossible d'envoyer l'email.";
setEventMessages($mesg, null, 'errors');
endif;
// END - Send mail
}
@ -921,7 +921,7 @@ if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes")
$total_ht = $object_ligne->total_ht;
$total_tva = $object_ligne->total_tva;
$result=$object->deleteline(GETPOST("rowid"));
$result=$object->deleteline(GETPOST("rowid"), $user);
if ($result >= 0)
{
if ($result > 0)
@ -961,7 +961,6 @@ if ($action == "updateligne" )
$rowid = $_POST['rowid'];
$type_fees_id = GETPOST('fk_c_type_fees');
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
$projet_id = $fk_projet;
$comments = GETPOST('comments');
$qty = GETPOST('qty');
@ -983,6 +982,7 @@ if ($action == "updateligne" )
if (! $error)
{
// TODO Use update method of ExpenseReportLine
$result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id);
if ($result >= 0)
{
@ -1078,29 +1078,6 @@ $formfile = new FormFile($db);
$formproject = new FormProjets($db);
$projecttmp = new Project($db);
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
{
if(!empty($_GET['mesg']))
{
$text_mesg = explode(",",$_GET['mesg']);
foreach($text_mesg as $text)
{
$mesg.= "- ".$langs->trans($text)."<br />";
}
print "<div class=\"error\" style=\"font-size:15px;background-color:#FFB3B3;\">";
print $langs->trans("LINE_NOT_ADDED")."<br />";
print $mesg;
print "</div>";
}
else
{
if ($mesg) print "<div class=\"error\" style=\"font-size:16px;background-color:red;\">".$mesg."</div>";
}
}
// Create
if ($action == 'create')
{

View File

@ -68,7 +68,35 @@ delete from llx_adherent_extrafields where fk_object not in (select rowid from l
delete from llx_product_extrafields where fk_object not in (select rowid from llx_product);
--delete from llx_societe_commerciaux where fk_soc not in (select rowid from llx_societe);
-- Clean stocks
-- Reference for qty is llx_product_stock (detail in llx_product_batch may be not complete)
-- qty in llx_product may be not up to date
update llx_product_batch set batch = '' where batch = 'Non d&eacute;fini';
update llx_product_batch set batch = '' where batch = 'Non défini';
DELETE FROM llx_product_lot WHERE fk_product NOT IN (select rowid from llx_product);
DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product);
DELETE FROM llx_product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM llx_product_batch as pb);
-- Merge splitted lines into one in table llx_product_batch
DROP TABLE tmp_llx_product_batch;
DROP TABLE tmp_llx_product_batch2;
CREATE TABLE tmp_llx_product_batch AS select fk_product_stock, eatby, sellby, batch, SUM(qty) as qty, COUNT(rowid) as nb FROM llx_product_batch GROUP BY fk_product_stock, eatby, sellby, batch HAVING COUNT(rowid) > 1;
CREATE TABLE tmp_llx_product_batch2 AS select pb.rowid, pb.fk_product_stock, pb.eatby, pb.sellby, pb.batch, pb.qty from llx_product_batch as pb, tmp_llx_product_batch as tpb where pb.fk_product_stock = tpb.fk_product_stock and COALESCE(pb.eatby, '') = COALESCE(tpb.eatby,'') and COALESCE(pb.sellby, '') = COALESCE(tpb.sellby, '') and pb.batch = tpb.batch
--select * from tmp_llx_product_batch;
--select * from tmp_llx_product_batch2;
DELETE FROM llx_product_batch WHERE rowid IN (select rowid FROM tmp_llx_product_batch2);
INSERT INTO llx_product_batch(fk_product_stock, eatby, sellby, batch, qty) SELECT fk_product_stock, eatby, sellby, batch, qty FROM tmp_llx_product_batch;
DELETE FROM llx_product_stock WHERE reel = 0 AND rowid NOT IN (SELECT fk_product_stock FROM llx_product_batch as pb);
DELETE FROM llx_product_batch WHERE qty = 0;
-- Stock calculation on product
UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid);
-- Fix: delete category child with no category parent.
drop table tmp_categorie;
@ -123,12 +151,6 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, position) values
insert into llx_c_actioncomm (id, code, type, libelle, module, position) values ( 50, 'AC_OTH', 'system', 'Other' ,NULL, 5);
-- Stock calculation on product
DELETE FROM llx_product_stock WHERE fk_product NOT IN (select rowid from llx_product);
UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid);
-- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid;
-- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note);

View File

@ -1009,7 +1009,7 @@ class Societe extends CommonObject
global $langs;
global $conf;
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4)) return -1;
$sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm';
$sql .= ', s.status';