Selaa lähdekoodia

Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into 14.0

Conflicts:
	htdocs/core/actions_massactions.inc.php
	htdocs/core/ajax/objectonoff.php
Laurent Destailleur 3 vuotta sitten
vanhempi
commit
3de3adad74

+ 5 - 0
htdocs/compta/facture/card.php

@@ -1645,6 +1645,11 @@ if (empty($reshook)) {
 										$discount->tva_tx = $lines[$i]->tva_tx;
 										$discount->fk_user = $user->id;
 										$discount->description = $desc;
+                                        $discount->multicurrency_subprice = abs($lines[$i]->multicurrency_subprice);
+                                        $discount->multicurrency_amount_ht = abs($lines[$i]->multicurrency_total_ht);
+                                        $discount->multicurrency_amount_tva = abs($lines[$i]->multicurrency_total_tva);
+                                        $discount->multicurrency_amount_ttc = abs($lines[$i]->multicurrency_total_ttc);
+
 										$discountid = $discount->create($user);
 										if ($discountid > 0) {
 											$result = $object->insert_discount($discountid); // This include link_to_invoice

+ 0 - 8
htdocs/compta/facture/contact.php

@@ -100,14 +100,6 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
  * View
  */
 
-if (empty($object->id)) {
-	llxHeader();
-	$langs->load('errors');
-	echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
-	llxFooter();
-	exit;
-}
-
 $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
 $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
 llxHeader('', $title, $helpurl);

+ 9 - 1
htdocs/core/actions_massactions.inc.php

@@ -1298,6 +1298,12 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
 				continue;
 			}
 
+			if ($objectclass == 'Holiday' && ! in_array($objecttmp->statut, array(Holiday::STATUS_DRAFT, Holiday::STATUS_CANCELED, Holiday::STATUS_REFUSED))) {
+				$nbignored++;
+				$resaction .= '<div class="error">'.$langs->trans('ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref).'</div><br>';
+				continue;
+			}
+
 			if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) {
 				$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".((int) $objecttmp->id);
 				$res = $db->query($sql);
@@ -1331,8 +1337,10 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
 	if (!$error) {
 		if ($nbok > 1) {
 			setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
+		} elseif ($nbok > 0) {
+			setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
 		} else {
-			setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
+			setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
 		}
 		$db->commit();
 	} else {

+ 8 - 12
htdocs/core/ajax/objectonoff.php

@@ -65,9 +65,14 @@ if (!empty($user->socid)) {
 	$socid = $user->socid;
 }
 
-/*if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
-	accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set');
-}*/
+if (in_array($field, array('status'))) {
+	restrictedArea($user, $element, $id);
+} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) {	// Special case for products
+	restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
+} else {
+	accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
+	exit;
+}
 
 
 /*
@@ -78,15 +83,6 @@ top_httphead();
 
 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
 
-if (in_array($field, array('status'))) {
-	restrictedArea($user, $element, $id);
-} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) {	// Special case for products
-	restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
-} else {
-	accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
-	exit;
-}
-
 // Registering new values
 if (($action == 'set') && !empty($id)) {
 	$triggerkey = strtoupper($element).'_UPDATE';

+ 1 - 0
htdocs/langs/en_US/holiday.lang

@@ -132,3 +132,4 @@ FreeLegalTextOnHolidays=Free text on PDF
 WatermarkOnDraftHolidayCards=Watermarks on draft leave requests
 HolidaysToApprove=Holidays to approve
 NobodyHasPermissionToValidateHolidays=Nobody has permission to validate holidays
+ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted=Leave request %s must be draft, canceled or refused to be deleted

+ 0 - 1
htdocs/projet/activity/perweek.php

@@ -513,7 +513,6 @@ if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
 
 for ($idw = 0; $idw < 7; $idw++) {
 	$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
-	$dayinloop = dol_time_plus_duree($startday, $idw, 'd');
 
 	// Useless because $dayinloopwithouthours should be same than $dayinloopfromfirstdaytoshow
 	//$tmparray = dol_getdate($dayinloop);