Browse Source

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

Laurent Destailleur 3 years ago
parent
commit
af8c973050

+ 24 - 4
htdocs/admin/ihm.php

@@ -255,7 +255,7 @@ if ($action == 'update') {
 
 	$_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer
 
-	header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
+	header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(GETPOSTISSET('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : ''));
 	exit;
 }
 
@@ -281,6 +281,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
 print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
 print '<input type="hidden" name="token" value="'.newToken().'">';
 print '<input type="hidden" name="action" value="update">';
+print '<input type="hidden" name="page_y" value="">';
 
 clearstatcache();
 
@@ -292,8 +293,9 @@ print '</tr>';
 
 // Default language
 print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
+print img_picto('', 'language', 'class="pictofixedwidth"');
 print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2);
-print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">';
+//print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">';
 print '</td>';
 print '</tr>';
 
@@ -303,12 +305,24 @@ print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0);
 print '</td>';
 print '</tr>';
 
-print '</table><br>'."\n";
+print '</table>'."\n";
+print '</div>';
+
+print '<br>';
+print '<div class="center">';
+print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">';
 print '</div>';
 
+print '<br><br>';
+
 // Themes and themes options
 showSkins(null, 1);
 print '<br>';
+print '<div class="center">';
+print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
+print '</div>';
+
+print '<br><br>';
 
 // Other
 print '<div class="div-table-responsive-no-min">';
@@ -440,6 +454,12 @@ print '</div>';
 
 print '<br>';
 
+print '<div class="center">';
+print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
+print '</div>';
+
+print '<br><br>';
+
 // Other
 print '<div class="div-table-responsive-no-min">';
 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
@@ -497,7 +517,7 @@ print '</div>';
 
 print '<br>';
 print '<div class="center">';
-print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">';
+print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
 print '</div>';
 
 print '</form>';

+ 73 - 67
htdocs/compta/bank/treso.php

@@ -98,44 +98,6 @@ if (GETPOST("account") || GETPOST("ref")) {
 
 	print dol_get_fiche_end();
 
-	print '<br>';
-
-	$solde = $object->solde(0);
-	if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
-		$colspan = 6;
-	} else {
-		$colspan = 5;
-	}
-
-	// Show next coming entries
-	print '<div class="div-table-responsive">';
-	print '<table class="noborder centpercent">';
-
-	// Ligne de titre tableau des ecritures
-	print '<tr class="liste_titre">';
-	print '<td>'.$langs->trans("DateDue").'</td>';
-	print '<td>'.$langs->trans("Description").'</td>';
-	if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
-		print '<td>'.$langs->trans("Entity").'</td>';
-	}
-	print '<td>'.$langs->trans("ThirdParty").'</td>';
-	print '<td class="right">'.$langs->trans("Debit").'</td>';
-	print '<td class="right">'.$langs->trans("Credit").'</td>';
-	print '<td class="right" width="80">'.$langs->trans("BankBalance").'</td>';
-	print '</tr>';
-
-	// Current balance
-	print '<tr class="liste_total">';
-	print '<td class="left" colspan="5">'.$langs->trans("CurrentBalance").'</td>';
-	print '<td class="nowrap right">'.price($solde).'</td>';
-	print '</tr>';
-
-
-	print '<tr class="liste_titre">';
-	print '<td class="left" colspan="'.$colspan.'">'.$langs->trans("RemainderToPay").'</td>';
-	print '<td class="nowrap right">&nbsp;</td>';
-	print '</tr>';
-
 
 	// Remainder to pay in future
 	$sqls = array();
