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

This commit is contained in:
florian HENRY 2017-02-17 13:24:48 +01:00
commit 4521a5d7e0
40 changed files with 1316 additions and 523 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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

View File

@ -255,9 +255,9 @@ else {
print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . $description . '</td>';
print '<td align="right">' . number_format($line->debit, 2, ',', ' ') . '</td>';
print '<td align="right">' . number_format($line->credit, 2, ',', ' ') . '</td>';
print '<td align="right">' . number_format($line->credit - $line->debit, 2, ',', ' ') . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
print '<td align="right">' . price($line->credit - $line->debit) . '</td>';
print '<td align="center">' . $link;
print '</td>';
print "</tr>\n";

View File

@ -114,14 +114,14 @@ if (! empty($conf->expensereport->enabled)) // TODO Move this in the default ac
print "<br>\n";
print "<br>\n";
}
if (! empty($conf->loan->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
/*
if (! empty($conf->loan->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
print "<br>\n";
}
/*
if (! empty($conf->don->enabled))
{
$step++;

View File

@ -131,7 +131,7 @@ elseif ($action == 'synchronize')
}
else
{
setEventMessages($langs->trans('multicurrency_syncronize_error', $reponse->error->info), null, 'errors');
setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors');
}
}
@ -376,4 +376,4 @@ print '
llxFooter();
$db->close();
$db->close();

View File

@ -26,14 +26,35 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$langs->load("admin");
$langs->load("help");
$langs->load("members");
$langs->load("other");
$youuselaststable = 0;
$action=GETPOST('action','alpha');
if (! $user->admin) accessforbidden();
$sfurl = '';
$version='0.0';
/*
* Actions
*/
if ($action == 'getlastversion')
{
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
}
/*
* View
@ -50,51 +71,49 @@ print '<div style="padding-left: 30px;">'.img_picto_common('', 'dolibarr_box.png
print '<div class="fichecenter"><div class="fichehalfleft">';
print $langs->trans("Version").' / '.$langs->trans("DolibarrLicense").':';
print '<ul>';
print '<li><strong>'.DOL_VERSION.'</strong>';
print $langs->trans("CurrentVersion").' : <strong>'.DOL_VERSION.'</strong><br>';
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl)
if (function_exists('curl_init'))
{
$i=0;
$version='0.0';
while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000)
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
if ($action == 'getlastversion')
{
$title=$sfurl->channel[0]->item[$i]->title;
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
if ($sfurl)
{
$newversion=$reg[1];
$newversionarray=explode('.',$newversion);
$versionarray=explode('.',$version);
//var_dump($newversionarray);var_dump($versionarray);
if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion;
while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000)
{
$title=$sfurl->channel[0]->item[$i]->title;
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
{
$newversion=$reg[1];
$newversionarray=explode('.',$newversion);
$versionarray=explode('.',$version);
//var_dump($newversionarray);var_dump($versionarray);
if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion;
}
$i++;
}
// Show version
print $langs->trans("LastStableVersion").' : <b>'. (($version != '0.0')?$version:$langs->trans("Unknown")) .'</b><br>';
}
else
{
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
}
$i++;
}
// Show version
if ($version != '0.0')
else
{
print ' ('.$langs->trans("LastStableVersion").': <b>'.$version.'</b>';
if (DOL_VERSION == $version)
{
$youuselaststable=1;
print $langs->trans("YouUseLastStableVersion");
}
print ')';
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="button">' .$langs->trans("Check").'</a><br>';
}
}
else
{
print ' ('.$langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b>)<br>';
}
print ' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
print '<br>';
print '</ul>';
print $langs->trans("DolibarrLicense").' : ';
print '<ul><li>';
print '<a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
print '</li></ul>';
//print "<br>\n";

View File

@ -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;

View File

@ -69,7 +69,9 @@ llxHeader('',$langs->trans("Upgrade"),$wikihelp);
print load_fiche_titre($langs->trans("Upgrade"),'','title_setup');
print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>';
print '<br>';
print $langs->trans("CurrentVersion").' : <strong>'.DOL_VERSION.'</strong><br>';
if (function_exists('curl_init'))
{

View File

@ -1328,7 +1328,16 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$cssclass.= " unmovable";
}
}
else $cssclass.= " movable";
else{
if ($user->rights->agenda->allactions->create ||
(($event->authorid == $user->id || $event->userownerid == $user->id) && $user->rights->agenda->myactions->create))
{
$cssclass.= " movable";
}else{
$cssclass.= " unmovable";
}
}
$h=''; $nowrapontd=1;
if ($action == 'show_day') { $h='height: 100%; '; $nowrapontd=0; }

View File

@ -178,7 +178,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
$search_categ='';
$search_user='';
@ -363,7 +363,7 @@ if ($resql)
$arrayofselected=is_array($toselect)?$toselect:array();
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
$param='&viewstatut='.$viewstatut;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.='&sall='.$sall;
@ -377,6 +377,7 @@ if ($resql)
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
if ($search_login) $param.='&search_login='.$search_login;
if ($search_town) $param.='&search_town='.$search_town;
if ($socid > 0) $param.='&socid='.$socid;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
@ -436,8 +437,8 @@ if ($resql)
dol_fiche_head(null, '', '');
$topicmail="SendProposalRef";
$modelmail="propal_send";
$topicmail="SendSupplierProposalRef";
$modelmail="supplier_proposal_send";
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';

View File

@ -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');

View File

@ -509,10 +509,11 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("BoxTitleLastModifiedDonations",$max).'</td>';
print '<td class="liste_titre" align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td class="liste_titre" align="right">'.$langs->trans("DateModificationShort").'</td>';
print '<td class="liste_titre" width="16">&nbsp;</td>';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("BoxTitleLastModifiedDonations",$max).'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
print '<td width="16">&nbsp;</td>';
print '</tr>';
if ($num)
{

View File

@ -203,7 +203,7 @@ if ($action == 'valide')
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/paiement/list.php">' . $langs->trans("BackToList") . '</a>';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<table class="border centpercent">'."\n";
// Ref
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">';

View File

@ -659,6 +659,7 @@ while ($i < min($num,$limit))
$contactstatic->id=$obj->cidp;
$contactstatic->statut=$obj->statut;
$contactstatic->poste=$obj->poste;
$contactstatic->email=$obj->email;
$contactstatic->phone_pro=$obj->phone_pro;
$contactstatic->phone_perso=$obj->phone_perso;
$contactstatic->phone_mobile=$obj->phone_mobile;

View File

@ -89,6 +89,22 @@ abstract class CommonInvoice extends CommonObject
const STATUS_ABANDONED = 3;
/**
* Return remain amount to pay.
* Property ->id and ->total_ttc must be set.
*
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return int Remain of amount to pay
*/
function getRemainToPay($multicurrency=0)
{
$alreadypaid=0;
$alreadypaid+=$this->getSommePaiement($multicurrency);
$alreadypaid+=$this->getSumDepositsUsed($multicurrency);
$alreadypaid+=$this->getSumCreditNotesUsed($multicurrency);
return $this->total_ttc - $alreadypaid;
}
/**
* Return amount of payments already done
*
@ -124,38 +140,10 @@ abstract class CommonInvoice extends CommonObject
return -1;
}
}
/**
* Return amount (with tax) of all credit notes and deposits invoices used by invoice
*
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
*/
function getSumCreditNotesUsed($multicurrency=0)
{
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
{
// TODO
return 0;
}
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
$discountstatic=new DiscountAbsolute($this->db);
$result=$discountstatic->getSumCreditNotesUsed($this, $multicurrency);
if ($result >= 0)
{
return $result;
}
else
{
$this->error=$discountstatic->error;
return -1;
}
}
/**
* Return amount (with tax) of all deposits invoices used by invoice
* Return amount (with tax) of all deposits invoices used by invoice.
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
*
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return int <0 if KO, Sum of deposits amount otherwise
@ -182,7 +170,35 @@ abstract class CommonInvoice extends CommonObject
return -1;
}
}
/**
* Return amount (with tax) of all credit notes and deposits invoices used by invoice
*
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
*/
function getSumCreditNotesUsed($multicurrency=0)
{
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
{
// TODO
return 0;
}
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
$discountstatic=new DiscountAbsolute($this->db);
$result=$discountstatic->getSumCreditNotesUsed($this, $multicurrency);
if ($result >= 0)
{
return $result;
}
else
{
$this->error=$discountstatic->error;
return -1;
}
}
/**
* Renvoie tableau des ids de facture avoir issus de la facture

View File

@ -374,20 +374,21 @@ class DiscountAbsolute
/**
* Return amount (with tax) of all credit notes and deposits invoices used by invoice
* Return amount (with tax) of all deposits invoices used by invoice as a payment.
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
*
* @param Facture $invoice Object invoice
* @param int $multicurrency Return multicurrency_amount instead of amount
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
*/
function getSumCreditNotesUsed($invoice, $multicurrency=0)
function getSumDepositsUsed($invoice, $multicurrency=0)
{
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id;
$sql.= ' AND f.type = 2';
$sql.= ' AND f.type = 3';
dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG);
dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@ -402,20 +403,20 @@ class DiscountAbsolute
}
/**
* Return amount (with tax) of all deposits invoices used by invoice
* Return amount (with tax) of all credit notes and deposits invoices used by invoice as a payment
*
* @param Facture $invoice Object invoice
* @param int $multicurrency Return multicurrency_amount instead of amount
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
*/
function getSumDepositsUsed($invoice, $multicurrency=0)
function getSumCreditNotesUsed($invoice, $multicurrency=0)
{
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id;
$sql.= ' AND f.type = 3';
$sql.= ' AND f.type = 2';
dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG);
dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{

View File

@ -329,7 +329,7 @@ class FormMail extends Form
$out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1);
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
$out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Use').'" name="modelselected" id="modelselected">';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">';
$out.= ' &nbsp; ';
$out.= '</div>';
}
@ -343,7 +343,7 @@ class FormMail extends Form
$out.= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put disabled on option, it is already on select and it makes chrome crazy.
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
$out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Use').'" name="modelselected" disabled="disabled" id="modelselected">';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" disabled="disabled" id="modelselected">';
$out.= ' &nbsp; ';
$out.= '</div>';
}

