Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
Maxime Kohlhaas 2015-04-18 10:29:43 +02:00
commit 7aba52c810
7 changed files with 116 additions and 37 deletions

View File

@ -2930,10 +2930,11 @@ class Form
* @param string $htmlname HTML field name * @param string $htmlname HTML field name
* @param int $maxlength Maximum length for labels * @param int $maxlength Maximum length for labels
* @param int $excludeafterid Exclude all categories after this leaf in category tree. * @param int $excludeafterid Exclude all categories after this leaf in category tree.
* @param int $outputmode 0=HTML select string, 1=Array
* @return string * @return string
* @see select_categories * @see select_categories
*/ */
function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0) function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0, $outputmode=0)
{ {
global $langs; global $langs;
$langs->load("categories"); $langs->load("categories");
@ -2942,6 +2943,7 @@ class Form
$cate_arbo = $cat->get_full_arbo($type,$excludeafterid); $cate_arbo = $cat->get_full_arbo($type,$excludeafterid);
$output = '<select class="flat" name="'.$htmlname.'">'; $output = '<select class="flat" name="'.$htmlname.'">';
$outarray=array();
if (is_array($cate_arbo)) if (is_array($cate_arbo))
{ {
if (! count($cate_arbo)) $output.= '<option value="-1" disabled="disabled">'.$langs->trans("NoCategoriesDefined").'</option>'; if (! count($cate_arbo)) $output.= '<option value="-1" disabled="disabled">'.$langs->trans("NoCategoriesDefined").'</option>';
@ -2959,12 +2961,16 @@ class Form
$add = ''; $add = '';
} }
$output.= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.dol_trunc($cate_arbo[$key]['fulllabel'],$maxlength,'middle').'</option>'; $output.= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.dol_trunc($cate_arbo[$key]['fulllabel'],$maxlength,'middle').'</option>';
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
} }
} }
} }
$output.= '</select>'; $output.= '</select>';
$output.= "\n"; $output.= "\n";
return $output;
if ($outputmode) return $outarray;
return $output;
} }
/** /**

View File

@ -374,9 +374,13 @@ class FormOther
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname); $comboenhancement = ajax_combobox($htmlname);
$out.=$comboenhancement; if ($comboenhancement)
$nodatarole=($comboenhancement?' data-role="none"':''); {
$out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
}
} }
// Select each sales and print them in a select input // Select each sales and print them in a select input
$out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; $out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';

View File

@ -315,7 +315,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
* @param array $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param array $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete * @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete
* @param int $forcefocus Force focus on field * @param int $forcefocus Force focus on field
* @return string Return html string to convert a select field into a combo * @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
*/ */
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0) function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0)
{ {

View File

@ -80,8 +80,8 @@ if (!$user->rights->societe->client->voir && !$socid) // Internal user with no p
} }
$sql.= ")"; $sql.= ")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target AND ee.targettype = 'delivery'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target";
$sql.= " WHERE e.entity = ".$conf->entity; $sql.= " WHERE e.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all
{ {
@ -125,11 +125,10 @@ if ($resql)
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDeliveryPlanned"), $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDeliveryPlanned"), $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
if($conf->expedition_bon->enabled) { if($conf->livraison_bon->enabled)
print_liste_field_titre($langs->trans("DeliveryOrder"), $_SERVER["PHP_SELF"],"e.date_expedition","",$param, '',$sortfield,$sortorder); {
} print_liste_field_titre($langs->trans("DeliveryOrder"), $_SERVER["PHP_SELF"],"l.ref","",$param, '',$sortfield,$sortorder);
if($conf->livraison_bon->enabled) { print_liste_field_titre($langs->trans("DateReceived"), $_SERVER["PHP_SELF"],"l.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateReceived"), $_SERVER["PHP_SELF"],"e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder);
} }
print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
@ -143,13 +142,14 @@ if ($resql)
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="10" name="search_company" value="'.dol_escape_htmltag($search_company).'">'; print '<input class="flat" type="text" size="10" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
print '</td>'; print '</td>';
// Date
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
if($conf->expedition_bon->enabled) { if ($conf->livraison_bon->enabled)
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.'"'; print '<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.'"';
print '</td>'; print '</td>';
}
if($conf->livraison_bon->enabled) {
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
} }
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
@ -193,14 +193,23 @@ if ($resql)
{ {
}*/ }*/
print "</td>\n"; print "</td>\n";
if($conf->expedition_bon->enabled) {
// Date real // Date real
print '<td align="center">'; print '<td align="center">';
print dol_print_date($db->jdate($objp->date_expedition),"day"); print dol_print_date($db->jdate($objp->date_expedition),"day");
print '</td>'."\n"; print '</td>'."\n";
}
if($conf->livraison_bon->enabled) { if ($conf->livraison_bon->enabled)
print '<td align="center">'; {
$shipment->fetchObjectLinked($shipment->id,$shipment->element);
$receiving=(! empty($shipment->linkedObjects['delivery'][0])?$shipment->linkedObjects['delivery'][0]:'');
// Ref
print '<td>';
print !empty($receiving) ? $receiving->getNomUrl($db) : '';
print '</td>';
print '<td align="center">';
print dol_print_date($db->jdate($objp->date_reception),"day"); print dol_print_date($db->jdate($objp->date_reception),"day");
print '</td>'."\n"; print '</td>'."\n";
} }

