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

This commit is contained in:
Laurent Destailleur 2023-03-29 14:14:57 +02:00
commit 2a8cf082af
3 changed files with 37 additions and 7 deletions

View File

@ -693,6 +693,16 @@ if ($object->id > 0) {
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// Hook to change amount for other reasons, e.g. apply cash discount for payment before agreed date
$parameters = array('remaintopay' => $resteapayer);
$reshook = $hookmanager->executeHooks('finalizeAmountOfSupplierInvoice', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
print $hookmanager->resPrint;
if (!empty($remaintopay = $hookmanager->resArray['remaintopay'])) {
$resteapayer = $remaintopay;
}
}
// TODO Replace this by an include with same code to show already done payment visible in invoice card
print '<tr><td>'.$langs->trans('RemainderToPay').'</td><td class="nowrap">'.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';

View File

@ -121,7 +121,7 @@ class printing_printgcp extends PrintingDriver
$this->google_id = getDolGlobalString('OAUTH_GOOGLE_ID');
$this->google_secret = getDolGlobalString('OAUTH_GOOGLE_SECRET');
// Token storage
$storage = new DoliStorage($this->db, $this->conf, $keyforprovider);
$storage = new DoliStorage($this->db, $conf, $keyforprovider);
//$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE);
// Setup the credentials for the requests
$credentials = new Credentials(
@ -255,12 +255,13 @@ class printing_printgcp extends PrintingDriver
*/
public function getlistAvailablePrinters()
{
global $conf;
$ret = array();
$keyforprovider = ''; // @FIXME
// Token storage
$storage = new DoliStorage($this->db, $this->conf, $keyforprovider);
$storage = new DoliStorage($this->db, $conf, $keyforprovider);
// Setup the credentials for the requests
$credentials = new Credentials(
$this->google_id,
@ -377,6 +378,7 @@ class printing_printgcp extends PrintingDriver
*/
public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype)
{
global $conf;
// Check if printer id
if (empty($printerid)) {
return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'No provided printer ID');
@ -401,7 +403,7 @@ class printing_printgcp extends PrintingDriver
$keyforprovider = ''; // @FIXME
// Dolibarr Token storage
$storage = new DoliStorage($this->db, $this->conf, $keyforprovider);
$storage = new DoliStorage($this->db, $conf, $keyforprovider);
// Setup the credentials for the requests
$credentials = new Credentials(
$this->google_id,
@ -453,7 +455,7 @@ class printing_printgcp extends PrintingDriver
$keyforprovider = ''; // @FIXME
// Token storage
$storage = new DoliStorage($this->db, $this->conf, $keyforprovider);
$storage = new DoliStorage($this->db, $conf, $keyforprovider);
// Setup the credentials for the requests
$credentials = new Credentials(
$this->google_id,

View File

@ -893,7 +893,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).'">';
print $ldap_lastname;
} else {
print '<input class="minwidth100 maxwidth150onsmartphone" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(GETPOST('lastname', 'alphanohtml')).'">';
print '<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(GETPOST('lastname', 'alphanohtml')).'">';
}
print '</td></tr>';
@ -904,7 +904,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).'">';
print $ldap_firstname;
} else {
print '<input class="minwidth100 maxwidth150onsmartphone" type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST('firstname', 'alphanohtml')).'">';
print '<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST('firstname', 'alphanohtml')).'">';
}
print '</td></tr>';
@ -918,10 +918,28 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).'">';
print $ldap_loginsmb;
} else {
print '<input class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(GETPOST('login', 'alphanohtml')).'">';
print '<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(GETPOST('login', 'alphanohtml')).'">';
}
print '</td></tr>';
if (!empty($conf->use_javascript_ajax)) {
print '<script>
jQuery(document).ready(function() {
$(".createloginauto").on("change", function(){
lastname = $("#lastname").val();
firstname = $("#firstname").val();
if($(this).attr("id") == "firstname"){
firstname = firstname.toLowerCase();
firstname = firstname[0];
}
lastname = lastname.toLowerCase();
console.log("We create a login from firstname and lastname");
$("#login").val(firstname+lastname);
})
});
</script>';
}
$generated_password = '';
if (empty($ldap_sid)) { // ldap_sid is for activedirectory
$generated_password = getRandomPassword(false);