View File

@ -763,6 +763,11 @@ function activateModule($value,$withdeps=1)
return $ret;
}
$const_name = $objMod->const_name;
if(!empty($conf->global->$const_name)){
return $ret;
}
$result=$objMod->init();
if ($result <= 0)
{
@ -784,7 +789,13 @@ function activateModule($value,$withdeps=1)
if (file_exists($dir.$objMod->depends[$i].".class.php"))
{
$resarray = activateModule($objMod->depends[$i]);
if (empty($resarray['errors'])) $activate = true;
if (empty($resarray['errors'])){
$activate = true;
}else{
foreach ($resarray['errors'] as $errorMessage){
dol_syslog($errorMessage, LOG_ERR);
}
}
break;
}
}

View File

@ -958,11 +958,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30);
}
/* not required yet, already supported by default account
if (! empty($conf->loan->enabled))
{
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/loan.php?mainmenu=accountancy&amp;leftmenu=accountancy_admin", $langs->trans("MenuLoanAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_loan', 45);
}
/* not required yet, already supported by default account
if (! empty($conf->don->enabled))
{
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&amp;leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47);

View File

@ -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_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_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",'none.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",'none.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_special_array[$r]=array('none.rest'=>'getRemainToPay');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid','f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$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_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_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",'none.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'=>'CodePaymentMode','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",'none.rest'=>'NumericCompute','f.paye'=>"Boolean",'f.fk_statut'=>'Status','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','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_special_array[$r]=array('none.rest'=>'getRemainToPay');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid','f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@ -36,7 +36,7 @@
* $type, $text, $description, $line
*/
global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins, $outputalsopricetotalwithtax;
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
$usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
@ -46,7 +46,7 @@ if (empty($forceall)) $forceall=0;
if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
if (empty($usemargins)) $usemargins=0;
?>
<?php $coldisplay=0; ?>
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->