View File

@ -7,7 +7,7 @@ TripsAndExpenses=Expenses reports
TripsAndExpensesStatistics=Expense reports statistics TripsAndExpensesStatistics=Expense reports statistics
TripCard=Expense report card TripCard=Expense report card
AddTrip=Create expense report AddTrip=Create expense report
ListOfTrips=List of expense report ListOfTrips=List of expense reports
ListOfFees=List of fees ListOfFees=List of fees
NewTrip=New expense report NewTrip=New expense report
CompanyVisited=Company/foundation visited CompanyVisited=Company/foundation visited
@ -27,7 +27,7 @@ AnyOtherInThisListCanValidate=Person to inform for validation.
TripSociete=Information company TripSociete=Information company
TripSalarie=Informations user TripSalarie=Informations user
TripNDF=Informations expense report TripNDF=Informations expense report
DeleteLine=Delete a ligne of the expense report DeleteLine=Delete a line of the expense report
ConfirmDeleteLine=Are you sure you want to delete this line ? ConfirmDeleteLine=Are you sure you want to delete this line ?
PDFStandardExpenseReports=Standard template to generate a PDF document for expense report PDFStandardExpenseReports=Standard template to generate a PDF document for expense report
ExpenseReportLine=Expense report line ExpenseReportLine=Expense report line
@ -40,7 +40,7 @@ TF_BUS=Bus
TF_CAR=Car TF_CAR=Car
TF_PEAGE=Toll TF_PEAGE=Toll
TF_ESSENCE=Fuel TF_ESSENCE=Fuel
TF_HOTEL=Hostel TF_HOTEL=Hotel
TF_TAXI=Taxi TF_TAXI=Taxi
ErrorDoubleDeclaration=You have declared another expense report into a similar date range. ErrorDoubleDeclaration=You have declared another expense report into a similar date range.
@ -56,12 +56,12 @@ ModePaiement=Payment mode
Note=Note Note=Note
Project=Project Project=Project
VALIDATOR=User to inform for approbation VALIDATOR=User responsible for approval
VALIDOR=Approved by VALIDOR=Approved by
AUTHOR=Recorded by AUTHOR=Recorded by
AUTHORPAIEMENT=Paied by AUTHORPAIEMENT=Paid by
REFUSEUR=Denied by REFUSEUR=Denied by
CANCEL_USER=Canceled by CANCEL_USER=Deleted by
MOTIF_REFUS=Reason MOTIF_REFUS=Reason
MOTIF_CANCEL=Reason MOTIF_CANCEL=Reason
@ -74,7 +74,7 @@ DATE_PAIEMENT=Payment date
TO_PAID=Pay TO_PAID=Pay
BROUILLONNER=Reopen BROUILLONNER=Reopen
SendToValid=Sent to approve SendToValid=Sent on approval
ModifyInfoGen=Edit ModifyInfoGen=Edit
ValidateAndSubmit=Validate and submit for approval ValidateAndSubmit=Validate and submit for approval
@ -93,7 +93,7 @@ ConfirmPaidTrip=Are you sure you want to change status of this expense report to
CancelTrip=Cancel an expense report CancelTrip=Cancel an expense report
ConfirmCancelTrip=Are you sure you want to cancel this expense report ? ConfirmCancelTrip=Are you sure you want to cancel this expense report ?
BrouillonnerTrip=Move back expense report to status "Draft"n BrouillonnerTrip=Move back expense report to status "Draft"
ConfirmBrouillonnerTrip=Are you sure you want to move this expense report to status "Draft" ? ConfirmBrouillonnerTrip=Are you sure you want to move this expense report to status "Draft" ?
SaveTrip=Validate expense report SaveTrip=Validate expense report

