Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/admin/tools/update.php
This commit is contained in:
commit
c3d78bf1b4
@ -41,8 +41,59 @@ require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
* Parameters
|
||||
*/
|
||||
|
||||
define(GEN_NUMBER_FACTURE, 5);
|
||||
|
||||
define(GEN_NUMBER_FACTURE, 1);
|
||||
$year = 2016;
|
||||
$dates = array (mktime(12,0,0,1,3,$year),
|
||||
mktime(12,0,0,1,9,$year),
|
||||
mktime(12,0,0,2,13,$year),
|
||||
mktime(12,0,0,2,23,$year),
|
||||
mktime(12,0,0,3,30,$year),
|
||||
mktime(12,0,0,4,3,$year),
|
||||
mktime(12,0,0,4,3,$year),
|
||||
mktime(12,0,0,5,9,$year),
|
||||
mktime(12,0,0,5,1,$year),
|
||||
mktime(12,0,0,5,13,$year),
|
||||
mktime(12,0,0,5,19,$year),
|
||||
mktime(12,0,0,5,23,$year),
|
||||
mktime(12,0,0,6,3,$year),
|
||||
mktime(12,0,0,6,19,$year),
|
||||
mktime(12,0,0,6,24,$year),
|
||||
mktime(12,0,0,7,3,$year),
|
||||
mktime(12,0,0,7,9,$year),
|
||||
mktime(12,0,0,7,23,$year),
|
||||
mktime(12,0,0,7,30,$year),
|
||||
mktime(12,0,0,8,9,$year),
|
||||
mktime(12,0,0,9,23,$year),
|
||||
mktime(12,0,0,10,3,$year),
|
||||
mktime(12,0,0,11,12,$year),
|
||||
mktime(12,0,0,11,13,$year),
|
||||
mktime(12,0,0,1,3,($year - 1)),
|
||||
mktime(12,0,0,1,9,($year - 1)),
|
||||
mktime(12,0,0,2,13,($year - 1)),
|
||||
mktime(12,0,0,2,23,($year - 1)),
|
||||
mktime(12,0,0,3,30,($year - 1)),
|
||||
mktime(12,0,0,4,3,($year - 1)),
|
||||
mktime(12,0,0,4,3,($year - 1)),
|
||||
mktime(12,0,0,5,9,($year - 1)),
|
||||
mktime(12,0,0,5,1,($year - 1)),
|
||||
mktime(12,0,0,5,13,($year - 1)),
|
||||
mktime(12,0,0,5,19,($year - 1)),
|
||||
mktime(12,0,0,5,23,($year - 1)),
|
||||
mktime(12,0,0,6,3,($year - 1)),
|
||||
mktime(12,0,0,6,19,($year - 1)),
|
||||
mktime(12,0,0,6,24,($year - 1)),
|
||||
mktime(12,0,0,7,3,($year - 1)),
|
||||
mktime(12,0,0,7,9,($year - 1)),
|
||||
mktime(12,0,0,7,23,($year - 1)),
|
||||
mktime(12,0,0,7,30,($year - 1)),
|
||||
mktime(12,0,0,8,9,($year - 1)),
|
||||
mktime(12,0,0,9,23,($year - 1)),
|
||||
mktime(12,0,0,10,3,($year - 1)),
|
||||
mktime(12,0,0,11,12,$year),
|
||||
mktime(12,0,0,11,13,$year),
|
||||
mktime(12,0,0,12,12,$year),
|
||||
mktime(12,0,0,12,13,$year),
|
||||
);
|
||||
|
||||
$ret=$user->fetch('','admin');
|
||||
if (! $ret > 0)
|
||||
@ -54,16 +105,15 @@ $user->getrights();
|
||||
|
||||
|
||||
$socids = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client=1";
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client in (1, 3)";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num_socs = $db->num_rows($resql);
|
||||
$num_thirdparties = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num_socs)
|
||||
while ($i < $num_thirdparties)
|
||||
{
|
||||
$i++;
|
||||
|
||||
$row = $db->fetch_row($resql);
|
||||
$socids[$i] = $row[0];
|
||||
}
|
||||
@ -79,7 +129,6 @@ if ($resql)
|
||||
while ($i < $num_prods)
|
||||
{
|
||||
$i++;
|
||||
|
||||
$row = $db->fetch_row($resql);
|
||||
$prodids[$i] = $row[0];
|
||||
}
|
||||
@ -90,46 +139,51 @@ $result=0;
|
||||
while ($i < GEN_NUMBER_FACTURE && $result >= 0)
|
||||
{
|
||||
$i++;
|
||||
$socid = mt_rand(1, $num_socs);
|
||||
$socid = mt_rand(1, $num_thirdparties);
|
||||
|
||||
print "Invoice ".$i." for socid ".$socid;
|
||||
|
||||
$facture = new Facture($db);
|
||||
$facture->date = time();
|
||||
$facture->cond_reglement_id = 3;
|
||||
$facture->mode_reglement_id = 3;
|
||||
$object = new Facture($db);
|
||||
$object->socid = $socids[$socid];
|
||||
$object->date = $dates[mt_rand(1, count($dates)-1)];
|
||||
$object->cond_reglement_id = 3;
|
||||
$object->mode_reglement_id = 3;
|
||||
|
||||
$result=$facture->create($user);
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch(mt_rand(1,2));
|
||||
$fuser->getRights();
|
||||
|
||||
$result=$object->create($fuser);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$result=$facture->validate($user);
|
||||
$nbp = mt_rand(2, 5);
|
||||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
$prodid = mt_rand(1, $num_prods);
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$object->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
}
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
$result=$object->validate($fuser);
|
||||
if ($result)
|
||||
{
|
||||
$nbp = mt_rand(2, 5);
|
||||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
$prodid = mt_rand(1, $num_prods);
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$facture->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
}
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
print " OK with ref ".$facture->ref."\n";;
|
||||
print " OK with ref ".$object->ref."\n";;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$facture->error);
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$facture->error);
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||
|
||||
|
||||
/*
|
||||
@ -47,7 +48,58 @@ include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
*/
|
||||
|
||||
define(GEN_NUMBER_COMMANDE, 10);
|
||||
|
||||
$year = 2016;
|
||||
$dates = array (mktime(12,0,0,1,3,$year),
|
||||
mktime(12,0,0,1,9,$year),
|
||||
mktime(12,0,0,2,13,$year),
|
||||
mktime(12,0,0,2,23,$year),
|
||||
mktime(12,0,0,3,30,$year),
|
||||
mktime(12,0,0,4,3,$year),
|
||||
mktime(12,0,0,4,3,$year),
|
||||
mktime(12,0,0,5,9,$year),
|
||||
mktime(12,0,0,5,1,$year),
|
||||
mktime(12,0,0,5,13,$year),
|
||||
mktime(12,0,0,5,19,$year),
|
||||
mktime(12,0,0,5,23,$year),
|
||||
mktime(12,0,0,6,3,$year),
|
||||
mktime(12,0,0,6,19,$year),
|
||||
mktime(12,0,0,6,24,$year),
|
||||
mktime(12,0,0,7,3,$year),
|
||||
mktime(12,0,0,7,9,$year),
|
||||
mktime(12,0,0,7,23,$year),
|
||||
mktime(12,0,0,7,30,$year),
|
||||
mktime(12,0,0,8,9,$year),
|
||||
mktime(12,0,0,9,23,$year),
|
||||
mktime(12,0,0,10,3,$year),
|
||||
mktime(12,0,0,11,12,$year),
|
||||
mktime(12,0,0,11,13,$year),
|
||||
mktime(12,0,0,1,3,($year - 1)),
|
||||
mktime(12,0,0,1,9,($year - 1)),
|
||||
mktime(12,0,0,2,13,($year - 1)),
|
||||
mktime(12,0,0,2,23,($year - 1)),
|
||||
mktime(12,0,0,3,30,($year - 1)),
|
||||
mktime(12,0,0,4,3,($year - 1)),
|
||||
mktime(12,0,0,4,3,($year - 1)),
|
||||
mktime(12,0,0,5,9,($year - 1)),
|
||||
mktime(12,0,0,5,1,($year - 1)),
|
||||
mktime(12,0,0,5,13,($year - 1)),
|
||||
mktime(12,0,0,5,19,($year - 1)),
|
||||
mktime(12,0,0,5,23,($year - 1)),
|
||||
mktime(12,0,0,6,3,($year - 1)),
|
||||
mktime(12,0,0,6,19,($year - 1)),
|
||||
mktime(12,0,0,6,24,($year - 1)),
|
||||
mktime(12,0,0,7,3,($year - 1)),
|
||||
mktime(12,0,0,7,9,($year - 1)),
|
||||
mktime(12,0,0,7,23,($year - 1)),
|
||||
mktime(12,0,0,7,30,($year - 1)),
|
||||
mktime(12,0,0,8,9,($year - 1)),
|
||||
mktime(12,0,0,9,23,($year - 1)),
|
||||
mktime(12,0,0,10,3,($year - 1)),
|
||||
mktime(12,0,0,11,12,$year),
|
||||
mktime(12,0,0,11,13,$year),
|
||||
mktime(12,0,0,12,12,$year),
|
||||
mktime(12,0,0,12,13,$year),
|
||||
);
|
||||
|
||||
$ret=$user->fetch('','admin');
|
||||
if ($ret <= 0)
|
||||
@ -57,34 +109,34 @@ if ($ret <= 0)
|
||||
}
|
||||
$user->getrights();
|
||||
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||
$societesid = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe where client in (1, 3)";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$num_thirdparties = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
while ($i < $num_thirdparties) {
|
||||
$i++;
|
||||
$row = $db->fetch_row($resql);
|
||||
$societesid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else { print "err"; }
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
|
||||
$commandesid = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$commandesid[$i] = $row[0];
|
||||
$i++;
|
||||
$row = $db->fetch_row($resql);
|
||||
$commandesid[$i] = $row[0];
|
||||
}
|
||||
}
|
||||
else { print "err"; }
|
||||
|
||||
|
||||
$prodids = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE tosell=1";
|
||||
$resql = $db->query($sql);
|
||||
@ -102,59 +154,6 @@ if ($resql)
|
||||
}
|
||||
|
||||
|
||||
$dates = array (mktime(12,0,0,1,3,2003),
|
||||
mktime(12,0,0,1,9,2003),
|
||||
mktime(12,0,0,2,13,2003),
|
||||
mktime(12,0,0,2,23,2003),
|
||||
mktime(12,0,0,3,30,2003),
|
||||
mktime(12,0,0,4,3,2003),
|
||||
mktime(12,0,0,4,3,2003),
|
||||
mktime(12,0,0,5,9,2003),
|
||||
mktime(12,0,0,5,1,2003),
|
||||
mktime(12,0,0,5,13,2003),
|
||||
mktime(12,0,0,5,19,2003),
|
||||
mktime(12,0,0,5,23,2003),
|
||||
mktime(12,0,0,6,3,2003),
|
||||
mktime(12,0,0,6,19,2003),
|
||||
mktime(12,0,0,6,24,2003),
|
||||
mktime(12,0,0,7,3,2003),
|
||||
mktime(12,0,0,7,9,2003),
|
||||
mktime(12,0,0,7,23,2003),
|
||||
mktime(12,0,0,7,30,2003),
|
||||
mktime(12,0,0,8,9,2003),
|
||||
mktime(12,0,0,9,23,2003),
|
||||
mktime(12,0,0,10,3,2003),
|
||||
mktime(12,0,0,11,12,2003),
|
||||
mktime(12,0,0,11,13,2003),
|
||||
mktime(12,0,0,1,3,2002),
|
||||
mktime(12,0,0,1,9,2002),
|
||||
mktime(12,0,0,2,13,2002),
|
||||
mktime(12,0,0,2,23,2002),
|
||||
mktime(12,0,0,3,30,2002),
|
||||
mktime(12,0,0,4,3,2002),
|
||||
mktime(12,0,0,4,3,2002),
|
||||
mktime(12,0,0,5,9,2002),
|
||||
mktime(12,0,0,5,1,2002),
|
||||
mktime(12,0,0,5,13,2002),
|
||||
mktime(12,0,0,5,19,2002),
|
||||
mktime(12,0,0,5,23,2002),
|
||||
mktime(12,0,0,6,3,2002),
|
||||
mktime(12,0,0,6,19,2002),
|
||||
mktime(12,0,0,6,24,2002),
|
||||
mktime(12,0,0,7,3,2002),
|
||||
mktime(12,0,0,7,9,2002),
|
||||
mktime(12,0,0,7,23,2002),
|
||||
mktime(12,0,0,7,30,2002),
|
||||
mktime(12,0,0,8,9,2002),
|
||||
mktime(12,0,0,9,23,2002),
|
||||
mktime(12,0,0,10,3,2002),
|
||||
mktime(12,0,0,11,12,2003),
|
||||
mktime(12,0,0,11,13,2003),
|
||||
mktime(12,0,0,12,12,2003),
|
||||
mktime(12,0,0,12,13,2003),
|
||||
);
|
||||
|
||||
require(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||
|
||||
|
||||
print "Build ".GEN_NUMBER_COMMANDE." orders\n";
|
||||
@ -162,53 +161,63 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
|
||||
{
|
||||
print "Process order ".$s."\n";
|
||||
|
||||
$com = new Commande($db);
|
||||
|
||||
$com->socid = 4;
|
||||
$com->date_commande = $dates[mt_rand(1, count($dates)-1)];
|
||||
$com->note = 'A comment';
|
||||
$com->source = 1;
|
||||
$com->fk_project = 0;
|
||||
$com->remise_percent = 0;
|
||||
$object = new Commande($db);
|
||||
|
||||
$object->socid = $societesid[mt_rand(1, $num_thirdparties)];
|
||||
$object->date_commande = $dates[mt_rand(1, count($dates)-1)];
|
||||
$object->note = 'My small comment about this order. Hum. Nothing.';
|
||||
$object->source = 1;
|
||||
$object->fk_project = 0;
|
||||
$object->remise_percent = 0;
|
||||
$object->shipping_method_id = mt_rand(1, 2);
|
||||
$object->cond_reglement_id = mt_rand(0, 2);
|
||||
$object->more_reglement_id = mt_rand(0, 7);
|
||||
$object->availability_id = mt_rand(0, 1);
|
||||
|
||||
$listofuserid=array(12,13,16);
|
||||
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($listofuserid[mt_rand(0,2)]);
|
||||
$fuser->getRights();
|
||||
|
||||
$db->begin();
|
||||
|
||||
$result=$com->create($user);
|
||||
$result=$object->create($fuser);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$result=$com->valid($user);
|
||||
$nbp = mt_rand(2, 5);
|
||||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
$prodid = mt_rand(1, $num_prods);
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$object->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
$result=$object->valid($fuser);
|
||||
if ($result > 0)
|
||||
{
|
||||
$nbp = mt_rand(2, 5);
|
||||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
$prodid = mt_rand(1, $num_prods);
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$com->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
}
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
$db->commit();
|
||||
print " OK with ref ".$com->ref."\n";
|
||||
print " OK with ref ".$object->ref."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " KO\n";
|
||||
$db->rollback();
|
||||
dol_print_error($db,$com->error);
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print " KO\n";
|
||||
$db->rollback();
|
||||
dol_print_error($db,$com->error);
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,8 +43,59 @@ require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
* Parameters
|
||||
*/
|
||||
|
||||
define(GEN_NUMBER_PROPAL, 5);
|
||||
|
||||
define(GEN_NUMBER_PROPAL, 10);
|
||||
$year = 2016;
|
||||
$dates = array (mktime(12,0,0,1,3,$year),
|
||||
mktime(12,0,0,1,9,$year),
|
||||
mktime(12,0,0,2,13,$year),
|
||||
mktime(12,0,0,2,23,$year),
|
||||
mktime(12,0,0,3,30,$year),
|
||||
mktime(12,0,0,4,3,$year),
|
||||
mktime(12,0,0,4,3,$year),
|
||||
mktime(12,0,0,5,9,$year),
|
||||
mktime(12,0,0,5,1,$year),
|
||||
mktime(12,0,0,5,13,$year),
|
||||
mktime(12,0,0,5,19,$year),
|
||||
mktime(12,0,0,5,23,$year),
|
||||
mktime(12,0,0,6,3,$year),
|
||||
mktime(12,0,0,6,19,$year),
|
||||
mktime(12,0,0,6,24,$year),
|
||||
mktime(12,0,0,7,3,$year),
|
||||
mktime(12,0,0,7,9,$year),
|
||||
mktime(12,0,0,7,23,$year),
|
||||
mktime(12,0,0,7,30,$year),
|
||||
mktime(12,0,0,8,9,$year),
|
||||
mktime(12,0,0,9,23,$year),
|
||||
mktime(12,0,0,10,3,$year),
|
||||
mktime(12,0,0,11,12,$year),
|
||||
mktime(12,0,0,11,13,$year),
|
||||
mktime(12,0,0,1,3,($year - 1)),
|
||||
mktime(12,0,0,1,9,($year - 1)),
|
||||
mktime(12,0,0,2,13,($year - 1)),
|
||||
mktime(12,0,0,2,23,($year - 1)),
|
||||
mktime(12,0,0,3,30,($year - 1)),
|
||||
mktime(12,0,0,4,3,($year - 1)),
|
||||
mktime(12,0,0,4,3,($year - 1)),
|
||||
mktime(12,0,0,5,9,($year - 1)),
|
||||
mktime(12,0,0,5,1,($year - 1)),
|
||||
mktime(12,0,0,5,13,($year - 1)),
|
||||
mktime(12,0,0,5,19,($year - 1)),
|
||||
mktime(12,0,0,5,23,($year - 1)),
|
||||
mktime(12,0,0,6,3,($year - 1)),
|
||||
mktime(12,0,0,6,19,($year - 1)),
|
||||
mktime(12,0,0,6,24,($year - 1)),
|
||||
mktime(12,0,0,7,3,($year - 1)),
|
||||
mktime(12,0,0,7,9,($year - 1)),
|
||||
mktime(12,0,0,7,23,($year - 1)),
|
||||
mktime(12,0,0,7,30,($year - 1)),
|
||||
mktime(12,0,0,8,9,($year - 1)),
|
||||
mktime(12,0,0,9,23,($year - 1)),
|
||||
mktime(12,0,0,10,3,($year - 1)),
|
||||
mktime(12,0,0,11,12,$year),
|
||||
mktime(12,0,0,11,13,$year),
|
||||
mktime(12,0,0,12,12,$year),
|
||||
mktime(12,0,0,12,13,$year),
|
||||
);
|
||||
|
||||
$ret=$user->fetch('','admin');
|
||||
if (! $ret > 0)
|
||||
@ -56,16 +107,15 @@ $user->getrights();
|
||||
|
||||
|
||||
$socids = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client=1";
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client in (1,3)";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num_socs = $db->num_rows($resql);
|
||||
$num_thirdparties = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num_socs)
|
||||
while ($i < $num_thirdparties)
|
||||
{
|
||||
$i++;
|
||||
|
||||
$row = $db->fetch_row($resql);
|
||||
$socids[$i] = $row[0];
|
||||
}
|
||||
@ -81,7 +131,6 @@ if ($resql)
|
||||
while ($i < $num_conts)
|
||||
{
|
||||
$i++;
|
||||
|
||||
$row = $db->fetch_row($resql);
|
||||
$contids[$row[1]][0] = $row[0]; // A ameliorer
|
||||
}
|
||||
@ -97,7 +146,6 @@ if ($resql)
|
||||
while ($i < $num_prods)
|
||||
{
|
||||
$i++;
|
||||
|
||||
$row = $db->fetch_row($resql);
|
||||
$prodids[$i] = $row[0];
|
||||
}
|
||||
@ -117,27 +165,25 @@ $result=0;
|
||||
while ($i < GEN_NUMBER_PROPAL && $result >= 0)
|
||||
{
|
||||
$i++;
|
||||
$socid = mt_rand(1, $num_socs);
|
||||
$socid = mt_rand(1, $num_thirdparties);
|
||||
print "Proposal ".$i." for socid ".$socid;
|
||||
|
||||
$soc = new Societe($db);
|
||||
|
||||
|
||||
$propal = new Propal($db);
|
||||
$object = new Propal($db);
|
||||
|
||||
$obj = $conf->global->PROPALE_ADDON;
|
||||
$modPropale = new $obj;
|
||||
$numpr = $modPropale->getNextValue($soc,$propal);
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch(mt_rand(1,2));
|
||||
$fuser->getRights();
|
||||
|
||||
$object->contactid = $contids[$socids[$socid]][0];
|
||||
$object->socid = $socids[$socid];
|
||||
$object->datep = $dates[mt_rand(1, count($dates)-1)];
|
||||
$object->cond_reglement_id = 3;
|
||||
$object->mode_reglement_id = 3;
|
||||
|
||||
$propal->ref = $numpr;
|
||||
$propal->contactid = $contids[$socids[$socid]][0];
|
||||
$propal->socid = $socids[$socid];
|
||||
$propal->datep = time();
|
||||
$propal->cond_reglement_id = 3;
|
||||
$propal->mode_reglement_id = 3;
|
||||
$propal->author = $user->id;
|
||||
|
||||
$result=$propal->create($user);
|
||||
$result=$object->create($fuser);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$nbp = mt_rand(2, 5);
|
||||
@ -147,18 +193,30 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
|
||||
$prodid = mt_rand(1, $num_prods);
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$propal->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
|
||||
$result=$object->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
$xnbp++;
|
||||
}
|
||||
print " OK with ref ".$propal->ref."\n";
|
||||
|
||||
$result=$object->valid($fuser);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
print " OK with ref ".$object->ref."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " KO\n";
|
||||
$db->rollback();
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -265,6 +265,7 @@ $configfileparameters=array(
|
||||
'?dolibarr_main_db_prefix' => $langs->trans("Prefix"),
|
||||
'separator2' => '',
|
||||
'dolibarr_main_authentication' => $langs->trans("AuthenticationMode"),
|
||||
'?multicompany_transverse_mode'=> $langs->trans("MultiCompanyMode"),
|
||||
'separator'=> '',
|
||||
'?dolibarr_main_auth_ldap_login_attribute' => 'dolibarr_main_auth_ldap_login_attribute',
|
||||
'?dolibarr_main_auth_ldap_host' => 'dolibarr_main_auth_ldap_host',
|
||||
@ -318,7 +319,11 @@ foreach($configfileparameters as $key => $value)
|
||||
{
|
||||
$newkey = preg_replace('/^\?/','',$key);
|
||||
|
||||
if (preg_match('/^\?/',$key) && empty(${$newkey})) continue; // We discard parametes starting with ?
|
||||
if (preg_match('/^\?/',$key) && empty(${$newkey}))
|
||||
{
|
||||
if ($newkey != 'multicompany_transverse_mode' || empty($conf->multicompany->enabled))
|
||||
continue; // We discard parameters starting with ?
|
||||
}
|
||||
if (strpos($newkey, 'separator') !== false && $lastkeyshown == 'separator') continue;
|
||||
|
||||
$var=!$var;
|
||||
|
||||
@ -49,6 +49,7 @@ if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
|
||||
if (!empty($conf->variants->enabled)) {
|
||||
@ -65,6 +66,7 @@ $langs->load('sendings');
|
||||
$langs->load('products');
|
||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled)) $langs->load('margins');
|
||||
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
|
||||
|
||||
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('orderid', 'int'));
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
@ -203,14 +203,13 @@ class modFacture extends DolibarrModules
|
||||
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bill';
|
||||
$this->export_icon[$r]='invoice';
|
||||
$this->export_permission[$r]=array(array("facture","facture","export","other"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
|
||||
//Add 'fd.label'=>"Label" to export_fields_array if you use it. Not used by dolibarr currently.
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>'Numeric','s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>'Numeric','f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Numeric','f.note_private'=>"Text",'f.note_public'=>"Text",'f.fk_user_author'=>'Numeric','uc.login'=>'Text','f.fk_user_valid'=>'Numeric','uv.login'=>'Text','pj.ref'=>'Text','fd.rowid'=>'Numeric','fd.label'=>'Text','fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.type'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.rest'=>'Rest','f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>'Numeric','s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>'Numeric','f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.rest'=>"NumericCompute",'f.paye'=>"Boolean",'f.fk_statut'=>'Numeric','f.note_private'=>"Text",'f.note_public'=>"Text",'f.fk_user_author'=>'Numeric','uc.login'=>'Text','f.fk_user_valid'=>'Numeric','uv.login'=>'Text','pj.ref'=>'Text','fd.rowid'=>'Numeric','fd.label'=>'Text','fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company', 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
|
||||
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$this->export_special_array[$r]=array('f.rest'=>'INVOICEREMAINTOPAY');
|
||||
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$keyforselect='facturedet'; $keyforelement='invoice_line'; $keyforaliasextra='extra2';
|
||||
@ -237,13 +236,13 @@ class modFacture extends DolibarrModules
|
||||
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bill';
|
||||
$this->export_icon[$r]='invoice';
|
||||
$this->export_permission[$r]=array(array("facture","facture","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Numeric','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric');
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>'Numeric','s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.type'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.rest'=>'Rest','f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>'Numeric','s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.rest'=>'NumericCompute','f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
|
||||
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$this->export_special_array[$r]=array('f.rest'=>'INVOICEREMAINTOPAY');
|
||||
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
|
||||
@ -243,8 +243,8 @@ if (empty($reshook))
|
||||
while (isset($_POST[$batch]))
|
||||
{
|
||||
// save line of detail into sub_qty
|
||||
$sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record
|
||||
$sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move
|
||||
$sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record
|
||||
$sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move
|
||||
$subtotalqty+=$sub_qty[$j]['q'];
|
||||
|
||||
//var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']);
|
||||
@ -262,9 +262,14 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
// Case we dont use the list of available qty for each warehouse/lot
|
||||
// GUI does not allow this yet
|
||||
setEventMessage('StockRequiredToChooseWhichLotToUse', 'errors');
|
||||
// No detail were provided for lots
|
||||
if (! empty($_POST[$qty]))
|
||||
{
|
||||
// We try to set an amount
|
||||
// Case we dont use the list of available qty for each warehouse/lot
|
||||
// GUI does not allow this yet
|
||||
setEventMessage('StockIsRequiredToChooseWhichLotToUse', 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isset($_POST[$stockLocation]))
|
||||
@ -810,7 +815,7 @@ if ($action == 'create')
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
// Lecture des expeditions deja effectuees
|
||||
// Load shipments already done for same order
|
||||
$object->loadExpeditions();
|
||||
|
||||
if ($numAsked)
|
||||
@ -919,6 +924,7 @@ if ($action == 'create')
|
||||
print '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">';
|
||||
print '</td>';
|
||||
|
||||
// Qty to ship
|
||||
$quantityAsked = $line->qty;
|
||||
if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
@ -938,7 +944,7 @@ if ($action == 'create')
|
||||
$stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number
|
||||
$deliverableQty=min($quantityToBeDelivered, $stock);
|
||||
if ($deliverableQty < 0) $deliverableQty = 0;
|
||||
if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() && is_object($product->stock_warehouse[$warehouse_id])))
|
||||
if (empty($conf->productbatch->enabled) || ! $product->hasbatch())
|
||||
{
|
||||
// Quantity to send
|
||||
print '<td align="center">';
|
||||
@ -1009,21 +1015,32 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
// Product need lot
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
|
||||
|
||||
|
||||
$staticwarehouse=new Entrepot($db);
|
||||
if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id);
|
||||
|
||||
$subj=0;
|
||||
// Define nb of lines suggested for this order line
|
||||
$nbofsuggested=0;
|
||||
if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch))
|
||||
{
|
||||
foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch)
|
||||
{
|
||||
$nbofsuggested++;
|
||||
}
|
||||
}
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
if (count($product->stock_warehouse[$warehouse_id]->detail_batch))
|
||||
if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch))
|
||||
{
|
||||
foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch)
|
||||
{
|
||||
//var_dump($dbatch);
|
||||
$batchStock = + $dbatch->qty; // To get a numeric
|
||||
$deliverableQty = min($quantityToBeDelivered,$batchStock);
|
||||
print '<tr><td colspan="3" ></td><td align="center">';
|
||||
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'>';
|
||||
print '<td colspan="3" ></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
print '</td>';
|
||||
|
||||
@ -1045,8 +1062,8 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<!-- Case -->';
|
||||
print '<tr><td colspan="3"></td><td align="center">';
|
||||
print '<!-- Case there is no details of lot at all -->';
|
||||
print '<tr '.$bc[$var].'><td colspan="3"></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
|
||||
print '</td>';
|
||||
|
||||
@ -1066,6 +1083,15 @@ if ($action == 'create')
|
||||
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
$subj=0;
|
||||
// Define nb of lines suggested for this order line
|
||||
$nbofsuggested=0;
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
if ($stock_warehouse->real > 0)
|
||||
{
|
||||
$nbofsuggested++;
|
||||
}
|
||||
}
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) // $stock_warehouse is product_stock
|
||||
{
|
||||
$warehouseObject=new Entrepot($db);
|
||||
@ -1076,7 +1102,8 @@ if ($action == 'create')
|
||||
$deliverableQty = min($quantityToBeDelivered,$stock);
|
||||
$deliverableQty = max(0, $deliverableQty);
|
||||
// Quantity to send
|
||||
print '<tr><td colspan="3" ></td><td align="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.') -->';
|
||||
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'>';
|
||||
print '<td colspan="3" ></td><td align="center"><!-- qty to ship (no lot management for product line indiceAsked='.$indiceAsked.') -->';
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
@ -1146,16 +1173,27 @@ if ($action == 'create')
|
||||
|
||||
$warehouseObject=new Entrepot($db);
|
||||
$productlotObject=new Productlot($db);
|
||||
// Define nb of lines suggested for this order line
|
||||
$nbofsuggested=0;
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
|
||||
foreach ($stock_warehouse->detail_batch as $dbatch)
|
||||
{
|
||||
$nbofsuggested++;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
$warehouseObject->fetch($warehouse_id);
|
||||
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
|
||||
foreach ($stock_warehouse->detail_batch as $dbatch)
|
||||
foreach ($stock_warehouse->detail_batch as $dbatch)
|
||||
{
|
||||
//var_dump($dbatch);
|
||||
$batchStock = + $dbatch->qty; // To get a numeric
|
||||
$deliverableQty = min($quantityToBeDelivered,$batchStock);
|
||||
print '<tr><td colspan="3"></td><td align="center">';
|
||||
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'><td colspan="3"></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
print '</td>';
|
||||
|
||||
@ -1185,10 +1223,14 @@ if ($action == 'create')
|
||||
if ($subj == 0) // Line not shown yet, we show it
|
||||
{
|
||||
print '<!-- line not shown yet, we show it -->';
|
||||
print '<tr><td colspan="3" ></td><td align="center">';
|
||||
print '<tr '.$bc[$var].'><td colspan="3" ></td><td align="center">';
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
//$disabled='disabled="disabled"';
|
||||
$disabled='';
|
||||
if (! empty($conf->productbatch->enabled) && $product->hasbatch())
|
||||
{
|
||||
$disabled='disabled="disabled"';
|
||||
}
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled?' '.$disabled:'').'> ';
|
||||
}
|
||||
else
|
||||
|
||||
@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("banks");
|
||||
|
||||
$chid=GETPOST("id");
|
||||
$action=GETPOST('action');
|
||||
@ -62,22 +63,22 @@ if ($action == 'add_payment')
|
||||
|
||||
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
|
||||
if (! $_POST["fk_typepayment"] > 0)
|
||||
if (! ($_POST["fk_typepayment"] > 0))
|
||||
{
|
||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($datepaid == '')
|
||||
{
|
||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date"));
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && ! $accountid > 0)
|
||||
if (! empty($conf->banque->enabled) && ! ($accountid > 0))
|
||||
{
|
||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit"));
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToDebit")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$paymentid = 0;
|
||||
@ -163,7 +164,6 @@ $form=new Form($db);
|
||||
// Form to create expense report payment
|
||||
if (GETPOST("action") == 'create')
|
||||
{
|
||||
|
||||
$expensereport = new ExpenseReport($db);
|
||||
$expensereport->fetch($chid);
|
||||
|
||||
@ -171,11 +171,6 @@ if (GETPOST("action") == 'create')
|
||||
|
||||
print load_fiche_titre($langs->trans("DoPayment"));
|
||||
|
||||
if ($mesg)
|
||||
{
|
||||
print "<div class=\"error\">$mesg</div>";
|
||||
}
|
||||
|
||||
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$chid.'">';
|
||||
@ -222,12 +217,15 @@ if (GETPOST("action") == 'create')
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Number
|
||||
print '<tr><td>'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
@ -243,9 +241,7 @@ if (GETPOST("action") == 'create')
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Autres charges impayees
|
||||
*/
|
||||
// List of expenses ereport not already paid completely
|
||||
$num = 1;
|
||||
$i = 0;
|
||||
|
||||
|
||||
@ -1696,8 +1696,10 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
|
||||
if ($doliurl) print '<a class="help" target="_blank" href="'.$doliurl.'">';
|
||||
else print '<span class="help">';
|
||||
print $appli;
|
||||
if ($doliurl) print '</a>';
|
||||
else print '</span>';
|
||||
print '</div>'."\n";
|
||||
|
||||
// Link to bugtrack
|
||||
|
||||
@ -1635,7 +1635,7 @@ font.vsmenudisabled { font-size:<?php print $fontsize ?>px; font-family: <?php p
|
||||
a.vsmenu:link, a.vsmenu:visited { color: #<?php echo $colortextbackvmenu; ?>; white-space: nowrap; }
|
||||
font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; }
|
||||
|
||||
a.help:link, a.help:visited, a.help:hover, a.help:active { font-size:<?php print $fontsizesmaller ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: normal; color: #666666; text-decoration: none; }
|
||||
a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:<?php print $fontsizesmaller ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: normal; color: #666666; text-decoration: none; }
|
||||
|
||||
.vmenu div.blockvmenufirst, .vmenu div.blockvmenulogo, .vmenu div.blockvmenusearchphone, .vmenu div.blockvmenubookmarks
|
||||
{
|
||||
|
||||
@ -1646,7 +1646,7 @@ font.vsmenudisabled { font-size:<?php print $fontsize ?>px; font-family: <?php p
|
||||
a.vsmenu:link, a.vsmenu:visited { color: #<?php echo $colortextbackvmenu; ?>; white-space: nowrap; }
|
||||
font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; }
|
||||
|
||||
a.help:link, a.help:visited, a.help:hover, a.help:active { font-size:<?php print $fontsizesmaller ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: normal; color: #666666; text-decoration: none; }
|
||||
a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:<?php print $fontsizesmaller ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: normal; color: #666666; text-decoration: none; }
|
||||
|
||||
|
||||
div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks
|
||||
|
||||
Loading…
Reference in New Issue
Block a user