View File

@ -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

View File

@ -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;

View File

@ -220,7 +220,7 @@ class Export
foreach ($this->array_export_fields[$indice] as $key => $value)
{
if (! array_key_exists($key, $array_selected)) continue; // Field not selected
if (preg_match('/^none\./', $key)) continue; // A field that must not appears into SQL
if ($i > 0) $sql.=', ';
else $i++;
@ -607,12 +607,37 @@ class Export
if ($objp->$alias < 0) $objp->$alias='';
}
// Operation ZEROIFNEG
if ($this->array_export_special[$indice][$key]=='ZEROIFNEG')
elseif ($this->array_export_special[$indice][$key]=='ZEROIFNEG')
{
//$alias=$this->array_export_alias[$indice][$key];
$alias=str_replace(array('.', '-','(',')'),'_',$key);
if ($objp->$alias < 0) $objp->$alias='0';
}
// Operation INVOICEREMAINTOPAY
elseif ($this->array_export_special[$indice][$key]=='getRemainToPay')
{
//$alias=$this->array_export_alias[$indice][$key];
$alias=str_replace(array('.', '-','(',')'),'_',$key);
$remaintopay='';
if ($objp->f_rowid > 0)
{
global $tmpobjforcomputecall;
if (! is_object($tmpobjforcomputecall))
{
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$tmpobjforcomputecall=new Facture($this->db);
}
$tmpobjforcomputecall->id = $objp->f_rowid;
$tmpobjforcomputecall->total_ttc = $objp->f_total_ttc;
$remaintopay=$tmpobjforcomputecall->getRemainToPay();
}
$objp->$alias=$remaintopay;
}
else
{
$this->error='Operation '.$this->array_export_special[$indice][$key].' not supported.';
return -1;
}
}
}
// end of special operation processing

