Merge remote-tracking branch 'origin/3.9' into develop

This commit is contained in:
Laurent Destailleur 2016-01-13 20:43:49 +01:00
commit 0f5e208127
11 changed files with 68 additions and 54 deletions

View File

@ -50,9 +50,12 @@ function shipping_prepare_head($object)
{ {
// delivery link // delivery link
$object->fetchObjectLinked($object->id,$object->element); $object->fetchObjectLinked($object->id,$object->element);
if (! empty($object->linkedObjectsIds['delivery'][0])) // If there is a delivery if (count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery
{ {
$head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$object->linkedObjectsIds['delivery'][0]; // Take first one element of array
$tmp = reset($object->linkedObjectsIds['delivery']);
$head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$tmp;
$head[$h][1] = $langs->trans("DeliveryCard"); $head[$h][1] = $langs->trans("DeliveryCard");
$head[$h][2] = 'delivery'; $head[$h][2] = 'delivery';
$h++; $h++;
@ -302,7 +305,8 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$expedition->id=$objp->sendingid; $expedition->id=$objp->sendingid;
$expedition->fetchObjectLinked($expedition->id,$expedition->element); $expedition->fetchObjectLinked($expedition->id,$expedition->element);
//var_dump($expedition->linkedObjects); //var_dump($expedition->linkedObjects);
$receiving=(! empty($expedition->linkedObjects['delivery'][0])?$expedition->linkedObjects['delivery'][0]:''); $receiving='';
if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link
if (! empty($receiving)) if (! empty($receiving))
{ {

View File

@ -77,7 +77,11 @@ class modMargin extends DolibarrModules
$this->langfiles = array("margins"); $this->langfiles = array("margins");
// Constants // Constants
$this->const = array(); // List of particular constants to add when module is enabled // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
// );
$this->const = array(0=>array('MARGIN_TYPE','chaine','1','Rule for margin calculation by default',0,'current',0)); // List of particular constants to add when module is enabled
// New pages on tabs // New pages on tabs
$this->tabs = array( $this->tabs = array(

View File

@ -51,7 +51,7 @@ class modOpenSurvey extends DolibarrModules
// Family can be 'crm','financial','hr','projects','product','technic','other' // Family can be 'crm','financial','hr','projects','product','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "projects"; $this->family = "portal";
$this->module_position = 40; $this->module_position = 40;
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));

View File

@ -338,7 +338,7 @@ if (empty($reshook))
$result = $object->create_delivery($user); $result = $object->create_delivery($user);
if ($result > 0) if ($result > 0)
{ {
header("Location: ".DOL_URL_ROOT.'/livraison/card.php?id='.$result); header("Location: ".DOL_URL_ROOT.'/livraison/card.php?action=create_delivery&id='.$result);
exit; exit;
} }
else else
@ -529,7 +529,7 @@ if ($action == 'create2')
$action=''; $id=''; $ref=''; $action=''; $id=''; $ref='';
} }
// Mode creation // Mode creation. TODO This part seems to not be used at all. Receipt record is created by the action "create_delivery" not from a form.
if ($action == 'create') if ($action == 'create')
{ {
$expe = new Expedition($db); $expe = new Expedition($db);
@ -1583,7 +1583,8 @@ else if ($id || $ref)
} }
// This is just to generate a delivery receipt // This is just to generate a delivery receipt
if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'][0])) //var_dump($object->linkedObjectsIds['delivery']);
if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && count($object->linkedObjectsIds['delivery']) == 0)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>';
} }

View File

@ -789,9 +789,9 @@ class Expedition extends CommonObject
/** /**
* Cree un bon de livraison a partir de l'expedition * Create a delivery receipt from a shipment
* *
* @param User $user Utilisateur * @param User $user User
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function create_delivery($user) function create_delivery($user)

View File

@ -37,7 +37,7 @@ print load_fiche_titre($langs->trans('RelatedShippings'), '', '');
<td><?php echo $langs->trans("Ref"); ?></td> <td><?php echo $langs->trans("Ref"); ?></td>
<td align="center"><?php echo $langs->trans("Date"); ?></td> <td align="center"><?php echo $langs->trans("Date"); ?></td>
<td align="center"><?php echo $langs->trans("DateDeliveryPlanned"); ?></td> <td align="center"><?php echo $langs->trans("DateDeliveryPlanned"); ?></td>
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td> <td align="right"><?php echo $langs->trans(""); ?></td>
<td align="right"><?php echo $langs->trans("Status"); ?></td> <td align="right"><?php echo $langs->trans("Status"); ?></td>
<td></td> <td></td>
</tr> </tr>
@ -53,10 +53,10 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td align="center"><?php echo dol_print_date($objectlink->date_creation,'day'); ?></td> <td align="center"><?php echo dol_print_date($objectlink->date_creation,'day'); ?></td>
<td align="center"><?php echo dol_print_date($objectlink->date_delivery,'day'); ?></td> <td align="center"><?php echo dol_print_date($objectlink->date_delivery,'day'); ?></td>
<td align="right"><?php <td align="right"><?php
if ($user->rights->expedition->lire) { /*if ($user->rights->expedition->lire) {
$total = $total + $objectlink->total_ht; $total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht); echo price($objectlink->total_ht);
} ?></td> }*/ ?></td>
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td> <td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td> <td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
</tr> </tr>
@ -64,15 +64,17 @@ foreach($linkedObjectBlock as $key => $objectlink)
} }
?> ?>
<!--
<tr class="liste_total"> <tr class="liste_total">
<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td> <td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
<td align="right"><?php <td align="right"><?php
if ($user->rights->expedition->lire) { /*if ($user->rights->expedition->lire) {
echo price($total); echo price($total);
} ?></td> }*/ ?></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
</table> </table>
-->
<!-- END PHP TEMPLATE --> <!-- END PHP TEMPLATE -->

View File

@ -57,8 +57,6 @@ llxHeader("",$langs->trans("Interventions"),$help_url);
print load_fiche_titre($langs->trans("InterventionsArea")); print load_fiche_titre($langs->trans("InterventionsArea"));
//print '<table width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
@ -204,14 +202,13 @@ if (! empty($conf->ficheinter->enabled))
} }
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max=5; $max=5;
/* /*
* Last modified orders * Last modified interventions
*/ */
$sql = "SELECT f.rowid, f.ref, f.fk_statut, f.date_valid as datec, f.tms as datem,"; $sql = "SELECT f.rowid, f.ref, f.fk_statut, f.date_valid as datec, f.tms as datem,";
@ -281,16 +278,17 @@ else dol_print_error($db);
/* /*
* Orders to process * interventions to process
*/ */
if (! empty($conf->commande->enabled)) /*
if (! empty($conf->fichinter->enabled))
{ {
$sql = "SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid"; $sql = "SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid";
$sql.=" FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql.=" FROM ".MAIN_DB_PREFIX."fichinter as f";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('commande', 1).")"; $sql.= " AND f.entity IN (".getEntity('fichinter', 1).")";
$sql.= " AND f.fk_statut = 1"; $sql.= " AND f.fk_statut = 1";
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid) $sql.= " AND f.fk_soc = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -303,7 +301,7 @@ if (! empty($conf->commande->enabled))
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("OrdersToProcess").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></td></tr>'; print '<td colspan="3">'.$langs->trans("FichinterToProcess").' <a href="'.DOL_URL_ROOT.'/fichinter/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></td></tr>';
if ($num) if ($num)
{ {
@ -350,11 +348,10 @@ if (! empty($conf->commande->enabled))
} }
else dol_print_error($db); else dol_print_error($db);
} }
*/
//print '</td></tr></table>';
print '</div></div></div>'; print '</div></div></div>';

