Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Oct 22, 2015
2 parents 9cbb912 + ce68108 commit 3d7050e
Show file tree
Hide file tree
Showing 21 changed files with 304 additions and 40 deletions.
4 changes: 2 additions & 2 deletions htdocs/accountancy/admin/account.php
Expand Up @@ -76,15 +76,15 @@

$action = 'update';
if ($result < 0) {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} else if ($action == 'enable') {
if ($accounting->fetch($id)) {
$result = $accounting->account_activate($id);
}
$action = 'update';
if ($result < 0) {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/card.php
Expand Up @@ -125,7 +125,7 @@
}

if ($result < 0) {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}

Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/admin/export.php
Expand Up @@ -100,9 +100,9 @@
}

if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

Expand Down
6 changes: 3 additions & 3 deletions htdocs/accountancy/admin/fiscalyear_card.php
Expand Up @@ -66,7 +66,7 @@
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}

Expand Down Expand Up @@ -110,7 +110,7 @@
{
$db->rollback();

setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='create';
}
}
Expand Down Expand Up @@ -147,7 +147,7 @@
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
Expand Down
6 changes: 3 additions & 3 deletions htdocs/accountancy/admin/importaccounts.php
Expand Up @@ -76,14 +76,14 @@

$result = $accounting->create($user);
if ($result > 0) {
setEventMessage($langs->trans("AccountingAccountAdd"), 'mesgs');
setEventMessages($langs->trans("AccountingAccountAdd"), null, 'mesgs');
} else {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
$cpt ++;
}
} else {
setEventMessage($langs->trans('AccountPlanNotFoundCheckSetting'), 'errors');
setEventMessages($langs->trans('AccountPlanNotFoundCheckSetting'), null, 'errors');
}
} else {
print '<div><font color="red">' . $langs->trans("AnyLineImport") . '</font></div>';
Expand Down
12 changes: 6 additions & 6 deletions htdocs/accountancy/admin/index.php
Expand Up @@ -111,11 +111,11 @@

if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

Expand All @@ -126,9 +126,9 @@
$error ++;

if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}

Expand All @@ -138,9 +138,9 @@
if (! $res > 0)
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}

Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/admin/journal.php
Expand Up @@ -68,9 +68,9 @@
}

if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/productaccount.php
Expand Up @@ -116,7 +116,7 @@

$result=$accounting->fetch($accounting_account_id,null,1);
if ($result<0) {
//setEventMessage(null, $accounting->errors,'errors');
//setEventMessages(null, $accounting->errors, 'errors');
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
} else {

Expand Down
8 changes: 4 additions & 4 deletions htdocs/accountancy/bookkeeping/card.php
Expand Up @@ -51,7 +51,7 @@

$error = 0;

if ((intval($debit) != 0) && (intval($credit) != 0)) {
if ((floatval($debit)!=0.0) && (floatval($credit)!=0.0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
Expand All @@ -69,11 +69,11 @@
$book->debit = $debit;
$book->credit = $credit;

if (! empty($debit)) {
if (floatval($debit)!=0.0) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
if (floatval($credit)!=0.0) {
$book->montant = $credit;
$book->sens = 'C';
}
Expand Down Expand Up @@ -372,4 +372,4 @@
}

llxFooter();
$db->close();
$db->close();
47 changes: 47 additions & 0 deletions htdocs/admin/commande.php
Expand Up @@ -251,6 +251,23 @@
}
}

// Activate ask for warehouse
else if ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
{
$res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER",$value,'chaine',0,'',$conf->entity);

if (! $res > 0) $error++;

if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
}


/*
* View
Expand Down Expand Up @@ -630,6 +647,36 @@
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
}

// Ask for warehouse during order
if ($conf->stock->enabled)
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp</td><td align="center">';
if (! empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
}
else
{
if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
}
}
print '</td></tr>';
}
else
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
}

print '</table>';
print '<br>';

Expand Down
98 changes: 96 additions & 2 deletions htdocs/comm/index.php
Expand Up @@ -32,6 +32,7 @@
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';

if (! $user->rights->societe->lire) accessforbidden();

Expand Down Expand Up @@ -65,6 +66,7 @@
$companystatic=new Societe($db);
if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);

llxHeader();

Expand Down Expand Up @@ -125,6 +127,8 @@
*/
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$langs->load("propal");

$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql.= ", s.code_client";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
Expand All @@ -144,7 +148,7 @@

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("ProposalsDraft").' <span class="badge">'.$num.'</span></td></tr>';
print '<td colspan="3">'.$langs->trans("ProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';

if ($num > 0)
{
Expand Down Expand Up @@ -182,6 +186,10 @@
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>';
}
print "</table><br>";

$db->free($resql);
Expand Down Expand Up @@ -219,7 +227,7 @@

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("DraftOrders").' <span class="badge">'.$num.'</span></td></tr>';
print '<td colspan="3">'.$langs->trans("DraftOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';

if ($num)
{
Expand Down Expand Up @@ -257,10 +265,96 @@
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoOrder").'</td></tr>';
}
print "</table><br>";

$db->free($resql);
}
else
{
dol_print_error($db);
}
}


/*
* Draft suppliers orders
*/
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
{
$langs->load("orders");

$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql.= ", s.code_client";
$sql.= ", s.code_fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE cf.fk_soc = s.rowid";
$sql.= " AND cf.fk_statut = 0";
$sql.= " AND cf.entity IN (".getEntity('supplier_order', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND cf.fk_soc = ".$socid;

$resql = $db->query($sql);
if ($resql)
{
$total = 0;
$num = $db->num_rows($resql);

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("DraftSuppliersOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';

if ($num)
{
$i = 0;
$var = true;
while ($i < $num)
{
$var=!$var;
$obj = $db->fetch_object($resql);
print '<tr '.$bc[$var].'><td class="nowrap">';
$supplierorderstatic->id=$obj->rowid;
$supplierorderstatic->ref=$obj->ref;
$supplierorderstatic->ref_supplier=$obj->ref_suppliert;
$supplierorderstatic->total_ht = $obj->total_ht;
$supplierorderstatic->total_tva = $obj->total_tva;
$supplierorderstatic->total_ttc = $obj->total_ttc;
print $supplierorderstatic->getNomUrl(1);
print '</td>';
print '<td class="nowrap">';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->client=$obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'customer',16);
print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
$i++;
$total += $obj->total_ttc;
}
if ($total>0)
{
$var=!$var;
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoSupplierOrder").'</td></tr>';
}
print "</table><br>";

$db->free($resql);
} else {
dol_print_error($db);
}
}


Expand Down

0 comments on commit 3d7050e

Please sign in to comment.