Merge branch 'warehouse_tags_in_reassortlot' of github.com:altairisfr/dolibarr into warehouse_tags_in_reassortlot
This commit is contained in:
commit
6221cb70e8
@ -142,6 +142,11 @@ if ($id > 0 && $removeelem > 0) {
|
||||
$tmpobject = new User($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'user';
|
||||
} elseif ($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
|
||||
$tmpobject = new Ticket($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'ticket';
|
||||
}
|
||||
|
||||
$result = $object->del_type($tmpobject, $elementtype);
|
||||
@ -167,7 +172,8 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
|
||||
if ($elemid && $action == 'addintocategory' &&
|
||||
(($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) ||
|
||||
($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer)
|
||||
($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write)
|
||||
)) {
|
||||
if ($type == Categorie::TYPE_PRODUCT) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
@ -181,6 +187,10 @@ if ($elemid && $action == 'addintocategory' &&
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$newobject = new Societe($db);
|
||||
$elementtype = 'supplier';
|
||||
} elseif ($type == Categorie::TYPE_TICKET) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
|
||||
$newobject = new Ticket($db);
|
||||
$elementtype = 'ticket';
|
||||
}
|
||||
$result = $newobject->fetch($elemid);
|
||||
|
||||
@ -1024,6 +1034,78 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == Categorie::TYPE_TICKET) {
|
||||
$permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
|
||||
|
||||
$tickets = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||
if ($tickets < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
} else {
|
||||
// Form to add record into a category
|
||||
$showclassifyform = 1;
|
||||
if ($showclassifyform) {
|
||||
print '<br>';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="addintocategory">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddTicketIntoCategory").' ';
|
||||
$form->selectTickets('', 'elemid');
|
||||
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
|
||||
print '<br>';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($tickets); $nbtotalofrecords = ''; $newcardbutton = '';
|
||||
print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit);
|
||||
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Ref").'</td></tr>'."\n";
|
||||
|
||||
if (count($tickets) > 0) {
|
||||
$i = 0;
|
||||
foreach ($tickets as $ticket) {
|
||||
$i++;
|
||||
if ($i > $limit) break;
|
||||
|
||||
print "\t".'<tr class="oddeven">'."\n";
|
||||
print '<td class="nowrap" valign="top">';
|
||||
print $ticket->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
print '<td class="tdtop">'.$ticket->label."</td>\n";
|
||||
// Link to delete from category
|
||||
print '<td class="right">';
|
||||
if ($permission) {
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&removeelem=".$ticket->id."'>";
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
|
||||
print "</a>";
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -6521,11 +6521,11 @@ abstract class CommonObject
|
||||
} elseif (in_array($type, array('int', 'integer'))) {
|
||||
$tmp = explode(',', $size);
|
||||
$newsize = $tmp[0];
|
||||
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
|
||||
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"'.($newsize > 0 ? ' maxlength="'.$newsize.'"' : '').' value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
|
||||
} elseif (in_array($type, array('real'))) {
|
||||
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
|
||||
} elseif (preg_match('/varchar/', $type)) {
|
||||
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
|
||||
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"'.($size > 0 ? ' maxlength="'.$size.'"' : '').' value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
|
||||
} elseif (in_array($type, array('mail', 'phone', 'url'))) {
|
||||
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
|
||||
} elseif (preg_match('/^text/', $type)) {
|
||||
@ -7492,7 +7492,7 @@ abstract class CommonObject
|
||||
|
||||
if ($display_type == 'card') {
|
||||
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldcreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
|
||||
if ( ! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ) {
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && $action == 'view') {
|
||||
$out .= '<td></td>';
|
||||
}
|
||||
$out .= '<td class="wordbreak';
|
||||
@ -8532,7 +8532,6 @@ abstract class CommonObject
|
||||
// Retrieve all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
dol_syslog("aaa=".$this->id);
|
||||
|
||||
return $this->id;
|
||||
} else {
|
||||
|
||||
@ -6828,6 +6828,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray = array_merge($substitutionarray, array(
|
||||
'__MYCOMPANY_NAME__' => $mysoc->name,
|
||||
'__MYCOMPANY_EMAIL__' => $mysoc->email,
|
||||
'__MYCOMPANY_PHONE__' => $mysoc->phone,
|
||||
'__MYCOMPANY_FAX__' => $mysoc->fax,
|
||||
'__MYCOMPANY_PROFID1__' => $mysoc->idprof1,
|
||||
'__MYCOMPANY_PROFID2__' => $mysoc->idprof2,
|
||||
'__MYCOMPANY_PROFID3__' => $mysoc->idprof3,
|
||||
|
||||
@ -93,6 +93,7 @@ class modBarcode extends DolibarrModules
|
||||
|
||||
// Main menu entries
|
||||
$r = 0;
|
||||
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'mainmenu'=>'tools',
|
||||
@ -106,7 +107,7 @@ class modBarcode extends DolibarrModules
|
||||
'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->lire_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
'user'=>0, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
$r++;
|
||||
|
||||
|
||||
@ -135,6 +135,28 @@ class modHoliday extends DolibarrModules
|
||||
//$r++;
|
||||
|
||||
|
||||
// Cronjobs
|
||||
$arraydate = dol_getdate(dol_now());
|
||||
$datestart = dol_mktime(4, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']);
|
||||
$this->cronjobs = array(
|
||||
0 => array(
|
||||
'label' => 'HolidayBalanceMonthlyUpdate',
|
||||
'jobtype' => 'method',
|
||||
'class' => 'holiday/class/holiday.class.php',
|
||||
'objectname' => 'Holiday',
|
||||
'method' => 'updateBalance',
|
||||
'parameters' => '',
|
||||
'comment' => 'Update holiday balance every month',
|
||||
'frequency' => 1,
|
||||
'unitfrequency' => 3600 * 24,
|
||||
'priority' => 50,
|
||||
'status' => 1,
|
||||
'test' => '$conf->holiday->enabled',
|
||||
'datestart' => $datestart
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$r = 0;
|
||||
|
||||
@ -324,6 +324,9 @@ class EmailCollector extends CommonObject
|
||||
// Clear fields
|
||||
$object->ref = "copy_of_".$object->ref;
|
||||
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
if (empty($object->host)) {
|
||||
$object->host = 'imap.example.com';
|
||||
}
|
||||
// ...
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
||||
@ -849,11 +852,11 @@ class EmailCollector extends CommonObject
|
||||
$regexstring = '';
|
||||
//$transformationstring='';
|
||||
$regforregex = array();
|
||||
if (preg_match('/^EXTRACT:([a-zA-Z0-9]+):(.*):([^:])$/', $valueforproperty, $regforregex)) {
|
||||
if (preg_match('/^EXTRACT:([a-zA-Z0-9_]+):(.*):([^:])$/', $valueforproperty, $regforregex)) {
|
||||
$sourcefield = $regforregex[1];
|
||||
$regexstring = $regforregex[2];
|
||||
//$transofrmationstring=$regforregex[3];
|
||||
} elseif (preg_match('/^EXTRACT:([a-zA-Z0-9]+):(.*)$/', $valueforproperty, $regforregex)) {
|
||||
} elseif (preg_match('/^EXTRACT:([a-zA-Z0-9_]+):(.*)$/', $valueforproperty, $regforregex)) {
|
||||
$sourcefield = $regforregex[1];
|
||||
$regexstring = $regforregex[2];
|
||||
}
|
||||
@ -1199,15 +1202,20 @@ class EmailCollector extends CommonObject
|
||||
$iforemailloop = 0;
|
||||
foreach ($arrayofemail as $imapemail) {
|
||||
if ($nbemailprocessed > 1000) {
|
||||
break; // Do not process more than 1000 email per launch (this is a different protection than maxnbcollectedpercollect
|
||||
break; // Do not process more than 1000 email per launch (this is a different protection than maxnbcollectedpercollect)
|
||||
}
|
||||
|
||||
$iforemailloop++;
|
||||
|
||||
// GET header and overview datas
|
||||
|
||||
$header = imap_fetchheader($connection, $imapemail, 0);
|
||||
$overview = imap_fetch_overview($connection, $imapemail, 0);
|
||||
|
||||
/* print $header; var_dump($overview); */
|
||||
|
||||
// Process $header of email
|
||||
$header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines
|
||||
/*print $header;
|
||||
print $header;*/
|
||||
|
||||
$matches = array();
|
||||
preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', $header, $matches);
|
||||
@ -1297,9 +1305,6 @@ class EmailCollector extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// GET Email meta datas
|
||||
$overview = imap_fetch_overview($connection, $imapemail, 0);
|
||||
|
||||
dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." from=".$overview[0]->from." to=".$overview[0]->to." subject=".$overview[0]->subject);
|
||||
|
||||
$overview[0]->subject = $this->decodeSMTPSubject($overview[0]->subject);
|
||||
@ -1309,10 +1314,14 @@ class EmailCollector extends CommonObject
|
||||
// Removed emojis
|
||||
$overview[0]->subject = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $overview[0]->subject);
|
||||
|
||||
// Parse IMAP email structure
|
||||
// GET IMAP email structure/content
|
||||
|
||||
global $htmlmsg, $plainmsg, $charset, $attachments;
|
||||
|
||||
$this->getmsg($connection, $imapemail);
|
||||
|
||||
//print $plainmsg; var_dump($plainmsg); exit;
|
||||
|
||||
//$htmlmsg,$plainmsg,$charset,$attachments
|
||||
$messagetext = $plainmsg ? $plainmsg : dol_string_nohtmltag($htmlmsg, 0);
|
||||
// Removed emojis
|
||||
@ -1640,13 +1649,15 @@ class EmailCollector extends CommonObject
|
||||
if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty') {
|
||||
if (empty($operation['actionparam'])) {
|
||||
$errorforactions++;
|
||||
$this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be a rule like 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to set or extract data";
|
||||
$this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be a rule like 'name=HEADER:^From:(.*);' or 'name=SET:xxx' or 'name=EXTRACT:(body|subject):regex where 'name' can be replaced with 'id' or 'email' to define how to set or extract data. More properties can also be set, for example client=SET:2;";
|
||||
$this->errors[] = $this->error;
|
||||
} else {
|
||||
$actionparam = $operation['actionparam'];
|
||||
$idtouseforthirdparty = '';
|
||||
$nametouseforthirdparty = '';
|
||||
$emailtouseforthirdparty = '';
|
||||
|
||||
// $this->actionparam = 'SET:aaa' or 'EXTRACT:BODY:....'
|
||||
// $actionparam = 'param=SET:aaa' or 'param=EXTRACT:BODY:....'
|
||||
$arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '=');
|
||||
foreach ($arrayvaluetouse as $propertytooverwrite => $valueforproperty) {
|
||||
$sourcestring = '';
|
||||
@ -1654,7 +1665,7 @@ class EmailCollector extends CommonObject
|
||||
$regexstring = '';
|
||||
$regforregex = array();
|
||||
|
||||
if (preg_match('/^EXTRACT:([a-zA-Z0-9]+):(.*)$/', $valueforproperty, $regforregex)) {
|
||||
if (preg_match('/^EXTRACT:([a-zA-Z0-9_]+):(.*)$/', $valueforproperty, $regforregex)) {
|
||||
$sourcefield = $regforregex[1];
|
||||
$regexstring = $regforregex[2];
|
||||
}
|
||||
@ -1674,10 +1685,18 @@ class EmailCollector extends CommonObject
|
||||
if (preg_match('/'.$regexstring.'/ms', $sourcestring, $regforval)) {
|
||||
//var_dump($regforval[count($regforval)-1]);exit;
|
||||
// Overwrite param $tmpproperty
|
||||
$nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null;
|
||||
if ($propertytooverwrite == 'id') {
|
||||
$idtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null;
|
||||
} elseif ($propertytooverwrite == 'email') {
|
||||
$emailtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null;
|
||||
} else {
|
||||
$nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null;
|
||||
}
|
||||
} else {
|
||||
// Regex not found
|
||||
$idtouseforthirdparty = null;
|
||||
$nametouseforthirdparty = null;
|
||||
$emailtouseforthirdparty = null;
|
||||
}
|
||||
//var_dump($object->$tmpproperty);exit;
|
||||
} else {
|
||||
@ -1689,7 +1708,13 @@ class EmailCollector extends CommonObject
|
||||
} elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $reg)) {
|
||||
//if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $reg[1];
|
||||
//else $object->$tmpproperty = $reg[1];
|
||||
$nametouseforthirdparty = $reg[2];
|
||||
if ($propertytooverwrite == 'id') {
|
||||
$idtouseforthirdparty = $reg[2];
|
||||
} elseif ($propertytooverwrite == 'email') {
|
||||
$emailtouseforthirdparty = $reg[2];
|
||||
} else {
|
||||
$nametouseforthirdparty = $reg[2];
|
||||
}
|
||||
} else {
|
||||
$errorforactions++;
|
||||
$this->error = 'Bad syntax for description of action parameters: '.$actionparam;
|
||||
@ -1698,8 +1723,8 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (!$errorforactions && $nametouseforthirdparty) {
|
||||
$result = $thirdpartystatic->fetch(0, $nametouseforthirdparty);
|
||||
if (!$errorforactions && ($idtouseforthirdparty || $emailtouseforthirdparty || $nametouseforthirdparty)) {
|
||||
$result = $thirdpartystatic->fetch($idtouseforthirdparty, $nametouseforthirdparty, '', '', '', '', '', '', '', '', $emailtouseforthirdparty);
|
||||
if ($result < 0) {
|
||||
$errorforactions++;
|
||||
$this->error = 'Error when getting thirdparty with name '.$nametouseforthirdparty.' (may be 2 record exists with same name ?)';
|
||||
@ -1707,20 +1732,20 @@ class EmailCollector extends CommonObject
|
||||
break;
|
||||
} elseif ($result == 0) {
|
||||
if ($operation['type'] == 'loadthirdparty') {
|
||||
dol_syslog("Third party with name ".$nametouseforthirdparty." was not found");
|
||||
dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." was not found");
|
||||
|
||||
$errorforactions++;
|
||||
$this->error = 'ErrorFailedToLoadThirdParty';
|
||||
$this->errors[] = 'ErrorFailedToLoadThirdParty';
|
||||
} elseif ($operation['type'] == 'loadandcreatethirdparty') {
|
||||
dol_syslog("Third party with name ".$nametouseforthirdparty." was not found. We try to create it.");
|
||||
dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." was not found. We try to create it.");
|
||||
|
||||
// Create thirdparty
|
||||
$thirdpartystatic->name = $nametouseforthirdparty;
|
||||
if ($fromtext != $nametouseforthirdparty) {
|
||||
$thirdpartystatic->name_alias = $fromtext;
|
||||
}
|
||||
$thirdpartystatic->email = $from;
|
||||
$thirdpartystatic->email = ($emailtouseforthirdparty ? $emailtouseforthirdparty : $from);
|
||||
|
||||
// Overwrite values with values extracted from source email
|
||||
$errorforthisaction = $this->overwritePropertiesOfObject($thirdpartystatic, $operation['actionparam'], $messagetext, $subject, $header);
|
||||
|
||||
@ -220,13 +220,12 @@ class CommandeFournisseurDispatch extends CommonObject
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
// Call triggers
|
||||
$result=$this->call_trigger('LINERECEPTION_CREATE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -227,7 +227,7 @@ class Holiday extends CommonObject
|
||||
|
||||
if ($result >= 0) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
return 0; // for cronjob use (0 is OK, any other value is an error code)
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
|
||||
@ -25,7 +25,7 @@ create table llx_object_lang
|
||||
fk_object integer DEFAULT 0 NOT NULL,
|
||||
type_object varchar(32) NOT NULL, -- value found into $object->element: 'thirdparty', 'contact', '...'
|
||||
property varchar(32) NOT NULL, -- name of property
|
||||
lang varchar(5) DEFAULT 0 NOT NULL,
|
||||
lang varchar(5) DEFAULT '' NOT NULL,
|
||||
value text,
|
||||
import_key varchar(14) DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -2092,7 +2092,7 @@ LargerThan=Larger than
|
||||
IfTrackingIDFoundEventWillBeLinked=Note that If a tracking ID of an object is found into email, or if the email is an answer of an email aready collected and linked to an object, the created event will be automatically linked to the known related object.
|
||||
WithGMailYouCanCreateADedicatedPassword=With a GMail account, if you enabled the 2 steps validation, it is recommanded to create a dedicated second password for the application instead of using your own account passsword from https://myaccount.google.com/.
|
||||
EmailCollectorTargetDir=It may be a desired behaviour to move the email into another tag/directory when it was processed successfully. Just set name of directory here to use this feature (Do NOT use special characters in name). Note that you must also use a read/write login account.
|
||||
EmailCollectorLoadThirdPartyHelp=You can use this action to use the email content to find and load an existing thirdparty in your database. The found (or created) thirdparty will be used for following actions that need it. In the parameter field you can use for example 'EXTRACT:BODY:Name:\s([^\s]*)' if you want to extract the name of the thirdparty from a string 'Name: name to find' found into the body.
|
||||
EmailCollectorLoadThirdPartyHelp=You can use this action to use the email content to find and load an existing thirdparty in your database. The found (or created) thirdparty will be used for following actions that need it.<br>For example, if you want to create a thirdparty with a name extracted a string 'Name: name to find' found into the body, use sender email as email, you can set the parameter field like this:<br>'email=HEADER:^From:(.*);name=EXTRACT:BODY:Name:\s([^\s]*);client=SET:2;'<br>
|
||||
EndPointFor=End point for %s : %s
|
||||
DeleteEmailCollector=Delete email collector
|
||||
ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector?
|
||||
|
||||
@ -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
|
||||
HolidayBalanceMonthlyUpdate=Monthly update of holiday balance
|
||||
|
||||
@ -17,6 +17,7 @@ ContactsCategoriesArea=Espace tags/catégories de contacts
|
||||
AccountsCategoriesArea=Espace des tags/categories de comptes bancaires
|
||||
ProjectsCategoriesArea=Espace des tags/catégories des projets
|
||||
UsersCategoriesArea=Espace des tags/catégories des utilisateurs
|
||||
TicketsCategoriesArea=Espace tags/catégories des tickets
|
||||
SubCats=Sous-catégories
|
||||
CatList=Liste des tags/catégories
|
||||
CatListAll=Liste de toutes les catégories (de tous types)
|
||||
@ -90,6 +91,7 @@ CategorieRecursivHelp=Si l'option est activé, quand un produit est ajouté dans
|
||||
AddProductServiceIntoCategory=Ajouter le produit/service suivant
|
||||
AddCustomerIntoCategory=Assigner cette catégorie au client
|
||||
AddSupplierIntoCategory=Assigner cette catégorie au fournisseur
|
||||
AddTicketIntoCategory=Assigner cette catégorie au ticket
|
||||
ShowCategory=Afficher tag/catégorie
|
||||
ByDefaultInList=Par défaut dans la liste
|
||||
ChooseCategory=Choisissez une catégorie
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
@ -1280,7 +1280,8 @@ class Societe extends CommonObject
|
||||
$this->get_codefournisseur($this, 1);
|
||||
}
|
||||
|
||||
$this->code_compta = trim($this->code_compta);
|
||||
$this->code_compta_client = trim(empty($this->code_compta) ? $this->code_compta_client : $this->code_compta);
|
||||
$this->code_compta = $this->code_compta_client; // for backward compatbility
|
||||
$this->code_compta_fournisseur = trim($this->code_compta_fournisseur);
|
||||
|
||||
// Check parameters. More tests are done later in the ->verify()
|
||||
@ -1292,8 +1293,8 @@ class Societe extends CommonObject
|
||||
|
||||
$customer = false;
|
||||
if (!empty($allowmodcodeclient) && !empty($this->client)) {
|
||||
// Attention get_codecompta peut modifier le code suivant le module utilise
|
||||
if (empty($this->code_compta)) {
|
||||
// If $allowmodcodeclient is set and value is not set, we generate it
|
||||
if (empty($this->code_compta_client)) {
|
||||
$ret = $this->get_codecompta('customer');
|
||||
if ($ret < 0) {
|
||||
return -1;
|
||||
@ -1305,8 +1306,8 @@ class Societe extends CommonObject
|
||||
|
||||
$supplier = false;
|
||||
if (!empty($allowmodcodefournisseur) && !empty($this->fournisseur)) {
|
||||
// Attention get_codecompta peut modifier le code suivant le module utilise
|
||||
if ($this->code_compta_fournisseur == "") {
|
||||
// If $allowmodcodefournisseur is set and value is not set, we generate it
|
||||
if (empty($this->code_compta_fournisseur)) {
|
||||
$ret = $this->get_codecompta('supplier');
|
||||
if ($ret < 0) {
|
||||
return -1;
|
||||
@ -1460,7 +1461,7 @@ class Societe extends CommonObject
|
||||
|
||||
if ($customer) {
|
||||
$sql .= ", code_client = ".(!empty($this->code_client) ? "'".$this->db->escape($this->code_client)."'" : "null");
|
||||
$sql .= ", code_compta = ".(!empty($this->code_compta) ? "'".$this->db->escape($this->code_compta)."'" : "null");
|
||||
$sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null");
|
||||
}
|
||||
|
||||
if ($supplier) {
|
||||
@ -3311,7 +3312,8 @@ class Societe extends CommonObject
|
||||
$result = $mod->get_code($this->db, $this, $type);
|
||||
|
||||
if ($type == 'customer') {
|
||||
$this->code_compta = $mod->code;
|
||||
$this->code_compta_client = $mod->code;
|
||||
$this->code_compta = $this->code_compta_client; // For backward compatibility
|
||||
} elseif ($type == 'supplier') {
|
||||
$this->code_compta_fournisseur = $mod->code;
|
||||
}
|
||||
@ -3323,6 +3325,7 @@ class Societe extends CommonObject
|
||||
}
|
||||
} else {
|
||||
if ($type == 'customer') {
|
||||
$this->code_compta_client = '';
|
||||
$this->code_compta = '';
|
||||
} elseif ($type == 'supplier') {
|
||||
$this->code_compta_fournisseur = '';
|
||||
@ -4262,21 +4265,6 @@ class Societe extends CommonObject
|
||||
return $lib;
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Set prospect level
|
||||
*
|
||||
* @param User $user User who sets the discount
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated Use update function instead
|
||||
*/
|
||||
public function set_prospect_level(User $user)
|
||||
{
|
||||
// phpcs:enable
|
||||
return $this->update($this->id, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return status of prospect
|
||||
*
|
||||
@ -4356,20 +4344,6 @@ class Societe extends CommonObject
|
||||
return "Error, mode/status not found";
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Set outstanding value
|
||||
*
|
||||
* @param User $user User making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated Use update function instead
|
||||
*/
|
||||
public function set_OutstandingBill(User $user)
|
||||
{
|
||||
// phpcs:enable
|
||||
return $this->update($this->id, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount of order not paid and total
|
||||
*
|
||||
|
||||
@ -136,7 +136,7 @@ if ($socid) {
|
||||
|
||||
$params = '';
|
||||
$backtopage = $_SERVER['PHP_SELF'].'?socid='.$object->id;
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans("NewProject"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&backtopage='.urlencode($backtopage), '', 1, $params);
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans("NewProject"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&backtopageforcancel='.urlencode($backtopage), '', 1, $params);
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
@ -202,6 +203,10 @@ if (empty($reshook)) {
|
||||
$contactid = GETPOST('contactid', 'int');
|
||||
$type_contact = GETPOST("type", 'alpha');
|
||||
|
||||
// Category association
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
if ($contactid > 0 && $type_contact) {
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
$result = $object->add_contact($contactid, $typeid, 'external');
|
||||
@ -312,7 +317,11 @@ if (empty($reshook)) {
|
||||
$object->severity_code = GETPOST('severity_code', 'alpha');
|
||||
|
||||
$ret = $object->update($user);
|
||||
if ($ret <= 0) {
|
||||
if ($ret > 0) {
|
||||
// Category association
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -1054,6 +1063,13 @@ if ($action == 'create' || $action == 'presend') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
@ -366,6 +366,6 @@ class HolidayTest extends PHPUnit\Framework\TestCase
|
||||
|
||||
$localobjecta->updateConfCP('lastUpdate', '20100101120000');
|
||||
$result = $localobjecta->updateBalance();
|
||||
$this->assertEquals($result, 1);
|
||||
$this->assertEquals($result, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user