View File

@ -17,6 +17,9 @@ DeleteDeliveryReceiptConfirm=Are you sure you want to delete delivery receipt <b
DeliveryMethod=Delivery method DeliveryMethod=Delivery method
TrackingNumber=Tracking number TrackingNumber=Tracking number
DeliveryNotValidated=Delivery not validated DeliveryNotValidated=Delivery not validated
StatusDeliveryCanceled=Canceled
StatusDeliveryDraft=Draft
StatusDeliveryValidated=Received
# merou PDF model # merou PDF model
NameAndSignature=Name and Signature : NameAndSignature=Name and Signature :
ToAndDate=To___________________________________ on ____/_____/__________ ToAndDate=To___________________________________ on ____/_____/__________

View File

@ -82,7 +82,7 @@ OrdersOpened=Orders to process
NoOpenedOrders=No open orders NoOpenedOrders=No open orders
NoOtherOpenedOrders=No other open orders NoOtherOpenedOrders=No other open orders
NoDraftOrders=No draft orders NoDraftOrders=No draft orders
NoOrder=No Order NoOrder=No order
NoSupplierOrder=No supplier order NoSupplierOrder=No supplier order
OtherOrders=Other orders OtherOrders=Other orders
LastOrders=Last %s customer orders LastOrders=Last %s customer orders

