Skip to content

Commit

Permalink
Add delete line to expedition card
Browse files Browse the repository at this point in the history
  • Loading branch information
fappels committed Oct 18, 2017
1 parent 2ea687a commit 146f17f
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions htdocs/expedition/card.php
Expand Up @@ -69,6 +69,7 @@
if (empty($origin_id)) $origin_id = GETPOST('origin_id','int'); // Id of order or propal
if (empty($origin_id)) $origin_id = GETPOST('object_id','int'); // Id of order or propal
$ref=GETPOST('ref','alpha');
$line_id = GETPOST('lineid','int')?GETPOST('lineid','int'):'';

// Security check
$socid='';
Expand Down Expand Up @@ -596,6 +597,18 @@
}
}

elseif ($action == 'deleteline' && ! empty($line_id))
{
$object->fetch($id);
$line = new ExpeditionLigne($db);
$line->id = $line_id;
$result = $line->delete($user);
if($result >= 0) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
exit();
}
}

include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';

// Actions to send emails
Expand Down Expand Up @@ -1769,6 +1782,8 @@
print '<td align="left">'.$langs->trans("Batch").'</td>';
}

print '<td class="linecoledit"></td>';
print '<td class="linecoldelete" width="10"></td>';
print "</tr>\n";

$var=false;
Expand Down Expand Up @@ -1992,6 +2007,18 @@
print '<td></td>';
}
}

// edit-delete buttons
print '<td class="linecoledit" align="center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=editline&amp;lineid=' . $lines[$i]->id . '">';
print img_edit();
print '</a>';
print '</td>';
print '<td class="linecoldelete" width="10">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=deleteline&amp;lineid=' . $lines[$i]->id . '">';
print img_delete();
print '</a>';
print '</td>';
print "</tr>";

// Display lines extrafields
Expand All @@ -2003,8 +2030,6 @@
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked);
print '</tr>';
}


}

// TODO Show also lines ordered but not delivered
Expand Down

0 comments on commit 146f17f

Please sign in to comment.