@@ -183,10 +145,12 @@ if (GETPOST("account") || GETPOST("ref")) {
 	$error = 0;
 	$tab_sqlobjOrder = array();
 	$tab_sqlobj = array();
+	$nbtotalofrecords = 0;
 
 	foreach ($sqls as $sql) {
 		$resql = $db->query($sql);
 		if ($resql) {
+			$nbtotalofrecords += $db->num_rows($resql);
 			while ($sqlobj = $db->fetch_object($resql)) {
 				$tmpobj = new stdClass();
 				$tmpobj->family = $sqlobj->family;
@@ -194,7 +158,7 @@ if (GETPOST("account") || GETPOST("ref")) {
 				$tmpobj->ref = $sqlobj->ref;
 				$tmpobj->total_ttc = $sqlobj->total_ttc;
 				$tmpobj->type = $sqlobj->type;
-				$tmpobj->dlt = $sqlobj->dlr;
+				$tmpobj->dlr = $db->jdate($sqlobj->dlr);
 				$tmpobj->socid = $sqlobj->socid;
 				$tmpobj->name = $sqlobj->name;
 				$tmpobj->fournisseur = $sqlobj->fournisseur;
@@ -208,6 +172,48 @@ if (GETPOST("account") || GETPOST("ref")) {
 		}
 	}
 
+	$param = '';
+	$sortfield = '';
+	$sortorder = '';
+	$massactionbutton = '';
+	$num = 0;
+	$picto = '';
+	$morehtml = '';
+	$limit = 0;
+
+	print_barre_liste($langs->trans("RemainderToPay"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1);
+
+
+	$solde = $object->solde(0);
+	if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
+		$colspan = 6;
+	} else {
+		$colspan = 5;
+	}
+
+	// Show next coming entries
+	print '<div class="div-table-responsive">';
+	print '<table class="noborder centpercent">';
+
+	// Ligne de titre tableau des ecritures
+	print '<tr class="liste_titre">';
+	print '<td>'.$langs->trans("DateDue").'</td>';
+	print '<td>'.$langs->trans("Description").'</td>';
+	if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
+		print '<td>'.$langs->trans("Entity").'</td>';
+	}
+	print '<td>'.$langs->trans("ThirdParty").'</td>';
+	print '<td class="right">'.$langs->trans("Debit").'</td>';
+	print '<td class="right">'.$langs->trans("Credit").'</td>';
+	print '<td class="right" width="80">'.$langs->trans("BankBalance").'</td>';
+	print '</tr>';
+
+	// Current balance
+	print '<tr class="liste_total">';
+	print '<td class="left" colspan="5">'.$langs->trans("CurrentBalance").'</td>';
+	print '<td class="nowrap right">'.price($solde).'</td>';
+	print '</tr>';
+
 	// Sort array
 	if (!$error) {
 		array_multisort($tab_sqlobjOrder, $tab_sqlobj);
@@ -220,60 +226,60 @@ if (GETPOST("account") || GETPOST("ref")) {
 			$refcomp = '';
 			$totalpayment = '';
 
-			$obj = array_shift($tab_sqlobj);
+			$tmpobj = array_shift($tab_sqlobj);
 
-			if ($obj->family == 'invoice_supplier') {
+			if ($tmpobj->family == 'invoice_supplier') {
 				$showline = 1;
 				// Uncomment this line to avoid to count suppliers credit note (ff.type = 2)
-				//$showline=(($obj->total_ttc < 0 && $obj->type != 2) || ($obj->total_ttc > 0 && $obj->type == 2))
+				//$showline=(($tmpobj->total_ttc < 0 && $tmpobj->type != 2) || ($tmpobj->total_ttc > 0 && $tmpobj->type == 2))
 				if ($showline) {
-					$ref = $obj->ref;
+					$ref = $tmpobj->ref;
 					$facturefournstatic->ref = $ref;
-					$facturefournstatic->id = $obj->objid;
-					$facturefournstatic->type = $obj->type;
+					$facturefournstatic->id = $tmpobj->objid;
+					$facturefournstatic->type = $tmpobj->type;
 					$ref = $facturefournstatic->getNomUrl(1, '');
 
-					$societestatic->id = $obj->socid;
-					$societestatic->name = $obj->name;
+					$societestatic->id = $tmpobj->socid;
+					$societestatic->name = $tmpobj->name;
 					$refcomp = $societestatic->getNomUrl(1, '', 24);
 
 					$totalpayment = -1 * $facturefournstatic->getSommePaiement(); // Payment already done
 				}
 			}
-			if ($obj->family == 'invoice') {
-				$facturestatic->ref = $obj->ref;
-				$facturestatic->id = $obj->objid;
-				$facturestatic->type = $obj->type;
+			if ($tmpobj->family == 'invoice') {
+				$facturestatic->ref = $tmpobj->ref;
+				$facturestatic->id = $tmpobj->objid;
+				$facturestatic->type = $tmpobj->type;
 				$ref = $facturestatic->getNomUrl(1, '');
 
-				$societestatic->id = $obj->socid;
-				$societestatic->name = $obj->name;
+				$societestatic->id = $tmpobj->socid;
+				$societestatic->name = $tmpobj->name;
 				$refcomp = $societestatic->getNomUrl(1, '', 24);
 
 				$totalpayment = $facturestatic->getSommePaiement(); // Payment already done
 				$totalpayment += $facturestatic->getSumDepositsUsed();
 				$totalpayment += $facturestatic->getSumCreditNotesUsed();
 			}
-			if ($obj->family == 'social_contribution') {
-				$socialcontribstatic->ref = $obj->ref;
-				$socialcontribstatic->id = $obj->objid;
-				$socialcontribstatic->label = $obj->type;
+			if ($tmpobj->family == 'social_contribution') {
+				$socialcontribstatic->ref = $tmpobj->ref;
+				$socialcontribstatic->id = $tmpobj->objid;
+				$socialcontribstatic->label = $tmpobj->type;
 				$ref = $socialcontribstatic->getNomUrl(1, 24);
 
 				$totalpayment = -1 * $socialcontribstatic->getSommePaiement(); // Payment already done
 			}
 
-			$parameters = array('obj' => $obj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment);
-			$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+			$parameters = array('obj' => $tmpobj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment);
+			$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $tmpobject, $action); // Note that $action and $tmpobject may have been modified by hook
 			if (empty($reshook)) {
 				$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref;
 				$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp;
 				$totalpayment = isset($hookmanager->resArray['totalpayment']) ? $hookmanager->resArray['totalpayment'] : $totalpayment;
 			}
 
-			$total_ttc = $obj->total_ttc;
+			$total_ttc = $tmpobj->total_ttc;
 			if ($totalpayment) {
-				$total_ttc = $obj->total_ttc - $totalpayment;
+				$total_ttc = $tmpobj->total_ttc - $totalpayment;
 			}
 			$solde += $total_ttc;
 
@@ -282,26 +288,26 @@ if (GETPOST("account") || GETPOST("ref")) {
 				// Show line
 				print '<tr class="oddeven">';
 				print '<td>';
-				if ($obj->dlr) {
-					print dol_print_date($db->jdate($obj->dlr), "day");
+				if ($tmpobj->dlr) {
+					print dol_print_date($tmpobj->dlr, "day");
 				} else {
 					print $langs->trans("NotDefined");
 				}
 				print "</td>";
 				print "<td>".$ref."</td>";
 				if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
-					if ($obj->family == 'invoice') {
-						$mc->getInfo($obj->entity);
+					if ($tmpobj->family == 'invoice') {
+						$mc->getInfo($tmpobj->entity);
 						print "<td>".$mc->label."</td>";
 					} else {
 						print "<td></td>";
 					}
 				}
 				print "<td>".$refcomp."</td>";
-				if ($obj->total_ttc < 0) {
+				if ($tmpobj->total_ttc < 0) {
 					print '<td class="nowrap right">'.price(abs($total_ttc))."</td><td>&nbsp;</td>";
 				};
-				if ($obj->total_ttc >= 0) {
+				if ($tmpobj->total_ttc >= 0) {
 					print '<td>&nbsp;</td><td class="nowrap right">'.price($total_ttc)."</td>";
 				};
 				print '<td class="nowrap right">'.price($solde).'</td>';

+ 1 - 1
htdocs/fourn/ajax/getSupplierPrices.php

@@ -43,7 +43,7 @@ $idprod = GETPOST('idprod', 'int');
 $prices = array();
 
 // Load translation files required by the page
-$langs->loadLangs(array("stocks", "margins"));
+$langs->loadLangs(array("stocks", "margins", "products"));
 
 
 /*

+ 23 - 20
htdocs/fourn/facture/card.php

@@ -2739,14 +2739,17 @@ if ($action == 'create') {
 
 		// Label
 		print '<tr>';
-		print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, ($usercancreate)).'</td>';
-		print '<td>'.$form->editfieldval("Label", 'label', $object->label, $object, ($usercancreate)).'</td>';
+		print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, $usercancreate).'</td>';
+		print '<td>'.$form->editfieldval("Label", 'label', $object->label, $object, $usercancreate).'</td>';
 		print '</tr>';
 
 		$form_permission = ($object->statut < FactureFournisseur::STATUS_CLOSED) && $usercancreate && ($object->getSommePaiement() <= 0);
+		$form_permission2 = ($object->statut < FactureFournisseur::STATUS_CLOSED) && $usercancreate;
 
 		// Date
-		print '<tr><td>'.$form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
+		print '<tr><td>';
+		print $form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker');
+		print '</td><td colspan="3">';
 		print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker');
 		print '</td>';
 
@@ -2756,11 +2759,11 @@ if ($action == 'create') {
 		print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
 		print $langs->trans('PaymentConditions');
 		print '<td>';
-		if ($action != 'editconditions' && $usercancreate) {
+		if ($action != 'editconditions' && $form_permission) {
 			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
 		}
 		print '</tr></table>';
-		print '</td><td colspan="2">';
+		print '</td><td>';
 		if ($action == 'editconditions') {
 			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
 		} else {
@@ -2770,8 +2773,10 @@ if ($action == 'create') {
 		print '</tr>';
 
 		// Due date
-		print '<tr><td>'.$form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
-		print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker');
+		print '<tr><td>';
+		print $form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission2, 'datepicker');
+		print '</td><td>';
+		print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission2, 'datepicker');
 		if ($action != 'editdate_lim_reglement' && $object->hasDelay()) {
 			print img_warning($langs->trans('Late'));
 		}
@@ -2783,11 +2788,11 @@ if ($action == 'create') {
 		print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
 		print $langs->trans('PaymentMode');
 		print '</td>';
-		if ($action != 'editmode' && $usercancreate) {
+		if ($action != 'editmode' && $form_permission2) {
 			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
 		}
 		print '</tr></table>';
-		print '</td><td colspan="2">';
+		print '</td><td>';
 		if ($action == 'editmode') {
 			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1);
 		} else {
@@ -2807,7 +2812,7 @@ if ($action == 'create') {
 				print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
 			}
 			print '</tr></table>';
-			print '</td><td colspan="3">';
+			print '</td><td>';
 			if ($action == 'editmulticurrencycode') {
 				$form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code');
 			} else {
@@ -2819,14 +2824,14 @@ if ($action == 'create') {
 			if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) {
 				print '<tr>';
 				print '<td>';
-				print '<table class="nobordernopadding" width="100%"><tr><td>';
+				print '<table class="nobordernopadding centpercent"><tr><td>';
 				print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
 				print '</td>';
 				if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
 					print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
 				}
 				print '</tr></table>';
-				print '</td><td colspan="3">';
+				print '</td><td>';
 				if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
 					if ($action == 'actualizemulticurrencyrate') {
 						list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
@@ -2854,7 +2859,7 @@ if ($action == 'create') {
 				print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
 			}
 			print '</tr></table>';
-			print '</td><td colspan="3">';
+			print '</td><td>';
 			if ($action == 'editbankaccount') {
 				$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
 			} else {
@@ -2877,7 +2882,7 @@ if ($action == 'create') {
 			}
 			print '</td></tr></table>';
 			print '</td>';
-			print '<td colspan="3">';
+			print '<td>';
 			if ($action != 'editincoterm') {
 				print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
 			} else {
@@ -2898,7 +2903,6 @@ if ($action == 'create') {
 			}
 			print '</tr></table>';
 			print '</td>';
-
 			print '<td>';
 			if ($action == 'editmode') {
 				$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1, 1);
@@ -2913,8 +2917,8 @@ if ($action == 'create') {
 		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
 
 		print '</table>';
-
 		print '</div>';
+
 		print '<div class="fichehalfright">';
 		print '<div class="ficheaddleft">';
 		print '<div class="underbanner clearboth"></div>';
@@ -2933,7 +2937,7 @@ if ($action == 'create') {
 			print '</tr>';
 
 			// Multicurrency Amount TTC
-			print '<tr><td height="10">'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
+			print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
 			print '<td>'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
 			print '</tr>';
 		}
@@ -2977,9 +2981,8 @@ if ($action == 'create') {
 
 		print '</table>';
 
-		/*
-		 * List of payments
-		 */
+
+		// List of payments
 
 		$totalpaye = 0;