Skip to content

Commit

Permalink
PseudoCRM: ability to create sticky note from lead profile implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
nightflyza committed Dec 11, 2024
1 parent 2ef7b12 commit d2a82fc
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 3 deletions.
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.1 rev 9268
1.5.1 rev 9269
64 changes: 63 additions & 1 deletion api/libs/api.pseudocrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ public function renderLeadActivitiesList($leadId, $onlyLast = false) {
$previousActivities = $this->getLeadActivities($leadId);
if (!empty($previousActivities)) {
if ($onlyLast) {
$previousActivities=array_slice($previousActivities, 0, 1, true);
$previousActivities = array_slice($previousActivities, 0, 1, true);
}

//performing stigma instances creation
Expand Down Expand Up @@ -1298,6 +1298,62 @@ public function renderLeadTaskCreateForm($leadId) {
return ($result);
}

/**
* Returns sticky note creation form
*
* @return string
*/
protected function renderStickyCreateForm($textPreset) {
$inputs = wf_tag('label') . __('Text') . ': ' . wf_tag('br') . wf_tag('label', true);
$inputs .= wf_TextArea('newtext', '', $textPreset, true, '50x15');
$inputs .= wf_CheckInput('newactive', __('Create note as active'), true, true);
$inputs .= wf_DatePickerPreset('newreminddate', '');
$inputs .= wf_tag('label') . __('Remind only after this date') . wf_tag('label', true);
$inputs .= wf_tag('br');
$inputs .= wf_TimePickerPreset('newremindtime', '', __('Remind time'), false);
$inputs .= wf_tag('br');
$inputs .= wf_tag('br');
$inputs .= wf_Submit(__('Create'));

$result = wf_Form(StickyNotes::URL_ME, 'POST', $inputs, 'glamour');

return ($result);
}


/**
* Returns lead sticky note creation form control
*
* @param int $leadId
*
* @return string
*/
protected function renderLeadStickyControl($leadId) {
$result = '';
$leadId = ubRouting::filters($leadId, 'int');
if ($this->isLeadExists($leadId)) {
$leadData = $this->getLeadData($leadId);
$textPreset = '';
$textPreset .= __('Lead') . ': ' . $leadData['address'] . PHP_EOL;
$textPreset .= __('Real Name') . ': ' . $leadData['realname'] . PHP_EOL;
if (!empty($leadData['mobile'])) {
$textPreset .= __('Mobile') . ': ' . $leadData['mobile'] . PHP_EOL;
}
if (!empty($leadData['phone'])) {
$textPreset .= __('Phone') . ': ' . $leadData['phone'] . PHP_EOL;
}
if (!empty($leadData['extmobile'])) {
$textPreset .= __('Additional mobile') . ': ' . $leadData['extmobile'] . PHP_EOL;
}
$textPreset .= '======' . PHP_EOL;


$stickyForm = $this->renderStickyCreateForm($textPreset);
$result .= wf_modalAuto(wf_img('skins/pushpin.png') . ' ' . __('Create new personal note'), __('Create new personal note'), $stickyForm, 'ubButton');
}
return ($result);
}

/**
* Searches lead Id by assigned login, returns 0 if not found.
*
Expand Down Expand Up @@ -1567,6 +1623,12 @@ public function renderPanel() {
if (cfr(self::RIGHT_TASKS)) {
$result .= $this->renderLeadTaskCreateForm($leadId);
}

if (cfr('STICKYNOTES')) {
if ($this->altCfg['STICKY_NOTES_ENABLED']) {
$result .= $this->renderLeadStickyControl($leadId);
}
}
}

if (ubRouting::checkGet(self::ROUTE_LEADS_LIST)) {
Expand Down
1 change: 0 additions & 1 deletion config/optsextcfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ftp
gd
hash
iconv
imap
json
libxml
mbstring
Expand Down

0 comments on commit d2a82fc

Please sign in to comment.