View File

@ -1,11 +1,11 @@
# Dolibarr language file - Source file is en_US - admin # Dolibarr language file - Source file is en_US - admin
WorkflowSetup=Workflow module setup WorkflowSetup=Workflow module setup
WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is opened (you make thing in order you want). You can activate the automatic actions that you are interesting in. WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is opened (you make thing in order you want). You can activate the automatic actions that you are interested in.
ThereIsNoWorkflowToModify=There is no workflow you can modify for module you have activated. ThereIsNoWorkflowToModify=There is no workflow to modify for the activated module.
descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Create a customer order automatically after a commercial proposal is signed descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a customer order after a commercial proposal is signed
descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Create a customer invoice automatically after a commercial proposal is signed descWORKFLOW_PROPAL_AUTOCREATE_INVOICEAutomatically create a customer invoice after a commercial proposal is signed
descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Create a customer invoice automatically after a contract is validated descWORKFLOW_CONTRACT_AUTOCREATE_INVOICEAutomatically create a customer invoice after a contract is validated
descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Create a customer invoice automatically after a customer order is closed descWORKFLOW_ORDER_AUTOCREATE_INVOICEAutomatically create a customer invoice after a customer order is closed
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer order is set to paid descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer order is set to paid
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated

View File

@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -271,6 +272,16 @@ if (empty($reshook))
if ($id > 0) if ($id > 0)
{ {
// Category association
$categories = GETPOST('categories');
if(!empty($categories)) {
$cat = new Categorie($db);
foreach($categories as $id_category) {
$cat->fetch($id_category);
$cat->add_type($object, 'product');
}
}
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
@ -349,6 +360,23 @@ if (empty($reshook))
{ {
if ($object->update($object->id, $user) > 0) if ($object->update($object->id, $user) > 0)
{ {
// Category association
// First we delete all categories association
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_product";
$sql .= " WHERE fk_product = ".$object->id;
$db->query($sql);
// Then we add the associated categories
$categories = GETPOST('categories');
if(!empty($categories)) {
$cat = new Categorie($db);
foreach($categories as $id_category) {
$cat->fetch($id_category);
$cat->add_type($object, 'product');
}
}
$action = 'view'; $action = 'view';
} }
else else
@ -1003,6 +1031,13 @@ else
$doleditor->Create(); $doleditor->Create();
print "</td></tr>"; print "</td></tr>";
// Categories
print '<tr><td valign="top">'.$langs->trans("Categories").'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(0, '', 'parent', 64, 0, 1);
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, 250);
print "</td></tr>";
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@ -1272,6 +1307,18 @@ else
$doleditor->Create(); $doleditor->Create();
print "</td></tr>"; print "</td></tr>";
// Categories
print '<tr><td valign="top">'.$langs->trans("Categories").'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(0, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
$cats = $c->containing($object->id,0);
foreach($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, 250);
print "</td></tr>";
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@ -1561,6 +1608,19 @@ else
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'">'.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'</td></tr>'."\n"; print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'">'.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'</td></tr>'."\n";
print '<!-- End show Note --> '."\n"; print '<!-- End show Note --> '."\n";
// Categories
print '<tr><td valign="top">'.$langs->trans("Categories").'</td><td colspan="3">';
$cat = new Categorie($db);
$categories = $cat->containing($object->id,0);
$catarray = $form->select_all_categories(0, '', 'parent', 64, 0, 1);
$toprint = array();
foreach($categories as $c) {
$toprint[] = $catarray[$c->id];
}
print implode('<br>', $toprint);
print "</td></tr>";
print "</table>\n"; print "</table>\n";
dol_fiche_end(); dol_fiche_end();