Merge branch 'develop' of github.com:Dolibarr/dolibarr into new-expedition-card-eat-sell-by-show

This commit is contained in:
lvessiller 2022-08-12 15:13:34 +02:00
commit a570244641
46 changed files with 226 additions and 139 deletions

View File

@ -141,7 +141,7 @@ NEW: Added MMK currency (Myanmar Kyat)
Modules
NEW: Module Partnership Management
NEW: Experimental Module Event Organization Management
NEW: Module Event Organization Management
For developers or integrators:

View File

@ -117,7 +117,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
if (!empty($user->rights->accounting->chartofaccount)) {
if ($user->hasRight('accounting', 'chartofaccount')) {
print "<br>\n"; print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";

View File

@ -278,7 +278,7 @@ if (empty($reshook)) {
}
// Create new object
if ($result > 0 && !$error) {
$object->oldcopy = clone $object;
$object->oldcopy = dol_clone($object);
// Change values
$object->civility_id = trim(GETPOST("civility_id", 'alphanohtml'));
@ -582,36 +582,15 @@ if (empty($reshook)) {
$id = $object->id;
} else {
$db->rollback();
if ($object->error) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
setEventMessages($object->error, $object->errors, 'errors');
}
// Auto-create thirdparty on member creation
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
if ($result > 0) {
// User creation
// Create third party out of a member
$company = new Societe($db);
$companyalias = '';
$fullname = $object->getFullName($langs);
if ($object->morphy == 'mor') {
$companyname = $object->company;
if (!empty($fullname)) {
$companyalias = $fullname;
}
} else {
$companyname = $fullname;
if (!empty($object->company)) {
$companyalias = $object->company;
}
}
$result = $company->create_from_member($object, $companyname, $companyalias);
$result = $company->create_from_member($object);
if ($result < 0) {
$langs->load("errors");
setEventMessages($langs->trans($company->error), null, 'errors');
@ -1560,7 +1539,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Create form popup
$formquestion = array();
if ($object->email) {
$formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL ?true:false));
$formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (getDolGlobalString('ADHERENT_DEFAULT_SENDINFOBYMAIL') ? true : false));
}
if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
$formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"), 'value'=>'');
@ -1591,7 +1570,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$outputlangs->loadLangs(array("main", "members"));
// Get email content from template
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_CANCELATION');
if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);

View File

@ -972,10 +972,10 @@ class Adherent extends CommonObject
}
/**
* Fonction qui supprime l'adherent et les donnees associees
* Fonction to delete a member and its data
*
* @param int $rowid Id of member to delete
* @param User $user User object
* @param User $user User object
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, 0=nothing to do, >0 if OK
*/

View File

@ -440,6 +440,7 @@ class AdherentType extends CommonObject
/**
* Function to delete the member's status
* TODO Add param "User $user"
*
* @return int > 0 if OK, 0 if not found, < 0 if KO
*/

View File