View File

@ -147,7 +147,7 @@ $usefilters=1;
* Actions
*/
if ($action=='selectfield')
if ($action=='selectfield') // Selection of field at step 2
{
$fieldsarray=$objexport->array_export_fields[0];
$fieldsentitiesarray=$objexport->array_export_entities[0];
@ -168,12 +168,28 @@ if ($action=='selectfield')
$warnings=array();
$array_selected[$field]=count($array_selected)+1; // We tag the key $field as "selected"
// We check if there is a dependency
// We check if there is a dependency to activate
/*var_dump($field);
var_dump($fieldsentitiesarray[$field]);
var_dump($fieldsdependenciesarray);*/
$listofdependencies=array();
if (! empty($fieldsentitiesarray[$field]) && ! empty($fieldsdependenciesarray[$fieldsentitiesarray[$field]]))
{
// We found a dependency on the type of field
$tmp=$fieldsdependenciesarray[$fieldsentitiesarray[$field]]; // $fieldsdependenciesarray=array('element'=>'fd.rowid') or array('element'=>array('fd.rowid','ab.rowid'))
if (is_array($tmp)) $listofdependencies=$tmp;
else $listofdependencies=array($tmp);
}
else if (! empty($field) && ! empty($fieldsdependenciesarray[$field]))
{
// We found a dependency on a dedicated field
$tmp=$fieldsdependenciesarray[$field]; // $fieldsdependenciesarray=array('fd.fieldx'=>'fd.rowid') or array('fd.fieldx'=>array('fd.rowid','ab.rowid'))
if (is_array($tmp)) $listofdependencies=$tmp;
else $listofdependencies=array($tmp);
}
if (count($listofdependencies))
{
foreach($listofdependencies as $fieldid)
{
if (empty($array_selected[$fieldid]))

View File

@ -254,7 +254,7 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (22
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (224,'TV','TUV','Tuvalu',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (225,'UG','UGA','Ouganda',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (226,'UA','UKR','Ukraine',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (227,'AE','ARE','Émirats arabes unis',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (227,'AE','ARE','United Arab Emirates',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (228,'UM','UMI','Iles mineures éloignées des États-Unis',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (229,'UY','URY','Uruguay',1,0);
INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (230,'UZ','UZB','Ouzbékistan',1,0);

View File

@ -323,4 +323,7 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) va
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 181, 18126, '', 0, 'Ucayali', 1);
-- Regions Panama (id country=178)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 178, 17801, '', 0, 'Panama', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 178, 17801, '', 0, 'Panama', 1);
-- Regions Panama (id country=227)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 227, 22701, '', 0, 'United Arab Emirates', 1);

View File

@ -1491,4 +1491,16 @@ INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-7', 17801, '', 0, '', 'Los Santos', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-8', 17801, '', 0, '', 'Panamá', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-9', 17801, '', 0, '', 'Veraguas', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-13', 17801, '', 0, '', 'Panamá Oeste', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-13', 17801, '', 0, '', 'Panamá Oeste', 1);
-- Provinces United Arab Emirates (id country=227)
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-1', 22701, '', 0, '', 'Abu Dhabi', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-2', 22701, '', 0, '', 'Dubai', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-3', 22701, '', 0, '', 'Ajman', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-4', 22701, '', 0, '', 'Fujairah', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-5', 22701, '', 0, '', 'Ras al-Khaimah', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-6', 22701, '', 0, '', 'Sharjah', 1);
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-7', 22701, '', 0, '', 'Umm al-Quwain', 1);

View File

@ -78,6 +78,7 @@ PaymentMode=Payment type
PaymentTypeDC=Debit/Credit Card
PaymentTypePP=PayPal
IdPaymentMode=Payment type (id)
CodePaymentMode=Payment type (code)
LabelPaymentMode=Payment type (label)
PaymentModeShort=Payment type
PaymentTerm=Payment term
@ -281,8 +282,8 @@ NewRelativeDiscount=New relative discount
NoteReason=Note/Reason
ReasonDiscount=Reason
DiscountOfferedBy=Granted by
DiscountStillRemaining=Discounts still remaining
DiscountAlreadyCounted=Discounts already counted
DiscountStillRemaining=Discounts available
DiscountAlreadyCounted=Discounts already consumed
BillAddress=Bill address
HelpEscompte=This discount is a discount granted to customer because its payment was made before term.
HelpAbandonBadCustomer=This amount has been abandoned (customer said to be a bad customer) and is considered as an exceptional loose.

View File

@ -69,6 +69,7 @@ SetDate=Set date
SelectDate=Select a date
SeeAlso=See also %s
SeeHere=See here
Apply=Apply
BackgroundColorByDefault=Default background color
FileRenamed=The file was successfully renamed
FileUploaded=The file was successfully uploaded

View File

@ -3,7 +3,7 @@ MultiCurrency=Multi currency
ErrorAddRateFail=Error in added rate
ErrorAddCurrencyFail=Error in added currency
ErrorDeleteCurrencyFail=Error delete fail
multicurrency_syncronize_error=Error in synchronization
multicurrency_syncronize_error=Synchronisation error: %s
multicurrency_useOriginTx=When an object is created from another, keep the original rate of source object (otherwise use the new known rate)
CurrencyLayerAccount=CurrencyLayer API
CurrencyLayerAccount_help_to_synchronize=You sould create an account on their website to use this functionnality<br />Get your <b>API key</b><br />If you use a free account you can't change the <b>currency source</b> (USD by default)<br />But if your main currency isn't USD you can use the <b>alternate currency source</b> to force you main currency<br /><br />You are limited at 1000 synchronizations per month
@ -15,4 +15,4 @@ CurrenciesUsed_help_to_add=Add the differents currencies and rates you need to u
rate=rate
MulticurrencyReceived=Received, original currency
MulticurrencyRemainderToTake=Remaining amout, original currency
MulticurrencyPaymentAmount=Payment amount, original currency
MulticurrencyPaymentAmount=Payment amount, original currency

View File

@ -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

View File

@ -507,7 +507,11 @@ if ($action == 'create' && $user->rights->projet->creer)
// Thirdparty
if ($conf->societe->enabled)
{
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td class="maxwidthonsmartphone">';
print '<tr><td>';
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'<span class="fieldrequired">');
print $langs->trans("ThirdParty");
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'</span>');
print '</td><td class="maxwidthonsmartphone">';
$filteronlist='';
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
$text=$form->select_thirdparty_list(GETPOST('socid','int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300');
@ -719,7 +723,11 @@ elseif ($object->id > 0)
// Thirdparty
if ($conf->societe->enabled)
{
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
print '<tr><td>';
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'<span class="fieldrequired">');
print $langs->trans("ThirdParty");
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'</span>');
print '</td><td>';
$filteronlist='';
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
$text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), '', 0, 0, 'minwidth300');

View File

@ -139,7 +139,13 @@ class Project extends CommonObject
dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR);
return -1;
}
if (! empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) && ! $this->socid > 0)
{
$this->error = 'ErrorFieldsRequired';
dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR);
return -1;
}
$this->db->begin();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "projet (";

