Skip to content

Commit

Permalink
Fix: add elseif
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Mar 13, 2012
1 parent 4d1416d commit 777c402
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions htdocs/compta/facture.php
Expand Up @@ -121,7 +121,7 @@
}

// Change status of invoice
if ($action == 'reopen' && $user->rights->facture->creer)
else if ($action == 'reopen' && $user->rights->facture->creer)
{
$result = $object->fetch($id);
if ($object->statut == 2
Expand All @@ -141,7 +141,7 @@
}

// Delete invoice
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer)
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer)
{
if ($user->rights->facture->supprimer)
{
Expand All @@ -160,7 +160,7 @@
}

// Delete line
if ($action == 'confirm_deleteline' && $confirm == 'yes')
else if ($action == 'confirm_deleteline' && $confirm == 'yes')
{
if ($user->rights->facture->creer)
{
Expand Down Expand Up @@ -200,7 +200,7 @@
}

// Delete link of credit note to invoice
if ($action == 'unlinkdiscount')
else if ($action == 'unlinkdiscount')
{
if ($user->rights->facture->creer)
{
Expand All @@ -211,7 +211,7 @@
}

// Validation
if ($action == 'valid')
else if ($action == 'valid')
{
$object->fetch($id);

Expand All @@ -236,7 +236,7 @@
}
}

if ($action == 'set_thirdparty')
else if ($action == 'set_thirdparty')
{
$object->fetch($id);
$object->setValueFrom('fk_soc',$socid);
Expand All @@ -245,20 +245,20 @@
exit;
}

if ($action == 'classin')
else if ($action == 'classin')
{
$object->fetch($id);
$object->setProject($_POST['projectid']);
}

if ($action == 'setmode')
else if ($action == 'setmode')
{
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
}

if ($action == 'setinvoicedate')
else if ($action == 'setinvoicedate')
{
$object->fetch($id);
$object->date=dol_mktime(12,0,0,$_POST['invoicedatemonth'],$_POST['invoicedateday'],$_POST['invoicedateyear']);
Expand All @@ -267,7 +267,7 @@
if ($result < 0) dol_print_error($db,$object->error);
}

if ($action == 'setconditions')
else if ($action == 'setconditions')
{
$object->fetch($id);
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
Expand All @@ -280,7 +280,7 @@
$result = $object->set_remise($user, $_POST['remise_percent']);
}

if ($action == "setabsolutediscount" && $user->rights->facture->creer)
else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
{
// POST[remise_id] ou POST[remise_id_for_payment]
if (! empty($_POST["remise_id"]))
Expand Down Expand Up @@ -313,14 +313,14 @@
}
}

if ($action == 'set_ref_client')
else if ($action == 'set_ref_client')
{
$object->fetch($id);
$object->set_ref_client($_POST['ref_client']);
}

// Classify to validated
if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider)
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider)
{
$idwarehouse=GETPOST('idwarehouse');

Expand Down Expand Up @@ -367,7 +367,7 @@
}

// Go back to draft status (unvalidate)
if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate))
else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate))
{
$idwarehouse=GETPOST('idwarehouse');

Expand Down Expand Up @@ -440,13 +440,13 @@
}

// Classify "paid"
if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement)
else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement)
{
$object->fetch($id);
$result = $object->set_paid($user);
}
// Classif "paid partialy"
if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement)
else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement)
{
$object->fetch($id);
$close_code=$_POST["close_code"];
Expand All @@ -461,7 +461,7 @@
}
}
// Classify "abandoned"
if ($action == 'confirm_canceled' && $confirm == 'yes')
else if ($action == 'confirm_canceled' && $confirm == 'yes')
{
$object->fetch($id);
$close_code=$_POST["close_code"];
Expand All @@ -477,7 +477,7 @@
}

// Convertir en reduc
if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->rights->facture->creer)
else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->rights->facture->creer)
{
$db->begin();

Expand Down Expand Up @@ -552,7 +552,7 @@
/*
* Insert new invoice in database
*/
if ($action == 'add' && $user->rights->facture->creer)
else if ($action == 'add' && $user->rights->facture->creer)
{
$object->socid=GETPOST('socid','int');

Expand Down Expand Up @@ -913,7 +913,7 @@
}

// Add a new line
if (($action == 'addline' || $action == 'addline_predef') && $user->rights->facture->creer)
else if (($action == 'addline' || $action == 'addline_predef') && $user->rights->facture->creer)
{
$result=0;

Expand Down Expand Up @@ -1121,7 +1121,7 @@
$action='';
}

if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['save'] == $langs->trans('Save'))
else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['save'] == $langs->trans('Save'))
{
if (! $object->fetch($id) > 0) dol_print_error($db);
$object->fetch_thirdparty();
Expand Down Expand Up @@ -1209,15 +1209,14 @@
}
}

if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel'))
else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel'))
{
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // Pour reaffichage de la fiche en cours d'edition
exit;
}


// Modify line position (up)
if ($action == 'up' && $user->rights->facture->creer)
else if ($action == 'up' && $user->rights->facture->creer)
{
$object->fetch($id);
$object->fetch_thirdparty();
Expand All @@ -1239,7 +1238,7 @@
exit;
}
// Modify line position (down)
if ($action == 'down' && $user->rights->facture->creer)
else if ($action == 'down' && $user->rights->facture->creer)
{
$object->fetch($id);
$object->fetch_thirdparty();
Expand Down Expand Up @@ -1469,7 +1468,7 @@
/*
* Generate document
*/
if (GETPOST('action') == 'builddoc') // En get ou en post
else if ($action == 'builddoc') // En get ou en post
{
$object->fetch($id);
$object->fetch_thirdparty();
Expand Down

0 comments on commit 777c402

Please sign in to comment.