Merge pull request #1167 from PaulPoulain/999-develop
T999-develop: link invoice to a command
This commit is contained in:
commit
67892575be
@ -3700,6 +3700,74 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Linked object block
|
||||
$somethingshown=$object->showLinkedObjectBlock();
|
||||
|
||||
|
||||
if (empty($somethingshown) && $object->statut > 0)
|
||||
{
|
||||
|
||||
print '<a href="#" onClick="lier_commande(commande)">'.$langs->trans('LinkedOrder').'</a>';
|
||||
|
||||
print '<div id="commande" style="display:none">';
|
||||
{
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= ' WHERE c.fk_soc = '.$soc->id.'';
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
print_titre($langs->trans("LinkedOrder"));
|
||||
print '<table><tr class="liste_titre">';
|
||||
print '<td class="nowrap"></td>';
|
||||
print '<td align="center">'.$langs->trans("Ref").'</td>';
|
||||
print '<td align="left">'.$langs->trans("RefCustomer").'</td>';
|
||||
print '<td align="left">'.$langs->trans("AmountHTShort").'</td>';
|
||||
print '<td align="left">'.$langs->trans("Company").'</td>
|
||||
</tr>';
|
||||
print '<form action=" " method="post" name="LinkedOrder">';
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
if ($objp->socid == $soc->id)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td aling="left">';
|
||||
print '<input type="radio" name="linkedOrder" value='.$objp->rowid.'>';
|
||||
print '<td align="center">'.$objp->ref.'</td>';
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
print '<td>'.price($objp->total_ht).'</td>';
|
||||
print '<td>'.$objp->name.'</td>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</br>';
|
||||
print '<br><center><input type="submit" class="button" value="'.$langs->trans('OK').'"></center>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$result=$object->add_object_linked('commande',$_POST['linkedOrder']);
|
||||
if($result>0)
|
||||
{
|
||||
echo '<meta http-equiv="refresh" content="0;URL=facture.php?facid='.$object->id.'">';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
// Link for paypal payment
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0)
|
||||
{
|
||||
@ -3708,7 +3776,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions=new FormActions($db);
|
||||
@ -3839,7 +3907,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3852,3 +3920,19 @@ dol_htmloutput_mesg('',$mesgs);
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
<script>
|
||||
|
||||
function lier_commande(commande)
|
||||
{
|
||||
|
||||
if(commande.style.display=='none')
|
||||
{
|
||||
commande.style.display='inline';
|
||||
}
|
||||
else
|
||||
{
|
||||
commande.style.display="none";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -155,4 +155,6 @@ InvoiceDispatched=Dispatched invoices
|
||||
AccountancyDashboard=Accountancy summary
|
||||
ByProductsAndServices=By products and services
|
||||
RefExt=External ref
|
||||
ToCreateAPredefinedInvoice=To create a predefined invoice, create a standard invoice then, without validating it, click onto button "Convert to predefined invoice".
|
||||
ToCreateAPredefinedInvoice=To create a predefined invoice, create a standard invoice then, without validating it, click onto button "Convert to predefined invoice".
|
||||
LinkedOrder=linked to command
|
||||
|
||||
|
||||
@ -155,4 +155,6 @@ InvoiceDispatched=Factures ventilées
|
||||
AccountancyDashboard=Synthèse compta/tréso
|
||||
ByProductsAndServices=Par produits et services
|
||||
RefExt=Référence externe
|
||||
ToCreateAPredefinedInvoice=Pour créer une facture prédéfinie, créer une facture standard puis sans la valider, cliquer sur le bouton "Convertir en facture prédéfine".
|
||||
ToCreateAPredefinedInvoice=Pour créer une facture prédéfinie, créer une facture standard puis sans la valider, cliquer sur le bouton "Convertir en facture prédéfine".
|
||||
LinkedOrder=Lier à une commande
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user