@ -41,6 +41,7 @@ $langs->load("members");
$rowid = GETPOST('rowid', 'int');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$sall = GETPOST("sall", "alpha");
@ -170,7 +171,8 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
if ($action == 'update' && $user->rights->adherent->configurer) {
$object->fetch($rowid);
$object->oldcopy = clone $object;
$object->oldcopy = dol_clone($object);
$object->label= trim($label);
$object->morphy = trim($morphy);
$object->status = (int) $status;
@ -201,7 +203,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
exit;
}
if ($action == 'confirm_delete' && $user->rights->adherent->configurer) {
if ($action == 'confirm_delete' && !empty($user->rights->adherent->configurer)) {
$object->fetch($rowid);
$res = $object->delete();
@ -447,7 +449,7 @@ if ($rowid > 0) {
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="tableforfield border centpercent">';
// Morphy
print '<tr><td>'.$langs->trans("MembersNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
@ -681,20 +683,23 @@ if ($rowid > 0) {
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
while ($i < $num && $i < $conf->liste_limit) {
$adh = new Adherent($db);
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$objp = $db->fetch_object($resql);
$datefin = $db->jdate($objp->datefin);
$adh = new Adherent($db);
$adh->lastname = $objp->lastname;
$adh->firstname = $objp->firstname;
$adh->datefin = $datefin;
$adh->need_subscription = $objp->subscription;
$adh->statut = $objp->status;
// Lastname
print '<tr class="oddeven">';
// Lastname
if ($objp->company != '') {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n";
} else {
@ -702,7 +707,7 @@ if ($rowid > 0) {
}
// Login
print "<td>".$objp->login."</td>\n";
print "<td>".dol_escape_htmltag($objp->login)."</td>\n";
// Type
/*print '<td class="nowrap">';
@ -759,11 +764,15 @@ if ($rowid > 0) {
$i++;
}
if ($i == 0) {
print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print "</table>\n";
print '</div>';
print '</form>';
if ($num > $conf->liste_limit) {
if ($num > $limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
}
} else {

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
// Load translation files required by the page
$langs->loadLangs(array('members', 'languages'));
$id = GETPOST('rowid', 'int');
$id = GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$ref = GETPOST('ref', 'alphanohtml');
@ -61,7 +61,12 @@ if ($cancel == $langs->trans("Cancel")) {
if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) {
$object = new AdherentType($db);
$object->fetch($id);
$object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user);
$result = $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user);
if ($result > 0) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id);
exit;
}
}
// Add translation

View File

@ -228,14 +228,14 @@ if ($action == 'edit') {
if ($val['type'] == 'textarea') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
print $conf->global->{$constname};
print getDolGlobalString($constname);
print "</textarea>\n";
} elseif ($val['type']== 'html') {
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
} elseif ($val['type'] == 'yesno') {
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
print $form->selectyesno($constname, getDolGlobalString($constname), 1);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
@ -255,7 +255,7 @@ if ($action == 'edit') {
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
}
}
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
} elseif (preg_match('/category:/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -263,13 +263,13 @@ if ($action == 'edit') {
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname, 'customerorprospect', 'form', '', 1);
print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname, 'customerorprospect', 'form', '', 1);
} elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
print '<input type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : getDolGlobalString($constname)).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
}
@ -283,7 +283,7 @@ if ($action == 'edit') {
$form->select_produits($selected, $constname, '', 0);
}
} else {
print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . $conf->global->{$constname} . '">';
print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . getDolGlobalString($constname) . '">';
}
print '</td></tr>';
}
@ -309,28 +309,28 @@ if ($action == 'edit') {
print '</td><td>';
if ($val['type'] == 'textarea') {
print dol_nl2br($conf->global->{$constname});
print dol_nl2br(getDolGlobalString($constname));
} elseif ($val['type']== 'html') {
print $conf->global->{$constname};
print getDolGlobalString($constname);
} elseif ($val['type'] == 'yesno') {
print ajax_constantonoff($constname);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
if (!empty($conf->global->{$constname})) {
if (getDolGlobalString($constname)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
if ($template < 0) {
setEventMessages(null, $formmail->errors, 'errors');
}
print $langs->trans($template->label);
}
} elseif (preg_match('/category:/', $val['type'])) {
if (!empty($conf->global->{$constname})) {
if (getDolGlobalString($constname)) {
$c = new Categorie($db);
$result = $c->fetch($conf->global->{$constname});
$result = $c->fetch(getDolGlobalString($constname));
if ($result < 0) {
setEventMessages(null, $c->errors, 'errors');
}
@ -342,25 +342,25 @@ if ($action == 'edit') {
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
}
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
if ($conf->global->{$constname}==2) {
if (getDolGlobalString($constname)==2) {
print $langs->trans("Prospect");
} elseif ($conf->global->{$constname}==3) {
} elseif (getDolGlobalString($constname)==3) {
print $langs->trans("ProspectCustomer");
} elseif ($conf->global->{$constname}==1) {
} elseif (getDolGlobalString($constname)==1) {
print $langs->trans("Customer");
} elseif ($conf->global->{$constname}==0) {
} elseif (getDolGlobalString($constname)==0) {
print $langs->trans("NorProspectNorCustomer");
}
} elseif ($val['type'] == 'product') {
$product = new Product($db);
$resprod = $product->fetch($conf->global->{$constname});
$resprod = $product->fetch(getDolGlobalString($constname));
if ($resprod > 0) {
print $product->getNomUrl(1);
} elseif ($resprod < 0) {
setEventMessages(null, $object->errors, "errors");
setEventMessages($product->error, $product->errors, "errors");
}
} else {
print $conf->global->{$constname};
print getDolGlobalString($constname);
}
print '</td></tr>';
}

View File

@ -43,10 +43,15 @@ require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
// Load translation files required by the page
$langs->loadLangs(array("errors", "admin", "modulebuilder"));
$mode = GETPOSTISSET('mode') ? GETPOST('mode', 'alpha') : (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common');
if (empty($mode)) {
$mode = 'common';
// if we set another view list mode, we keep it (till we change one more time)
if (GETPOSTISSET('mode')) {
$mode = GETPOST('mode', 'alpha');
if ($mode =='common' || $mode =='commonkanban')
dolibarr_set_const($db, "MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode, 'chaine', 0, '', $conf->entity);
} else {
$mode = (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
}
$action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha');
$page_y = GETPOST('page_y', 'int');

View File

@ -677,7 +677,7 @@ if (empty($reshook) && $action == 'update') {
$object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$object->oldcopy = clone $object;
$object->oldcopy = dol_clone($object);
// Clean parameters
if ($fulldayevent) {
@ -927,7 +927,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes
$object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$object->oldcopy = clone $object;
$object->oldcopy = dol_clone($object);
if ($user->rights->agenda->myactions->delete
|| $user->rights->agenda->allactions->delete) {

View File

@ -216,7 +216,9 @@ class CActionComm
if ($obj->module == 'shipping' && !empty($conf->expedition->enabled) && !empty($user->rights->expedition->lire)) {
$qualified = 1;
}
if (preg_split("/@/", $obj->module, -1)[1] == 'eventorganization' && !empty($conf->eventorganization->enabled)) {
// For case module = 'myobject@eventorganization'
$tmparray = preg_split("/@/", $obj->module, -1);
if (count($tmparray) > 1 && $tmparray[1] == 'eventorganization' && !empty($conf->eventorganization->enabled)) {
$qualified = 1;
}
// For the generic case with type = 'module...' and module = 'myobject@mymodule'

View File

@ -212,7 +212,7 @@ if (GETPOST("viewperuser", 'alpha') || $mode == 'show_peruser') {
$event->fetch($actionid);
$event->fetch_optionals();
$event->fetch_userassigned();
$event->oldcopy = clone $event;
$event->oldcopy = dol_clone($event);
$result = $event->delete();
}

View File

@ -189,7 +189,7 @@ if ($action == 'delete_action' && $user->rights->agenda->delete) {
$event->fetch($actionid);
$event->fetch_optionals();
$event->fetch_userassigned();
$event->oldcopy = clone $event;
$event->oldcopy = dol_clone($event);
$result = $event->delete();
}

View File

@ -196,7 +196,7 @@ if ($action == 'delete_action' && $user->rights->agenda->delete) {
$event->fetch($actionid);
$event->fetch_optionals();
$event->fetch_userassigned();
$event->oldcopy = clone $event;
$event->oldcopy = dol_clone($event);
$result = $event->delete();
}

View File

@ -1851,7 +1851,7 @@ if ($action == 'create') {
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
$objectsrc->remise_absolue = $remise_absolue; // deprecated
$objectsrc->remise_percent = $remise_percent;
$objectsrc->update_price(1, - 1, 1);
$objectsrc->update_price(1, 'auto', 1);
}
print "\n<!-- ".$classname." info -->";

View File

@ -235,8 +235,12 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
$rowids = GETPOST('rowid', 'array');
// Conciliation
if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && !empty($user->rights->banque->consolidate)
if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha'))
&& (GETPOST("num_releve", "alpha") || !empty($rowids))
&& !empty($user->rights->banque->consolidate)
&& (!GETPOSTISSET('pageplusone') || (GETPOST('pageplusone') == GETPOST('pageplusoneold')))) {
$error = 0;

View File

@ -3785,7 +3785,7 @@ if ($action == 'create') {
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
$objectsrc->remise_absolue = $remise_absolue;
$objectsrc->remise_percent = $remise_percent;
$objectsrc->update_price(1, - 1, 1);
$objectsrc->update_price(1, 'auto', 1);
}
print "\n<!-- Show ref of origin ".$classname." -->\n";

View File

@ -169,13 +169,8 @@ if ($action == 'create') {
}
print load_fiche_titre($langs->trans("DoPayment"));
print "<br>\n";
if ($mesg) {
print "<div class=\"error\">$mesg</div>";
}
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$chid.'">';
print '<input type="hidden" name="chid" value="'.$chid.'">';

View File

@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$id = GETPOST('id', 'int');
@ -46,7 +47,7 @@ if (empty($object->thirdparty)) {
$socid = $object->thirdparty->id;
// Sort & Order fields
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -230,7 +231,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id);
$tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='propal' and tc.source='external' and tc.active=1)";
$where = ' WHERE c.entity IN ('.getEntity('propal').')';
$datePrint = 'c.datep';
$dateprint = 'c.datep';
$doc_number = 'c.ref';
$thirdTypeSelect = 'customer';
} elseif ($type_element == 'order') {
@ -443,6 +444,8 @@ if ($sql_select) {
$i = 0;
$total_qty = 0;
$total_ht = 0;
while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) {
$documentstatic->id = $objp->doc_id;
$documentstatic->ref = $objp->doc_number;

View File

@ -60,7 +60,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->societe->contact
$result = $object->update_perso($id, $user);
if ($result > 0) {
$object->oldcopy = clone $object;
$object->oldcopy = dol_clone($object);
// Logo/Photo save
$dir = $conf->societe->dir_output.'/contact/'.get_exdir($object->id, 0, 0, 1, $object, 'contact').'/photos';

View File

@ -76,7 +76,11 @@ if ($id) {
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$object->id.'" class="refid">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
$morehtmlref .= '<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS) && !empty($socid)) {
$object->thirdparty->fetch($socid);
// Thirdparty

View File

@ -44,7 +44,6 @@ if ($result <= 0) {
exit;
}
$physicalperson = 1;
$company = new Societe($db);
if ($contact->socid) {
@ -107,7 +106,7 @@ if ($company->id) {
}
// Si contact lie a un tiers non de type "particulier"
if ($contact->typent_code != 'TE_PRIVATE') {
if ($company->typent_code != 'TE_PRIVATE') {
$v->setOrg($company->name);
}
}

View File

@ -3135,8 +3135,7 @@ class ContratLigne extends CommonObjectLine
$this->db->begin();
$this->oldcopy = new ContratLigne($this->db);
$this->oldcopy->fetch($this->id);
$this->oldcopy = dol_clone($this);
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";

View File

@ -31,6 +31,7 @@
*/
use OAuth\Common\Storage\DoliStorage;
use OAuth\Common\Consumer\Credentials;
/**
* Class to send emails (with attachments or not)
* Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid,$moreinheader,$sendcontext,$replyto);
@ -981,8 +982,31 @@ class CMailFile
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
$storage = new DoliStorage($db, $conf);
try {
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
$expire = false;
// Is token expired or will token expire in the next 30 seconds
if (is_object($tokenobj)) {
$expire = ($tokenobj->getEndOfLife() !== -9002 && $tokenobj->getEndOfLife() !== -9001 && time() > ($tokenobj->getEndOfLife() - 30));
}
// Token expired so we refresh it
if (is_object($tokenobj) && $expire) {
$credentials = new Credentials(
getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_ID'),
getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_SECRET'),
getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_URLAUTHORIZE')
);
$serviceFactory = new \OAuth\ServiceFactory();
$oauthname = explode('-', $OAUTH_SERVICENAME);
// ex service is Google-Emails we need only the first part Google
$apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array());
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
$refreshtoken = $tokenobj->getRefreshToken();
$tokenobj = $apiService->refreshAccessToken($tokenobj);
$tokenobj->setRefreshToken($refreshtoken);
$storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj);
}
if (is_object($tokenobj)) {
$this->transport->setAuthMode('XOAUTH2');
$this->transport->setPassword($tokenobj->getAccessToken());

View File

@ -71,19 +71,19 @@ class Comment extends CommonObject
public $fk_user_modif;
/**
* @var int Entity
* @var int Entity
*/
public $entity;
/**
* @var string import key
* @var string Import key
*/
public $import_key;
public $comments = array();
/**
* @var Comment Object oldcopy
* @var Comment Object oldcopy
*/
public $oldcopy;

View File

@ -141,7 +141,7 @@ abstract class CommonObject
public $linkedObjectsFullLoaded = array();
/**
* @var Object To store a cloned copy of object before to edit it and keep track of old properties
* @var CommonObject To store a cloned copy of object before to edit it and keep track of old properties
*/
public $oldcopy;
@ -3512,7 +3512,7 @@ abstract class CommonObject
*
* @param int $exclspec >0 = Exclude special product (product_type=9)
* @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force mode Total of rounding, '1'=Force mode Rounding of total
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
* @param int $nodatabaseupdate 1=Do not update database total fields of the main object. Update only properties in memory. Can be used to save SQL when this method is called several times, so we can do it only once at end.
* @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object (used to analyze lines to check corrupted data).
* @return int <0 if KO, >0 if OK
*/
@ -3558,10 +3558,6 @@ abstract class CommonObject
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
if ($roundingadjust == '-1') {
$roundingadjust = 'auto'; // For backward compatibility
}
$forcedroundingmode = $roundingadjust;
if ($forcedroundingmode == 'auto' && isset($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)) {
$forcedroundingmode = $conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND;
@ -3573,7 +3569,7 @@ abstract class CommonObject
$multicurrency_tx = !empty($this->multicurrency_tx) ? $this->multicurrency_tx : 1;
// Define constants to find lines to sum
// Define constants to find lines to sum (field name int the table_element_line not into table_element)
$fieldtva = 'total_tva';
$fieldlocaltax1 = 'total_localtax1';
$fieldlocaltax2 = 'total_localtax2';
@ -3609,6 +3605,7 @@ abstract class CommonObject
$sql .= ' ORDER by rowid'; // We want to be sure to always use same order of line to not change lines differently when option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND is used
dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$this->total_ht = 0;
@ -3637,14 +3634,26 @@ abstract class CommonObject
$localtax_array = array($obj->localtax1_type, $obj->localtax1_tx, $obj->localtax2_type, $obj->localtax2_tx);
$tmpcal = calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array, (isset($obj->situation_percent) ? $obj->situation_percent : 100), $multicurrency_tx);
$diff_when_using_price_ht = price2num($tmpcal[1] - $obj->total_tva, 'MT', 1); // If price was set with tax price adn unit price HT has a low number of digits, then we may have a diff on recalculation from unit price HT.
$diff_when_using_price_ht = price2num($tmpcal[1] - $obj->total_tva, 'MT', 1); // If price was set with tax price and unit price HT has a low number of digits, then we may have a diff on recalculation from unit price HT.
$diff_on_current_total = price2num($obj->total_ttc - $obj->total_ht - $obj->total_tva - $obj->total_localtax1 - $obj->total_localtax2, 'MT', 1);
//var_dump($obj->total_ht.' '.$obj->total_tva.' '.$obj->total_localtax1.' '.$obj->total_localtax2.' =? '.$obj->total_ttc);
//var_dump($obj->total_ht.' '.$obj->total_tva.' '.$obj->total_localtax1.' '.$obj->total_localtax2.' => '.$obj->total_ttc);
//var_dump($diff_when_using_price_ht.' '.$diff_on_current_total);
if ($diff_when_using_price_ht && $diff_on_current_total) {
if ($diff_on_current_total) {
// This should not happen, we should always have in table: total_ttc = total_ht + total_vat + total_localtax1 + total_localtax2
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num((float) $tmpcal[1]).", total_ttc = ".price2num((float) $tmpcal[2])." WHERE rowid = ".((int) $obj->rowid);
dol_syslog('We found unconsistent data into detailed line (diff_when_using_price_ht = '.$diff_when_using_price_ht.' and diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix, LOG_WARNING);
dol_syslog('We found unconsistent data into detailed line (diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (ht=".$obj->total_ht." vat=".$obj->total_tva." tax1=".$obj->total_localtax1." tax2=".$obj->total_localtax2." ttc=".$obj->total_ttc."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix, LOG_WARNING);
$resqlfix = $this->db->query($sqlfix);
if (!$resqlfix) {
dol_print_error($this->db, 'Failed to update line');
}
$obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2];
} elseif ($diff_when_using_price_ht && $roundingadjust == '0') {
// After calculation from HT, total is consistent but we have found a difference between VAT part in calculation and into database and
// we ask to force the use of rounding on line (like done on calculation) so we force update of line
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num((float) $tmpcal[1]).", total_ttc = ".price2num((float) $tmpcal[2])." WHERE rowid = ".((int) $obj->rowid);
dol_syslog('We found a line with different rounding data into detailed line (diff_when_using_price_ht = '.$diff_when_using_price_ht.' and diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
$resqlfix = $this->db->query($sqlfix);
if (!$resqlfix) {
dol_print_error($this->db, 'Failed to update line');
@ -3725,7 +3734,7 @@ abstract class CommonObject
$this->db->free($resql);
// Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_*
// Now update global fields total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_* of main object
$fieldht = 'total_ht';
$fieldtva = 'tva';
$fieldlocaltax1 = 'localtax1';

View File

@ -5034,7 +5034,7 @@ class Form
$more .= '<div clas="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
}
$more .= '<div class="tagtd'.($i == 0 ? ' tdtop' : '').'"><input type="radio" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name'].$selkey).'" name="'.dol_escape_htmltag($input['name']).'" value="'.$selkey.'"'.$moreattr;
if ($input['disabled']) {
if (!empty($input['disabled'])) {
$more .= ' disabled';
}
if (isset($input['default']) && $input['default'] === $selkey) {

View File

@ -693,7 +693,7 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules)
$h = 0;
$head = array();
$mode = empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common';
$mode = empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$mode;
if ($nbofactivatedmodules <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled)
//$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);

View File

@ -56,7 +56,7 @@ class modEventOrganization extends DolibarrModules
$this->description = "EventOrganizationDescription";
$this->descriptionlong = "EventOrganizationDescriptionLong";
$this->version = 'experimental';
$this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where EVENTORGANIZATION is value of property name of module in uppercase)

View File

@ -137,7 +137,6 @@ class printing_printgcp extends PrintingDriver
$this->errors[] = $e->getMessage();
$token_ok = false;
}
//var_dump($this->errors);exit;
$expire = false;
// Is token expired or will token expire in the next 30 seconds

View File

@ -533,7 +533,7 @@ class Fichinter extends CommonObject
$resql = $this->db->query($sql);
if ($resql) {
if (!$error) {
$this->oldcopy = clone $this;
$this->oldcopy = dol_clone($this);
}
if (!$error) {
@ -1422,7 +1422,7 @@ class Fichinter extends CommonObject
}
if (!$error) {
$this->oldcopy = clone $this;
$this->oldcopy = dol_clone($this);
$this->ref_client = $ref_client;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -326,8 +326,8 @@ FTPPassiveMode=Passive mode
ChooseAFTPEntryIntoMenu=Choose a FTP/SFTP site from the menu...
FailedToGetFile=Failed to get files %s
ErrorFTPNodisconnect=Error to disconnect FTP/SFTP server
FileWasUpload=File <b>%s</b> was upload
FTPFailedToUploadFile=Failed to upload file <b>%s</b>.
FileWasUpload=File <b>%s</b> was uploaded
FTPFailedToUploadFile=Failed to upload the file <b>%s</b>.
AddFolder=Create folder
FileWasCreateFolder=Folder <b>%s</b> was create
FileWasCreateFolder=Folder <b>%s</b> has been created
FTPFailedToCreateFolder=Failed to create folder <b>%s</b>.

View File

@ -150,3 +150,4 @@ ErrorFaviconSize=Favicon must be sized 16x16, 32x32 or 64x64
FaviconTooltip=Upload an image which needs to be a png (16x16, 32x32 or 64x64)
NextContainer=Next page/container
PreviousContainer=Previous page/container
WebsiteMustBeDisabled=The website must have the status "Disabled"

View File

@ -1051,9 +1051,7 @@ class Product extends CommonObject
if ($result >= 0) {
if (empty($this->oldcopy)) {
$org = new self($this->db);
$org->fetch($this->id);
$this->oldcopy = $org;
$this->oldcopy = dol_clone($this);
}
// Test if batch management is activated on existing product
@ -1929,7 +1927,7 @@ class Product extends CommonObject
global $conf;
$result = 0;
// We do a first seach with a select by searching with couple prodfournprice and qty only (later we will search on triplet qty/product_id/fourn_ref)
// We do a first search with a select by searching with couple prodfournprice and qty only (later we will search on triplet qty/product_id/fourn_ref)
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.remise_percent,";
$sql .= " pfp.fk_product, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression,";
$sql .= " pfp.default_vat_code,";

View File

@ -388,9 +388,7 @@ class Productlot extends CommonObject
// Put here code to add a control on parameters values
if (empty($this->oldcopy)) {
$org = new self($this->db);
$org->fetch($this->id);
$this->oldcopy = $org;
$this->oldcopy = dol_clone($this);
}
// Update request

View File

@ -257,7 +257,7 @@ if (empty($reshook) && $action == 'add') {
$public = GETPOSTISSET('public') ? 1 : 0;
if (!$error) {
// email a peu pres correct et le login n'existe pas
// E-mail looks OK and login does not exist
$adh = new Adherent($db);
$adh->statut = -1;
$adh->public = $public;
@ -378,6 +378,16 @@ if (empty($reshook) && $action == 'add') {
}
}
// Auto-create thirdparty on member creation
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
$company = new Societe($db);
$result = $company->create_from_member($adh);
if ($result < 0) {
$error++;
$errmsg .= join('<br>', $company->errors);
}
}
if (!empty($backtopage)) {
$urlback = $backtopage;
} elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {

View File

@ -263,9 +263,7 @@ class Dolresource extends CommonObject
}
if (empty($this->oldcopy)) {
$org = new self($this->db);
$org->fetch($this->id);
$this->oldcopy = $org;
$this->oldcopy = dol_clone($this);
}
// Update request

View File

@ -4024,12 +4024,25 @@ class Societe extends CommonObject
global $conf, $user, $langs;
dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG);
$fullname = $member->getFullName($langs);
$name = $socname ? $socname : $member->societe;
if (empty($name)) {
$name = $member->getFullName($langs);
if ($member->morphy == 'mor') {
if (empty($socname)) {
$socname = $member->company? $member->company : $member->societe;
}
if (!empty($fullname) && empty($socalias)) {
$socalias = $fullname;
}
} elseif (empty($socname) && $member->morphy == 'phy') {
if (empty($socname)) {
$socname = $fullname;
}
if (!empty($member->company) && empty($socalias)) {
$socalias = $member->company;
}
}
$name = $socname;
$alias = $socalias ? $socalias : '';
// Positionne parametres

View File

@ -1358,7 +1358,7 @@ if ($action == 'create') {
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
$objectsrc->remise_absolue = $remise_absolue;
$objectsrc->remise_percent = $remise_percent;
$objectsrc->update_price(1, - 1, 1);
$objectsrc->update_price(1, 'auto', 1);
}
print "\n<!-- ".$classname." info -->";

View File

@ -564,6 +564,27 @@ if (empty($reshook)) {
$line = array('description' => $prod->description, 'price' => $price, 'tva_tx' => $tva_tx, 'locatax1_tx' => $localtax1_tx, 'locatax2_tx' => $localtax2_tx, 'remise_percent' => $customer->remise_percent, 'price_ttc' => $price_ttc, 'array_options' => $array_options);
/* setup of margin calculation */
if (isset($conf->global->MARGIN_TYPE)) {
if ($conf->global->MARGIN_TYPE == 'pmp' && ! empty($prod->pmp)) {
$line['fk_fournprice'] = null;
$line['pa_ht'] = $prod->pmp;
} elseif ($conf->global->MARGIN_TYPE == 'costprice' && ! empty($prod->cost_price)) {
$line['fk_fournprice'] = null;
$line['pa_ht'] = $prod->cost_price;
} else {
// default is fournprice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$pf = new ProductFournisseur($db);
if ($pf->find_min_price_product_fournisseur($idproduct, $qty) > 0) {
$line['fk_fournprice'] = $pf->product_fourn_price_id;
$line['pa_ht'] = $pf->fourn_unitprice_with_discount;
if ($pf->fourn_charges > 0)
$line['pa_ht'] += $pf->fourn_charges / $pf->fourn_qty;
}
}
}
// complete line by hook
$parameters = array('prod' => $prod, 'line' => $line);
$reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks
@ -575,7 +596,7 @@ if (empty($reshook)) {
$line = $hookmanager->resArray;
}
$idoflineadded = $invoice->addline($line['description'], $line['price'], $qty, $line['tva_tx'], $line['localtax1_tx'], $line['localtax2_tx'], $idproduct, $line['remise_percent'], '', 0, 0, 0, '', $price_base_type, $line['price_ttc'], $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', $line['array_options'], 100, '', null, 0);
$idoflineadded = $invoice->addline($line['description'], $line['price'], $qty, $line['tva_tx'], $line['localtax1_tx'], $line['localtax2_tx'], $idproduct, $line['remise_percent'], '', 0, 0, 0, '', $price_base_type, $line['price_ttc'], $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', $line['fk_fournprice'], $line['pa_ht'], '', $line['array_options'], 100, '', null, 0);
}
if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {

View File

@ -130,7 +130,7 @@ if ($invoiceid > 0) {
if ($invoice->type != $invoice::TYPE_CREDIT_NOTE) {
if (empty($conf->global->$keyforstripeterminalbank)) { ?>
const config = {simulated: <?php if (empty($servicestatus) && !empty($conf->global->STRIPE_TERMINAL_SIMULATED)) { ?> true <?php } else { ?> false <?php } ?>
<?php if (!empty($conf->global->STRIPE_LOCATION)) { ?>, location: '<?php echo $conf->global->STRIPE_LOCATION; ?>'<?php } ?>}
<?php if (!empty($conf->global->STRIPE_LOCATION)) { ?>, location: '<?php echo $conf->global->STRIPE_LOCATION; ?>'<?php } ?>}
terminal.discoverReaders(config).then(function(discoverResult) {
if (discoverResult.error) {
console.log('Failed to discover: ', discoverResult.error);
@ -141,7 +141,7 @@ if ($invoiceid > 0) {
// cashier here and let them select which to connect to (see below).
selectedReader = discoverResult.discoveredReaders[0];
//console.log('terminal.discoverReaders', selectedReader); // only active for development
terminal.connectReader(selectedReader).then(function(connectResult) {
if (connectResult.error) {
document.getElementById("card-present-alert").innerHTML = '<div class="error">'+connectResult.error.message+'</div>';
@ -160,7 +160,7 @@ if ($invoiceid > 0) {
<?php } else { ?>
terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader($conf->global->$keyforstripeterminalbank, $stripeacc, $servicestatus)); ?>).then(function(connectResult) {
if (connectResult.error) {
document.getElementById("card-present-alert").innerHTML = '<div class="error clearboth">'+connectResult.error.message+'</div>';
document.getElementById("card-present-alert").innerHTML = '<div class="error clearboth">'+connectResult.error.message+'</div>';
console.log('Failed to connect: ', connectResult.error);
} else {
document.getElementById("card-present-alert").innerHTML = '';
@ -388,7 +388,7 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) {
<?php if (empty($servicestatus) && !empty($conf->global->STRIPE_TERMINAL_SIMULATED)) { ?>
terminal.setSimulatorConfiguration({testCardNumber: '<?php echo $conf->global->STRIPE_TERMINAL_SIMULATED; ?>'});
<?php } ?>
document.getElementById("card-present-alert").innerHTML = '<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal'); ?></div>';
document.getElementById("card-present-alert").innerHTML = '<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal'); ?></div>';
terminal.collectPaymentMethod(client_secret).then(function(result) {
if (result.error) {
// Placeholder for handling result.error
@ -398,7 +398,7 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) {
console.log('terminal.collectPaymentMethod', result.paymentIntent);
terminal.processPayment(result.paymentIntent).then(function(result) {
if (result.error) {
document.getElementById("card-present-alert").innerHTML = '<div class="error clearboth">'+result.error.message+'</div>';
document.getElementById("card-present-alert").innerHTML = '<div class="error clearboth">'+result.error.message+'</div>';
console.log(result.error)
} else if (result.paymentIntent) {
paymentIntentId = result.paymentIntent.id;
@ -409,7 +409,7 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) {
document.getElementById("card-present-alert").innerHTML = '<div class="error clearboth">'+result.error.message+'</div>';
console.log("error when capturing paymentIntent", result.error);
} else {
document.getElementById("card-present-alert").innerHTML = '<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated'); ?></div>';
document.getElementById("card-present-alert").innerHTML = '<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated'); ?></div>';
console.log("Capture paymentIntent successfull "+paymentIntentId);
parent.$("#poslines").load("invoice.php?place=<?php echo $place; ?>&action=valid&pay=CB&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() {
if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
@ -423,7 +423,7 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) {
});
}
});
});
}
});
}
@ -669,6 +669,14 @@ if ($conf->global->TAKEPOS_DELAYED_PAYMENT) {
print '<button type="button" class="calcbutton2" onclick="Validate(\'delayed\');">'.$langs->trans("Reported").'</button>';
}
?>
<?php
// Add code from hooks
$parameters=array();
$hookmanager->executeHooks('completePayment', $parameters, $invoice);
print $hookmanager->resPrint;
?>
</div>
</body>

View File

@ -149,7 +149,7 @@ if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) {
{
$objectuser->fetch($id);
$objectuser->oldcopy = clone $objectuser;
$objectuser->oldcopy = dol_clone($objectuser);
$db->begin();

View File

@ -1034,7 +1034,10 @@ class Website extends CommonObject
$allaliases = $objectpageold->pageurl;
$allaliases .= ($objectpageold->aliasalt ? ','.$objectpageold->aliasalt : '');
$line = '-- Page ID '.$objectpageold->id.' -> '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; // newid start at 1, 2...
$line = '-- File generated by Dolibarr '.DOL_VERSION.' -- '.dol_print_date(dol_now('gmt'), 'standard', 'gmt').' UTC --;';
$line .= "\n";
$line .= '-- Page ID '.$objectpageold->id.' -> '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; // newid start at 1, 2...
$line .= "\n";
fputs($fp, $line);

View File

@ -3421,7 +3421,7 @@ if ($action == 'editcss') {
$maxfilesizearray = getMaxFileSizeArray();
$maxmin = $maxfilesizearray['maxmin'];
if ($maxmin > 0) {
$texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
}
print '<input type="file" class="flat minwidth300" name="addedfile" id="addedfile"/>';
print '</tr></td>';