View File

@ -904,8 +904,12 @@ while ($i < min($num, $limit))
$companystatic->fournisseur=$obj->fournisseur;
$companystatic->code_client=$obj->code_client;
$companystatic->code_fournisseur=$obj->code_fournisseur;
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
$companystatic->name_alias=$obj->name_alias;
$companystatic->code_compta_client=$obj->code_compta;
$companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur;
$companystatic->fk_prospectlevel=$obj->fk_prospectlevel;
$companystatic->name_alias=$obj->name_alias;
print "<tr ".$bc[$var].">";
if (! empty($arrayfields['s.nom']['checked']))

View File

@ -35,7 +35,9 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
if (! empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@ -49,6 +51,12 @@ $langs->load('products');
$socid=GETPOST('socid','int');
$action=GETPOST('action','alpha');
$massaction=GETPOST('massaction','alpha');
$show_files=GETPOST('show_files','int');
$confirm=GETPOST('confirm','alpha');
$toselect = GETPOST('toselect', 'array');
$search_user=GETPOST('search_user','int');
$search_sale=GETPOST('search_sale','int');
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
@ -65,9 +73,25 @@ $month=GETPOST("month");
$yearvalid=GETPOST("yearvalid");
$monthvalid=GETPOST("monthvalid");
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield='sp.date_livraison';
if (! $sortorder) $sortorder='DESC';
if ($object_statut != '') $search_status=$object_statut;
// Nombre de ligne pour choix de produit/service predefinis
$NBLINES=4;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$contextpage='supplierproposallist';
// Security check
$module='supplier_proposal';
$dbtable='';
@ -81,24 +105,10 @@ if (! empty($socid))
}
$result = restrictedArea($user, $module, $objectid, $dbtable);
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield='sp.date_livraison';
if (! $sortorder) $sortorder='DESC';
if ($object_statut != '') $search_status=$object_statut;
$diroutputmassaction=$conf->supplier_proposal->dir_output . '/temp/massgeneration/'.$user->id;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$contextpage='supplierproposallist';
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('supplierproposallist'));
$hookmanager->initHooks(array('supplier_proposallist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
@ -115,11 +125,35 @@ $fieldstosearchall = array(
'p.note_public'=>'NotePublic',
);
// TODO Use field of supplier proposal
$arrayfields=array(
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("Supplier"), 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'p.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
'p.fin_validite'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1),
'p.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('supplier_proposallist'));
/*
@ -127,15 +161,15 @@ $hookmanager->initHooks(array('supplier_proposallist'));
*/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
$search_categ='';
$search_user='';
@ -158,37 +192,12 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
// Mass actions. Controls on number of lines checked
$maxformassaction=1000;
if (! empty($massaction) && count($toselect) < 1)
{
$error++;
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
}
if (! $error && count($toselect) > $maxformassaction)
{
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++;
}
// Action to delete
/*
if ($action == 'confirm_delete')
{
$result=$object->delete($user);
if ($result > 0)
{
// Delete OK
setEventMessages("RecordDeleted", null, 'mesgs');
header("Location: ".dol_buildpath('/mymodule/list.php',1));
exit;
}
else
{
if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors');
else setEventMessages($object->error,null,'errors');
}
}*/
$objectclass='SupplierProposal';
$objectlabel='SupplierProposals';
$permtoread = $user->rights->supplier_proposal->lire;
$permtodelete = $user->rights->supplier_proposal->supprimer;
$uploaddir = $conf->supplier_proposal->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -197,15 +206,16 @@ if (empty($reshook))
* View
*/
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
$now=dol_now();
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
$formpropal = new FormPropal($db);
$companystatic=new Societe($db);
$formcompany=new FormCompany($db);
$now=dol_now();
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
@ -250,7 +260,7 @@ if ($search_author) $sql .= natural_search('u.login', $search_author);
if ($search_montant_ht) $sql.= " AND sp.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if ($search_status <> '') $sql.= ' AND sp.fk_statut IN ('.$search_status.')';
if ($search_status >= 0 && $search_status != '') $sql.= ' AND sp.fk_statut IN ('.$search_status.')';
if ($month > 0)
{
if ($year > 0 && empty($day))
@ -283,8 +293,10 @@ if ($search_user > 0)
$sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = sp.rowid AND c.fk_socpeople = ".$search_user;
}
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', sp.ref DESC';
$sql.= $db->order($sortfield,$sortorder);
$sql.=', sp.ref DESC';
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
@ -293,19 +305,28 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
}
$sql.= $db->plimit($limit + 1,$offset);
$result=$db->query($sql);
if ($result)
{
$objectstatic=new SupplierProposal($db);
$userstatic=new User($db);
if ($socid > 0)
{
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfProposals') . ' - '.$soc->name;
}
else
{
$title = $langs->trans('ListOfProposals');
}
$num = $db->num_rows($result);
if ($socid)
{
$soc = new Societe($db);
$soc->fetch($socid);
}
$arrayofselected=is_array($toselect)?$toselect:array();
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@ -320,21 +341,136 @@ if ($result)
if ($search_author) $param.='&search_author='.$search_author;
if ($socid > 0) $param.='&socid='.$socid;
if ($search_status != '') $param.='&search_status='.$search_status;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->supplier_proposal->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
// Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print_barre_liste($langs->trans('ListOfSupplierProposal').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
if ($massaction == 'presend')
{
$langs->load("mails");
if (! GETPOST('cancel'))
{
$objecttmp=new SupplierProposal($db);
$listofselectedid=array();
$listofselectedthirdparties=array();
$listofselectedref=array();
foreach($arrayofselected as $toselectid)
{
$result=$objecttmp->fetch($toselectid);
if ($result > 0)
{
$listofselectedid[$toselectid]=$toselectid;
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
}
}
}
print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
dol_fiche_head(null, '', '');
$topicmail="SendProposalRef";
$modelmail="propal_send";
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->withform=-1;
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
if($formmail->fromtype === 'user'){
$formmail->fromid = $user->id;
}
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
{
$formmail->trackid='ord'.$object->id;
}
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
{
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
}
$formmail->withfrom=1;
$liste=$langs->trans("AllRecipientSelected");
if (count($listofselectedthirdparties) == 1)
{
$liste=array();
$thirdpartyid=array_shift($listofselectedthirdparties);
$soc=new Societe($db);
$soc->fetch($thirdpartyid);
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
{
$liste[$key]=$value;
}
$formmail->withtoreadonly=0;
}
else
{
$formmail->withtoreadonly=1;
}
$formmail->withto=$liste;
$formmail->withtofree=0;
$formmail->withtocc=1;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
// Tableau des parametres complementaires du post
$formmail->param['action']=$action;
$formmail->param['models']=$modelmail;
$formmail->param['models_id']=GETPOST('modelmailselected','int');
$formmail->param['id']=join(',',$arrayofselected);
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
print $formmail->get_form();
dol_fiche_end();
}
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
//sort($fieldstosearchall);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
@ -359,19 +495,25 @@ if ($result)
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
$moreforfilter.='</div>';
}
if (! empty($moreforfilter))
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
// Fields title
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'sp.ref','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Supplier'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
@ -380,7 +522,7 @@ if ($result)
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'sp.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'sp.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
@ -421,21 +563,21 @@ if ($result)
$formpropal->selectProposalStatus($search_status,1,0,1,'supplier','search_status');
print '</td>';
// Check boxes
print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
print $searchpitco;
print '</td>';
print "</tr>\n";
$now = dol_now();
$var=true;
$total=0;
$subtotal=0;
$totalarray=array();
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
$now = dol_now();
$var=!$var;
$objectstatic->id=$obj->rowid;
@ -543,12 +685,36 @@ if ($result)
}
print '</table>';
print '</div>';
print '</form>';
$db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";
print '</div>'."\n";
$db->free($result);
print '</form>'."\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
/*
* Show list of available documents
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction;
$genallowed=$user->rights->propal->lire;
$delallowed=$user->rights->propal->lire;
print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'','');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
}
else
{

View File

@ -568,6 +568,12 @@ div.myavailability {
.selectlimit, .marginrightonly {
margin-right: 10px !important;
}
.selectlimit, .selectlimit:focus {
border-left: none !important;
border-top: none !important;
border-right: none !important;
outline: none;
}
.strikefordisabled {
text-decoration: line-through;
}
@ -1635,7 +1641,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
{
@ -2508,10 +2514,10 @@ table.liste tr, table.noborder tr, div.noborder form {
min-height: 20px;
}
table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td {
padding: 8px 2px 8px 3px; /* t r b l */
padding: 7px 2px 7px 3px; /* t r b l */
}
table.liste td, table.noborder td, div.noborder form div {
padding: 8px 2px 8px 3px; /* t r b l */
padding: 7px 2px 7px 3px; /* t r b l */
}
div.liste_titre_bydiv .divsearchfield {
padding: 2px 1px 2px 0px; /* t r b l */
@ -2781,7 +2787,7 @@ table.dataTable td {
padding: 5px 2px 5px 3px !important;
}
tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd {
padding: 5px 2px 5px 3px;
padding: 7px 2px 7px 3px;
border-bottom: 1px solid #ddd;
}
form.pair, form.impair {
@ -2873,7 +2879,7 @@ tr.liste_titre_topborder td {
.liste_titre td a.notasortlink:hover {
background: transparent;
}
tr.liste_titre td.liste_titre, form.liste_titre div.tagtd { /* For last line of table headers only */
tr.liste_titre td.liste_titre, tr.liste_titre td.liste_titre_sel, form.liste_titre div.tagtd { /* For last line of table headers only */
border-bottom: 1px solid rgb(<?php echo $colortopbordertitle1 ?>);
}
@ -3045,7 +3051,7 @@ tr.box_pair {
}
tr.box_pair td, tr.box_impair td {
padding: 4px;
/* padding: 4px; */
}
tr.box_pair:not(:last-child) td, tr.box_impair:not(:last-child) td {
border-bottom: 1px solid #ddd;

View File

@ -546,6 +546,12 @@ div.myavailability {
.selectlimit, .marginrightonly {
margin-right: 10px !important;
}
.selectlimit, .selectlimit:focus {
border-left: none !important;
border-top: none !important;
border-right: none !important;
outline: none;
}
.strikefordisabled {
text-decoration: line-through;
}
@ -1646,7 +1652,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
@ -2751,7 +2757,7 @@ tr.liste_titre_topborder td {
.liste_titre td a.notasortlink:hover {
background: transparent;
}
tr.liste_titre td.liste_titre { /* For last line of table headers only */
tr.liste_titre td.liste_titre, tr.liste_titre td.liste_titre_sel { /* For last line of table headers only */
border-bottom: 1px solid rgb(<?php echo $colortopbordertitle1 ?>);
}
@ -2932,7 +2938,7 @@ tr.box_pair td, tr.box_impair td {
padding: 4px;
}
tr.box_pair:not(:last-child) td, tr.box_impair:not(:last-child) td {
border-bottom: 1px solid #f4f4f4;
border-bottom: 1px solid #eee;
}
.noborderbottom {
border-bottom: none !important;