View File

@ -297,7 +297,7 @@ $formfile = new FormFile($db);
* Mode creation * Mode creation
* *
*********************************************************************/ *********************************************************************/
if ($action == 'create') if ($action == 'create') // Seems to no be used
{ {
print load_fiche_titre($langs->trans("CreateADeliveryOrder")); print load_fiche_titre($langs->trans("CreateADeliveryOrder"));
@ -538,6 +538,15 @@ else
$soc->fetch($object->socid); $soc->fetch($object->socid);
$head=delivery_prepare_head($object); $head=delivery_prepare_head($object);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update_extras_line">';
print '<input type="hidden" name="origin" value="'.$origin.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="ref" value="'.$object->ref.'">';
dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending'); dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending');
/* /*
@ -565,13 +574,6 @@ else
* Livraison * Livraison
*/ */
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update_extras_line">';
print '<input type="hidden" name="origin" value="'.$origin.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="ref" value="'.$object->ref.'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Shipment // Shipment
@ -590,7 +592,9 @@ else
// Ref // Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$object->ref.'</td></tr>'; print '<td colspan="3">';
print $object->ref;
print '</td></tr>';
// Client // Client
print '<tr><td width="20%">'.$langs->trans("Customer").'</td>'; print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
@ -818,16 +822,14 @@ else
print "</table>\n"; print "</table>\n";
if($object->statut == 0) // only if draft dol_fiche_end();
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
//if ($object->statut == 0) // only if draft
// print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
print '</form>'; print '</form>';
print "\n</div>\n";
/* /*
* Boutons actions * Boutons actions
*/ */
@ -899,6 +901,7 @@ else
print '</td></tr></table>'; print '</td></tr></table>';
// List of existing shipment and delivery receipts
if ($expedition->origin_id) if ($expedition->origin_id)
{ {
print '<br>'; print '<br>';

View File

@ -65,9 +65,9 @@ class Livraison extends CommonObject
$this->products = array(); $this->products = array();
// List of short language codes for status // List of short language codes for status
$this->statuts[-1] = 'StatusSendingCanceled'; $this->statuts[-1] = 'StatusDeliveryCanceled';
$this->statuts[0] = 'StatusSendingDraft'; $this->statuts[0] = 'StatusDeliveryDraft';
$this->statuts[1] = 'StatusSendingValidated'; $this->statuts[1] = 'StatusDeliveryValidated';
} }
/** /**
@ -801,9 +801,9 @@ class Livraison extends CommonObject
if ($mode==0) if ($mode==0)
{ {
if ($statut==-1) return $langs->trans('StatusSendingCanceled'); if ($statut==-1) return $langs->trans('StatusDeliveryCanceled');
if ($statut==0) return $langs->trans('StatusSendingDraft'); if ($statut==0) return $langs->trans('StatusDeliveryDraft');
if ($statut==1) return $langs->trans('StatusSendingValidated'); if ($statut==1) return $langs->trans('StatusDeliveryValidated');
} }
if ($mode==1) if ($mode==1)
{ {
@ -813,9 +813,9 @@ class Livraison extends CommonObject
} }
if ($mode == 4) if ($mode == 4)
{ {
if ($statut==-1) return img_picto($langs->trans('StatusSendingCanceled'),'statut5').' '.$langs->trans('StatusSendingCanceled'); if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'),'statut5').' '.$langs->trans('StatusDeliveryCanceled');
if ($statut==0) return img_picto($langs->trans('StatusSendingDraft'),'statut0').' '.$langs->trans('StatusSendingDraft'); if ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'),'statut0').' '.$langs->trans('StatusDeliveryDraft');
if ($statut==1) return img_picto($langs->trans('StatusSendingValidated'),'statut4').' '.$langs->trans('StatusSendingValidated'); if ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'),'statut4').' '.$langs->trans('StatusDeliveryValidated');
} }
} }